A nice contribute by Dim (Russia)

Require libeay32.pas, v. >= 0.7

// Equivalent to:
//   openssl dgst -md5 -sign private.pem -hex -out test.hex 
function Sign_RSA_MD5(privatekey,msg: string): string;
var
Len: cardinal;
mdctx: EVP_MD_CTX;
inbuf, outbuf: array [0..1023] of char;
key: pEVP_PKEY;
begin
StrPCopy(inbuf, msg);
InitOpenSSL;
key:=ReadPrivateKey(privatekey);
EVP_SignInit(@mdctx, EVP_md5());
EVP_SignUpdate(@mdctx, @inbuf, StrLen(inbuf));
EVP_SignFinal(@mdctx, @outbuf, Len, key);
FreeOpenSSL;
BinToHex(outbuf, inbuf,Len);
inbuf[2*Len]:=#0;
result := StrPas(inbuf);
end;

 

dmdes.pas

unit dmdes; {*********************************************************} {* DELPHI、PHP、C#通用DES编码解码单元 *} {* 由TurboPower LockBox...

阅读全文

Hash a file with MD5

This tutorial continues from Encrypt a file. Setup Put another button on the main form and caption it "Hash". Add a THash compon...

阅读全文

Encrypting a file with 3DES

http://lockbox.seanbdurkin.id.au/Encrypt+a+file n this tutorial, we are going to use a component based approach to encrypt some files. Make a...

阅读全文

Comments are closed, but trackbacks and pingbacks are open.