Einzelnen Beitrag anzeigen

Kostas

Registriert seit: 14. Mai 2003
Ort: Gerstrhofen
1.062 Beiträge
 
Delphi 10 Seattle Enterprise
 
#3

AW: LockBox 3 String verschlüsseln.

  Alt 10. Mai 2015, 20:56
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
  Mit Zitat antworten Zitat