Ker*_*ugi 1 delphi encryption turbopower lockbox-3
我大约一周前已经下载了Lockbox3,但我无法使用它,并且我无法理解该演示,因为它很复杂,无法从中获取所需的代码,我想使用Lockbox 3 AES- 256个加密可在Delphi中加密字符串。
方法和属性名称几乎说明了一切。假设您已在设计时设置了编解码器属性,这也是一种自描述的方法,该方法先对字符串进行加密,然后再将其解密。
procedure TForm1.actEncryptStringExecute( Sender: TObject );
var
Plaintext, sReconstructedPlaintext: string;
base64Ciphertext: ansistring;
begin
sPlainText := 'I love LockBox 3!';
if not InputQuery( 'Plaintext', 'Enter plaintext that you want to encrypt (UTF-16LE encoding):', sPlainText) then exit;
codec.EncryptString( sPlaintext, base64Ciphertext);
ShowMessageFmt('The base64 encoding of the encoded ciphertext is'#13#10+'%s',[base64Ciphertext]);
codec.DecryptString( sReconstructedPlaintext, base64Ciphertext);
ShowMessageFmt('After decryption, this decrypts back to %s',[sReconstructedPlaintext])
end;
Run Code Online (Sandbox Code Playgroud)
再看一下演示程序。“加密”按钮的处理程序对文件而不是字符串进行加密。除此之外,如果您剥离装饰性的绒毛,例如将信息发布到备忘录中,并且如果用户指定了不存在的文件则处理异常,则它的操作非常简单-它基本上可以简化为一行...
codecMainDemo.EncryptFile( edtPlaintextFile.Text, edtCiphertextFile.Text );
Run Code Online (Sandbox Code Playgroud)
要加密字符串,请调用EncryptString()。要加密文件,请调用EncryptFile()。
该演示显示了设置,例如:
而鲍勃是你的叔叔!
如果您有任何问题,请告诉我。
| 归档时间: |
|
| 查看次数: |
10946 次 |
| 最近记录: |