Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP .Net Security > CryptographicException: Bad Data - when storing public key only in key store on encrypting machine

Reply
Thread Tools

CryptographicException: Bad Data - when storing public key only in key store on encrypting machine

 
 
pmkatz
Guest
Posts: n/a
 
      08-25-2004
I am working on a system in which a web server will contain the Public
Key from an RSA Key Pair and it will be stored in a key store (in
machine keys). This key will be used to encrypt data.

A second machine that is in another location will have the public and
private key stored in a key store (also in machine keys). This key
will be used to decrypt data that was encrypted on the web server.

The problem that I am having is that if both the public and private
keys are not stored on the web server (in the key store at the time the
data is encrypted) then the second machine is unable to decrypt the
data and instead the following message is returned:

Exception Type: System.Security.Cryptography.CryptographicExceptio n
Message: Bad Data.

However, if the web server has the complete pair in it's key store,
everything works as expected.

The following scenario shows the same behavior but it can be performed
on a single machine. Can anyone explain why?

1. Generate a key pair using the RSACryptoServiceProvider
2. Persist the key pair to an xml file (using ToXMLStringMethod)
3. Persist the public key only to an xml file (also using
ToXMLStringMethod)
4. Load the Public Key only into a key store (I'm using machine keys
store)
5. Encrypt some data (using key in new key store) and record the output
6. Delete the key store created in step 4.
7. Load the Key Pair (public and private) into a key store
9. Decrypt the output created in step 5 with key found in store created
in step 7 and notice that an error message occurs:

Exception Type: System.Security.Cryptography.CryptographicExceptio n
Message: Bad Data.

Any insight would be much appreciated. Thanks!

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
microsoft.public.certification, microsoft.public.cert.exam.mcsa, microsoft.public.cert.exam.mcad, microsoft.public.cert.exam.mcse, microsoft.public.cert.exam.mcsd loyola MCSE 4 11-15-2006 02:40 AM
microsoft.public.certification, microsoft.public.cert.exam.mcsa, microsoft.public.cert.exam.mcad, microsoft.public.cert.exam.mcse, microsoft.public.cert.exam.mcsd loyola Microsoft Certification 3 11-14-2006 05:18 PM
microsoft.public.certification, microsoft.public.cert.exam.mcsa, microsoft.public.cert.exam.mcad, microsoft.public.cert.exam.mcse, microsoft.public.cert.exam.mcsd loyola MCSD 3 11-14-2006 05:18 PM
microsoft.public.certification, microsoft.public.cert.exam.mcsa, microsoft.public.cert.exam.mcad, microsoft.public.cert.exam.mcse, microsoft.public.cert.exam.mcsd realexxams@yahoo.com Microsoft Certification 0 05-10-2006 02:35 PM
microsoft.public.dotnet.faqs,microsoft.public.dotnet.framework,microsoft.public.dotnet.framework.windowsforms,microsoft.public.dotnet.general,microsoft.public.dotnet.languages.vb Charles A. Lackman ASP .Net 1 12-08-2004 07:08 PM



Advertisments