AGB  ·  Datenschutz  ·  Impressum  







Anmelden
Nützliche Links
Registrieren
Thema durchsuchen
Ansicht
Themen-Optionen

LockBox 3 String verschlüsseln.

Ein Thema von Kostas · begonnen am 10. Mai 2015 · letzter Beitrag vom 10. Mai 2015
Antwort Antwort
Kostas

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

LockBox 3 String verschlüsseln.

  Alt 10. Mai 2015, 18:08
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:
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;
Hat jemand eine Idee?

Gruß Kostas
  Mit Zitat antworten Zitat
Klaus01

Registriert seit: 30. Nov 2005
Ort: München
5.755 Beiträge
 
Delphi 10.4 Sydney
 
#2

AW: LockBox 3 String verschlüsseln.

  Alt 10. Mai 2015, 18:22
Guten Abend,

vielleicht hilft Dir dieser Thread:
http://stackoverflow.com/questions/1...ory-wrong-mode

Grüße
Klaus
Klaus
  Mit Zitat antworten Zitat
Kostas

Registriert seit: 14. Mai 2003
Ort: Gerstrhofen
1.058 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
Antwort Antwort


Forumregeln

Es ist dir nicht erlaubt, neue Themen zu verfassen.
Es ist dir nicht erlaubt, auf Beiträge zu antworten.
Es ist dir nicht erlaubt, Anhänge hochzuladen.
Es ist dir nicht erlaubt, deine Beiträge zu bearbeiten.

BB-Code ist an.
Smileys sind an.
[IMG] Code ist an.
HTML-Code ist aus.
Trackbacks are an
Pingbacks are an
Refbacks are aus

Gehe zu:

Impressum · AGB · Datenschutz · Nach oben
Alle Zeitangaben in WEZ +1. Es ist jetzt 14:02 Uhr.
Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024 by Thomas Breitkreuz