N
no game
I have a problem with signature using RSACryptoServiceProvider
I use
signature=privKey.SignData(byteData, new MD5CryptoServiceProvide),
and get a byte array of signature.
The other party use CryptoAPI C++ function:
//create the hash object
CryptCreateHash(
Provider,
CALG_MD5,
0,
0,
&Hash)
//add the data to be signed to the hash
CryptHashData(
Hash,
(LPBYTE)(LPCTSTR)byData,
sSignatureData.GetLength(),
0)
//sign the hash data
//two steps, first step is to get the length
//so we know how big to allocate the output buffer
CryptSignHash(
Hash,
dwKeySpec,
NULL,
0,
NULL,
&dwSignLength
)
CryptSignHash(
Hash,
dwKeySpec,
NULL,
0,
(LPBYTE)(LPCTSTR)sSignature,
&dwSignLength
)
Now they got a signature is different from what I got, and we are using
the same pair of public and private certificate and .pfx file, is there
other people have the same problem? Is there any solution to this
problem?
Thanks
I use
signature=privKey.SignData(byteData, new MD5CryptoServiceProvide),
and get a byte array of signature.
The other party use CryptoAPI C++ function:
//create the hash object
CryptCreateHash(
Provider,
CALG_MD5,
0,
0,
&Hash)
//add the data to be signed to the hash
CryptHashData(
Hash,
(LPBYTE)(LPCTSTR)byData,
sSignatureData.GetLength(),
0)
//sign the hash data
//two steps, first step is to get the length
//so we know how big to allocate the output buffer
CryptSignHash(
Hash,
dwKeySpec,
NULL,
0,
NULL,
&dwSignLength
)
CryptSignHash(
Hash,
dwKeySpec,
NULL,
0,
(LPBYTE)(LPCTSTR)sSignature,
&dwSignLength
)
Now they got a signature is different from what I got, and we are using
the same pair of public and private certificate and .pfx file, is there
other people have the same problem? Is there any solution to this
problem?
Thanks