0

Delphi XE6 と LockBox 3.4.3 を使用してコード actEncryptStringExecute を実行しています。このコードは、「デルファイを使用してロックボックス 3 で AES-256 暗号化を使用する方法」という質問に対する回答として投稿されました。私が得るエラーは TSimpleCodec.Begin_EncryptMemory - Wrong mode です。

「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