locked
RSA Private key encryption RRS feed

  • Question

  • Hello,

    I'm looking to use RSA Asymmetric encryption to encrypt some data. I've read this article on the forums with a similar title, but it did not answer my question.

    What I would like to do is use the private key of an RSA key combination to encrypt (sign?) the data and use the public key to decrypt (verify?), as per this wikipedia article . I would like to use this method because I want people to be able to read the data, but not create it themselves.

    I've copied the code from Peter Bromberg's article RSA Encryption in .NET Demystified , but always get an exception with the "Bad Key" message. If I use the public key for decryption, it works fine (the opposite of what I want).

    It is out of the question to use the public key for encryption.

    Does anyone have any experience with this in .NET, or know of another encryption method where .NET will allow me to specify the key to use?
    Mods - Please do not mark my posts as answered. It is extremely rude. You have no idea if you've answered my question.
    Monday, August 10, 2009 12:57 PM

Answers

  • I looked at this, but it doesn't really fit my requirements. I downloaded an open-source third party DLL that follows actual RSA implementation instead. It can be found here
    Mods - Please do not mark my posts as answered. It is extremely rude. You have no idea if you've answered my question.
    • Marked as answer by BLeg Monday, August 10, 2009 6:54 PM
    Monday, August 10, 2009 6:20 PM

All replies

  • It sounds like what you really want to do is sign the data. You may be able to do this yourself but it's probably easier and more secure to use the signing tools built into the crypto classes. See this article:

        http://msdn.microsoft.com/en-us/library/hk8wx38z.aspx

    Rod

    Rod Stephens, Visual Basic MVP

    Beginning Database Design Solutions
    http://www.amazon.com/exec/obidos/ASIN/0470385499/vbhelper/

    Visual Basic 2008 Programmer's Reference
    http://www.amazon.com/exec/obidos/ASIN/0470182628/vbhelper/
    Monday, August 10, 2009 1:39 PM
  • I looked at this, but it doesn't really fit my requirements. I downloaded an open-source third party DLL that follows actual RSA implementation instead. It can be found here
    Mods - Please do not mark my posts as answered. It is extremely rude. You have no idea if you've answered my question.
    • Marked as answer by BLeg Monday, August 10, 2009 6:54 PM
    Monday, August 10, 2009 6:20 PM