RSA Public Key RRS feed

  • Question

  • Hi to everyone,


              I had created a sample program in java for RSA encryption and decryption.  I had saved the public and private key in a file.  I want to use this key in vc++.  How do this?


              Is there any build in class available or any other open source API or any way to do this (Without using JNI or .Net)?

    • Edited by MIB BALA Thursday, August 4, 2011 1:53 PM Extra details
    • Moved by Rob Pan Wednesday, August 24, 2011 9:52 AM (From:Visual C++ General)
    Thursday, August 4, 2011 1:51 PM

All replies

  • You may be able to use some of the Windows Cryptography API to do what you want, but having never needed that myself I don't know for sure
    Thursday, August 4, 2011 2:50 PM
  • Thanks for the reply..  I had read that.   I need to use the same key that was created in java application...
    Friday, August 5, 2011 10:22 AM
  • What format is the key saved in? .p12?

    Answering policy: see profile.
    Friday, August 5, 2011 11:01 AM
  • The key is public key.
    Saturday, August 6, 2011 2:05 PM
  • That doesn't answer the question.  Please show the code you used to save the key, including the relevant libraries.
    Answering policy: see profile.
    Saturday, August 6, 2011 4:41 PM
  • Thanks...

    Now i'm using Windows cryptography API,  When i'm trying to use the ImportKey function, it returns any one of the following error codes:

      80090007(Bad version), 80090005 (Bad Data).

    When i surf through the net, i find that i have to give the key in some specify format. That format is PUBLIC KEY BLOB format.


    I don't know how to convert the plaintext key to this format.


    Please help in this.

    Sunday, August 7, 2011 3:03 PM
  • I'm trying to help, but until you have answered the questions I have asked about the format your public key is stored in, anything I can offer would be guessing.
    Answering policy: see profile.
    Sunday, August 7, 2011 5:42 PM
  • Hi,


    It seems that your thread is about Security for pplication, So I will move it to the correct forum for better support. Thanks for your understanding.


    Best Regards,


    Rob Pan [MSFT]
    MSDN Community Support | Feedback to us
    Get or Request Code Sample from Microsoft
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    Wednesday, August 24, 2011 9:52 AM