Re: CryptographicException: Unknown failure in Win98 only
From: Scott (scott_at_msdn.com.au)
Date: 11/17/04
- Previous message: Nicole Calinoiu: "Re: check nt file/folder permission"
- In reply to: Scott: "Re: CryptographicException: Unknown failure in Win98 only"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ] [ attachment ]
Date: Wed, 17 Nov 2004 06:24:01 -0800
I have done some more testing and found that rsa.FromXmlString() works
correctly on both platforms. I can call rsa.ExportParameters() to confirm
the key details and they are identical in both Win98 and WinXP.
The CryptographicException is raised in the call to rsa.Decrypt(). The
stack trace shows it is actually raised within _DecryptKey(IntPtr hCSP,
IntPtr hPubKey, Byte[] rgbKey, Int32 dwFlags) which is called directly by
rsa.Decrypt(). Once again the exception message e.Message is "Unkown
failure; unable to generate error message."
I hope someone has seen this before and can help.
Thanks,
Scott.
"Scott" wrote:
> Thanks for the response Valery,
> I am running IE v6.0.2800.1106 on Win98 and my understanding is this already
> has strong cryptography built-in. Anyway, I tried to install the strong
> cryptography pack for Win98, but it failed as it seems to only install on IE
> v5.01. That would make sesne if IE6 already has strong crypto.
>
> I will do more debugging and post again, but in the code snippet below it
> looks like I am able to create the RSACryptoServiceProvider object and this
> automatically generates a 1024 bit key. The exception seems to be raised as
> I load the XML key that I have already extracted from the machine key store.
> When debugging on Win98 the XML string looks the same as it does on WinXP, so
> not sure what is going on here.
>
> Thanks,
> Scott.
>
>
> "Valery Pryamikov" wrote:
>
> > Hi,
> > I'm not sure if there is strong cryptography pack for Windows 98 (it was
> > very very long time I've look at that end), but if there is such - you need
> > to install it. 1024 bit key not supported by Microsoft Base Cryptography
> > provider - default provider on W9X line and you need Microsoft Enhanced
> > Cryptography provider for working with that key.
> >
> > -Valery.
> > http://www.harper.no/valery
> >
> > "Scott" <scott@msdn.com.au> wrote in message
> > news:8FA1F79E-BBE8-4276-83CF-FA23599ECE4D@microsoft.com...
> > >I am decrypting using RSACyptoServiceProvider with a 128 byte key and OAEP
> > > padding set to false. I load the RSA key in from an XML string
> > > (originally
> > > from a machine key store container). It works fine in WinXP, but fails in
> > > Win98, with a CryptographicException containing the unhelpful message:
> > >
> > > Unknown failure; unable to generate error message.
> > >
> > > I would appreciate help from anyone who has worked through this problem.
> > > Thanks,
> > > Scott.
> > >
> > > The C# code snippet is as follows:
> > >
> > > private byte[] RSADecrypt(byte[] msg, string xmlKey)
> > > {
> > > try
> > > {
> > > RSACryptoServiceProvider rsa = new RSACryptoServiceProvider();
> > > rsa.FromXmlString(xmlKey);
> > > return (rsa.Decrypt(msg, false));
> > > }
> > > catch (CryptographicException e)
> > > {
> > > .....
> > > }
> > > }
> > >
> > >
> > >
> >
> >
> >
- Previous message: Nicole Calinoiu: "Re: check nt file/folder permission"
- In reply to: Scott: "Re: CryptographicException: Unknown failure in Win98 only"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ] [ attachment ]