![]() |
LockBox 3 String verschlüsseln.
Hallo Zusammen,
ich habe die aktuelle Version von LockBox3 Version 3.5.0 in Delphi XE7 installiert und mich auf der Such nach der Doku gemacht. Anscheinend gibt es keine oder gut versteckt. Es geht darum einfach ein String zu ver- und entschlüsseln. Gefunden habe ich das, aber es funktioniert nicht. Ich bekomme eine Fehlermeldung: TSimpleCodec.Begin_EncryptMemory - Algorytms not set. Was sind das für Werte für StreamCipherId, BlockCipherId und ChainModeId?
Delphi-Quellcode:
Hat jemand eine Idee?
function EncryptText_AES_128(input: string; password: string): string;
var Codec: TCodec; CipherText: String; Encoding:TEncoding; begin Codec := TCodec.Create(nil); try Codec.CryptoLibrary := TCryptographicLibrary.Create(Codec); // Codec.StreamCipherId := 'native.StreamToBlock'; Codec.BlockCipherId := Format('native.AES-%d', [128]); Codec.ChainModeId := 'dunit.ECB'; // Codec.Password := Password; Codec.EncryptString(input, CipherText, Encoding.ANSI); // Result := string(CipherText); finally Codec.Free; end; end; Gruß Kostas |
AW: LockBox 3 String verschlüsseln.
Guten Abend,
vielleicht hilft Dir dieser Thread: ![]() Grüße Klaus |
AW: LockBox 3 String verschlüsseln.
Tausend Dank Klaus,
das war der richtige Hinweis. So funktioniert es einwandfrei. Der Link zur Hilfe funkt derzeit nicht.
Delphi-Quellcode:
procedure TForm1.Button1Click(Sender: TObject);
var FLibrary : TCryptographicLibrary; FCodec : TCodec; plain,astr,dec : string; FEncoding : TEncoding; begin plain := 'The plain text'; FLibrary := TCryptographicLibrary.Create(Self); FCodec := TCodec.Create(Self); try FCodec.CryptoLibrary := FLibrary; FCodec.StreamCipherId := 'native.StreamToBlock'; FCodec.BlockCipherId := 'native.AES-256'; FCodec.ChainModeId := 'native.ECB'; FCodec.Password := 'password'; FCodec.EncryptString(plain, astr, FEncoding.ANSI); FCodec.DecryptString(dec, astr, FEncoding.ANSI); finally FCodec.Free; FLibrary.Free; end; Edit1.Text := astr; Edit2.Text := dec; end; Gruß Kostas |
Alle Zeitangaben in WEZ +1. Es ist jetzt 08:44 Uhr. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024 by Thomas Breitkreuz