私たちはDelphi 2010でLockbox 2を使用しています。私はそれがまた、デルファイ7で動作する必要がありますね。ここのサンプルコードです:
unit LBRSA;
interface
uses
LbCipher,
LbRSA,
LbString,
LbUtils;
function DecryptRSA(const CipherText: String): String; overload; overload;
function DecryptRSA(const CipherText, Exponent, Modulus: String): String; overload;
implemention
function EncryptRSA(const ClearText, Exponent, Modulus: String): String;
var
RSA: TLbRSA;
begin
RSA := TLbRSA.Create(nil);
try
RSA.PublicKey.ExponentAsString := Exponent;
RSA.PublicKey.ModulusAsString := Modulus;
Result := RSA.EncryptStringW(ClearText);
finally
FreeAndNil(RSA);
end;
end;
function DecryptRSA(const CipherText, Exponent, Modulus: String): String;
var
RSA: TLbRSA;
begin
RSA := TLbRSA.Create(nil);
try
RSA.PrivateKey.ExponentAsString := Exponent;
RSA.PrivateKey.ModulusAsString := Modulus;
Result := RSA.DecryptStringW(CipherText);
finally
FreeAndNil(RSA);
end;
end;
end.
ロックボックスを使用すると、公開鍵と秘密鍵を生成することができますデモアプリケーションが含まれています。
なぜ「No DLL」ですか? opensslのDLLを使用すると、opensslの相互運用性が簡単に得られます。アプリケーションのインストーラにdllをパックすることができます。 – osgx