Tuesday, March 27, 2012

RSA demo / example

This is the implementation of RSA tutorial given at http://www.javamex.com/tutorials/cryptography/rsa_encryption.shtml with little bit of additions so you can use it right out of the box.

CLASS:  RSAKeyGenerator
Method: void generateKeyPair("<public key file name>","<private key file name>")

CLASS: RSAEncDec
Method: String encrypt("your plane string message", "<location of public key file>")
              [Returns the base64 encoded string that you can send easily]

Method: String decrtpt("<above base64 encoded string>", "<location of private key file>")
              [Returns original plane string message]

For details see "readme.txt" and main() methods avaliable in each class
Download project at : https://github.com/meamit/rsa-demo

4 comments:

  1. how to add ur code in my application? its didnot create any files

    ReplyDelete
  2. in which location public privite keys create?

    ReplyDelete
    Replies
    1. depends on how you are running,, those file are created in the locaiton from where the program is executed. If you are running it in eclipse then it the same directory as the project directory (where u have .project file)

      Delete
  3. This comment has been removed by the author.

    ReplyDelete