Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / .NET Framework / Security / November 2004

Tip: Looking for answers? Try searching our database.

CryptographicException: Unknown failure in Win98 only

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Scott - 15 Nov 2004 16:11 GMT
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)
 {
   .....
 }
}
Valery Pryamikov - 15 Nov 2004 18:06 GMT
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

>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
[quoted text clipped - 23 lines]
>  }
> }
Scott - 16 Nov 2004 23:20 GMT
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.

> Hi,
> I'm not sure if there is strong cryptography pack for Windows 98 (it was
[quoted text clipped - 33 lines]
> >  }
> > }
Scott - 17 Nov 2004 14:24 GMT
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.

> Thanks for the response Valery,
> I am running IE v6.0.2800.1106 on Win98 and my understanding is this already
[quoted text clipped - 49 lines]
> > >  }
> > > }
Anna - 25 Nov 2004 16:52 GMT
Hi Scott!

I have the same problem and the same error on win98.
I use the RSACryptoServiceProvider with the 1024 byte key.
Have you found already any solution?
Could you please help me?

best regards,
Anna

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.