0

我正在使用 Delphi XE6 和 LockBox 3.4.3 来运行代码 actEncryptStringExecute。此代码是作为对“如何使用 delphi 在密码箱 3 中使用 AES-256 加密”问题的回答而发布的。我得到的错误是 TSimpleCodec.Begin_EncryptMemory - 错误模式。

还有另一个问题“TSimpleCodec.Begin_EncryptMemory - 错误模式”,答案是“如果您使用设计时值设置编解码器,则不需要这样做。在设计时更容易做到。只需设置根据需要发布的属性”。

TCodec properties are :-
AdvancedOptions2 = []
AsymetricKeySizeInBits = 1024
ChainMode = ECB (with block padding)
Cipher = Base64
CryptoLibrary = CryptographicLibrary1
Encoding = (TEncoding)

TCryptographicLibrary properties are :-
CustomCipher = (TCustomStreamCipher)
Name = CryptographicLibrary1
ParentLibrary = 

代码是: -

var
base64CipherText          : String;
PlainTextStr              : String;
ReconstructedPlainTextStr : String;


procedure TForm1.btnEncryptClick(Sender: TObject);
begin
PlainTextStr := edtPlainText.Text;
Codec1.EncryptString(PlainTextStr, base64CipherText, TEncoding.Unicode);
lblEncrypted.Caption := base64CipherText;

Codec1.DecryptString(ReconstructedPlainTextStr, base64CipherText, TEncoding.Unicode);
lblReconstructed.Caption := base64CipherText;
end;

我需要在设计时进行哪些更改才能使这个最简单的示例正常工作?

4

0 回答 0