Bonjour,
j'utilise le composant JEDI JvXORCipher afin d'encoder une chaine de caractères et la décoder.
si la chaine de caractères à décoder est "fournie" par la méthode Decodestring : ok
si je lis cette chaine de caractères dans un fichier texte la méthode decodestring ne prend pas en compte tous les caractères.
le bug est lié au fait que sur embarcadero XE7 les widestring sont alloués sur 2 octets.
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52 procedure TRELCALChoixSortieFrm.FormActivate(Sender: TObject); var ii: integer; tempstr: string; bRandomCode: string; Codedépart: string; Codeactivation : string; bACoder: string; bYear: string; bBlocCode : widestring; bDecodestring: string; bLicTxt : string[100]; begin RELCALDataModule.ConnectBdd; ASerial := getserial; Edit2.Text := ASerial; bLicTxt := RELCALCommon.CleAnnuelle; RELCALDataModule.ADOSPGetMyDate.Parameters.ParamByName('@Ladate').Direction := pdOutput; RELCALDataModule.ADOSPGetMyDate.ExecProc; ADateJourStr := RELCALDataModule.ADOSPGetMyDate.Parameters.ParamByName('@Ladate').value; AdateJour := StrtoDate(ADateJourStr); AYear := YearOf(AdateJour); bYear := inttostr(AYear); EdAnnee.Text := bYear; if RELCALCommon.CleGen = '' then begin bRandomCode := RELCALDataModule.RandomPassword(10); RELCALCommon.BIniFile.WriteString('Produit', 'Gen ', bRandomCode ); RELCALCommon.CleGen := bRandomCode; end; edAbonnement.Text := RELCALCOMMON.NomAbonnement; bACoder := bYear+ASerial+RELCALCOMMON.NomAbonnement; adACoder.Text := bACoder; bBlocCode := GetGenReg(bACoder, RELCALCommon.CleGen); EdLiceCode.Text := bBlocCode; EdLicenceLUE.text := bLicTxt; bDecodeString := DecodeReg(bBlocCode,RELCALCommon.CleGen); edLicenceDec.Text := bDecodeString; eddectxt.Text := DecodeReg(RELCALCommon.CleAnnuelle ,RELCALCommon.CleGen); SetCombo; end; function TRELCALChoixSortieFrm.DecodeReg(pACoder: widestring; pkey: widestring):string; begin result := JvXORCipher1.DecodeString(pKey,pACoder); end;
merci pour votre aide,
Partager