469,273 Members | 1,827 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,273 developers. It's quick & easy.

The signature different in C# and C++ CRYPTOAPI

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

Nov 17 '05 #1
1 2599
I got answer for myself.

The signature result is the same, except C# and C++ give result in
reverse order.

Nov 17 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

2 posts views Thread by Andy Atherton | last post: by
reply views Thread by Kim HM | last post: by
12 posts views Thread by Kim | last post: by
1 post views Thread by Greg Merideth | last post: by
reply views Thread by Bonj | last post: by
reply views Thread by =?Utf-8?B?VmVuZWRpY3Q=?= | last post: by
14 posts views Thread by =?Utf-8?B?QUEyZTcyRQ==?= | last post: by
1 post views Thread by CARIGAR | last post: by
reply views Thread by zhoujie | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.