by LEMBAS [lembas at myway dot com] posted on 2003/12/22 |
|
I think this post is pretty important and uncommon.
I get a strange exception using the code below while I try to do RSA verification.
RSACryptoServiceProvider rsa = (RSACryptoServiceProvider)cert.PublicKey;
return rsa.VerifyHash(hash,CryptoConfig.MapNameToOID("SHA1"),signature);
The second line throws the exception which is "Cryptographic service provider (CSP) for this implementation generated an internal error while attempting to verify the signature."
StackTrace = "at System.Security.Cryptography.RSACryptoServiceProvider.VerifyHash(Byte[] rgbHash, String str, Byte[] rgbSignature)..."
The thing is this exception is throw "sometimes". Some values "disturb" windows2003 and xp while some do not. For example, the exception is throw with the values below and only in winXP_SP1 and win2003. It always works fine in win2000_SP4.
(all strings are in base64)
hash="4mSXKZAl2zJMxkbC500+09pR+2Y="
signature="llgZar2eCiDi2jlw7bF79uWS57pO6S4LObFHwKdNFOdeBKZOHPHo6Gg0cL4B8LwEjBnu7rGpjgHGlJr15T2Fdfmg4AUgK+jCTD7CTnbbaPC19y42ENFoLDdiPNHFgyUner2SD9nmkP196X+GxtTjKdvoSuWZSvREYd+tNRtwvWFK4IT9cJfJJ9OsviRnuQQcxNi1YeFKaGRaHhgU2reC3T6X4m4OAVEUL4U6tGExtLhFmHYTBBf/DatLxUWg2xhyipIIFfuWmBuhlV9iGTAzo5Fr9r7exT2on4kl9bM2cIz7kZ/eMAtx3T8NKx45o7GKxpYWnUVD+IVHXTW/d/GyuQ=="
publicKey="MIIBCQKCAQBezyrh4UMx5WLDkCs78MJMzBQdVqbpvQbyHpoBgt4gs9ZWzH/j5OjUGx849qfbGM0cZZNUp/eKgt9aM6tOxwjHBUqqC8NzzymMlnAwRcUxxuhY45HHTq+07JzrE02bPEmVpSPHPMDHqGwKazGXmgk7vlqLtOuAItnii5qK6yG4NcCaKRuTviN4yYhXqw3IxXIihqvJUQRPNypmIT0szoeUZB72kTtZQXfxggwS2l+1iGZW7HPOZd3AHM/lkk6skQxx8XPIlNnK5br2cGH9xk2WXOx5wuPlhOWMNDwecjfwZcN0s/EFU+XHKYG2w4tOMAHrTwQNi4Uy62mjqrW2qoWFAgMBAAE="
What could be the problem?
Is something wrong with crypt32.dll version?
version of crypt32.dll in win2000_SP4 is 5.131.2195.6661
version of crypt32.dll in win2003 is 5.131.3790.0
version of crypt32.dll in winXP_SP1 is 5.131.2600.1123 |