Ask a Question related to ASP.NET Security, Design and Development.
-
pmkatz #1
CryptographicException: Bad Data - when storing public key only in key store on encrypting machine
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!
pmkatz Guest
-
Bad Data CryptographicException when RSA decrypting
Hi you try with this sample. I am not sure where the problem in your code. But you always yous UnicodeEncoding class. Here the working... -
CryptographicException - Bad Data when changing from SSL to no secure connection
Hi, in a asp-vb.net web application, i have a login page. when i use the login page with http:// url, everything is fine, authentication works.... -
Importing an XML file containing rsaparameters into a machine store.
I used the RSA provider to generate a keypair. I would like to stop using XML files with the keys and import the existing private key on 2... -
CryptographicException: Bad Data
Hi. Okay. From this one site A, a user login then using a frame to go to site B. Then I get ... -
Storing connection string in machine.config
How to store connection strings in machine.config?What are the advantages of storing it in the machine.config file.Can u provide me with the...



Reply With Quote

