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;
© 版权声明
文章版权归作者所有,未经允许请勿转载。
THE END