long __cdecl CEncrypt(char* x509FileName, const unsigned char* fromBuf, int fromLen, unsigned char* toBuf, int* toLen)
{
EVP_PKEY *pubKey;
int err;
int debugFlag = 0;
unsigned char tmpBuf[130];
int tmpLen;
ERR_load_crypto_strings();
err = getPublicKey(x509FileName, &pubKey, debugFlag);
if (err != 0)
{
return err;
}
if (!pubKey) { if (debugFlag != 0)
{
ERR_print_errors_fp (stderr); }
return 4; }
tmpLen = RSA_public_encrypt(fromLen, fromBuf, tmpBuf, pubKey->pkey.rsa,RSA_PKCS1_PADDING);
EncodeBASE64(tmpBuf, tmpLen, toBuf, toLen);
return 0;
}
_________________________________________________________________
享用世界上最大的电子邮件系统― MSN Hotmail。 http://www.hotmail.com
______________________________________________________________________ OpenSSL Project http://www.openssl.org User Support Mailing List [EMAIL PROTECTED] Automated List Manager [EMAIL PROTECTED]