[prev in list] [next in list] [prev in thread] [next in thread]
List: ms-cryptoapi
Subject: Re: how to do rsa private encrypt (rsa sign) using MSCAPI (ie
From: John Banes <jbanes () WINDOWS ! MICROSOFT ! COM>
Date: 2001-11-16 1:02:21
[Download RAW message or body]
The CryptHashData does not support the CALG_SSL3_SHAMD5 algorithm type.
Instead, you need to use CryptSetHashParam with HP_HASHVAL to set the
36-bit hash value prior to performing the signature operation.
Regards, John
-----Original Message-----
From: Aslam [mailto:aslam@FUNK.COM]
Sent: Thursday, November 15, 2001 1:26 PM
To: CryptoAPI@DISCUSS.MICROSOFT.COM
Subject: how to do rsa private encrypt (rsa sign) using MSCAPI (ie using
C ALG_SSL3_SHAMD5 in CryptCreateHash())...??
Hi,
Has any one used the CALG_SSL3_SHAMD5 in CryptCreateHash().. What I need
is that I should be able to perform RSA_private_encrypt operation using
microsoft crypto api so that I can use that for preparing
certificate_verify message of ssl/tls specification. For that I do the
following:
HCRYPTPROV hCryptProv = 0;
HCRYPTHAS hCryptHash = 0;
// acquire the desired context
if(! CryptAcquireContext(&hCryptProv, 0, "Microsoft RSA SChannel
Cryptographic Provider", PROV_RSA_SCHANNEL, 0)) {
PrintErrorMessage(GetLastError());
goto error;
}
// create the hash object
if(! CryptCreateHash(hCryptProv, CALG_SSL3_SHAMD5, 0, 0, &hCryptHash)) {
PrintErrorMessage(GetLastError());
goto error;
}
// perform hash (md5+sha1 for ssl/tls)
if(! CryptHashData(hCryptHash, pIn, nIn, 0))
{
PrintErrorMessage(GetLastError());
goto error;
}
// get the required buffer size
if(! CryptSignHash(hCryptHash, dwKeySpec, 0, CRYPT_NOHASHOID, 0,
&dwSignedDataSize))
{
PrintErrorMessage(GetLastError());
goto error;
}
// alloc required buffer
pSignedData = new unsigned char(dwSignedDataSize);
// perform private encrypt
if(! CryptSignHash(hCryptHash, AT_SIGNATURE, 0, CRYPT_NOHASHOID,
pSignedData, &dwSignedDataSize)) {
PrintErrorMessage(GetLastError());
goto error;
}
But I'm getiing a failure at CryptHasData() with following error code:
0x80090008 => Invalid algorithm specified.
Does any one tell me why.. or any other way to perform RSA private
encrypt using cryptoapi..
Thanks
Aslam
----------------------------------------------------------------
Users Guide http://discuss.microsoft.com/archives/mailfaq.asp
contains important info. Save time, search the archives at
http://discuss.microsoft.com/archives/index.html . To unsubscribe,
mailto:CryptoAPI-signoff-request@DISCUSS.MICROSOFT.COM
----------------------------------------------------------------
Users Guide http://discuss.microsoft.com/archives/mailfaq.asp
contains important info. Save time, search the archives at
http://discuss.microsoft.com/archives/index.html .
To unsubscribe, mailto:CryptoAPI-signoff-request@DISCUSS.MICROSOFT.COM
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic