To use the code, you need corresponding public and private RSA keys. RSA keys can be generated using the open source tool OpenSSL. However, you have to be careful to generate them in the format required by the Java encryption libraries. To generate a private key of length 2048 bits: openssl genrsa -out private.pem 2048.
- Java Applet To Generate Rsa Keys And Encrypt Decrypt Free
- Java Applet To Generate Rsa Keys And Encrypt Decrypt Mac
- Java Applet To Generate Rsa Keys And Encrypt Decryption
My Java implementation of RSA encryption.
Package com.ricardosequeira.security; import java.io.BufferedReader; import java.io.FileReader; import java.io.IOException; import java.io.UnsupportedEncodingException; import java.security.GeneralSecurityException; import java.security.InvalidKeyException; import java.security.KeyFactory; import java.security.NoSuchAlgorithmException; import. Package com.ricardosequeira.security; import java.io.BufferedReader; import java.io.FileReader; import java.io.IOException; import java.io.UnsupportedEncodingException; import java.security.GeneralSecurityException; import java.security.InvalidKeyException; import java.security.KeyFactory; import java.security.NoSuchAlgorithmException; import java.security.PrivateKey; import java. Different passphrases will generate different keys. The generated key can be distributed to the public for use in encryption, and the original passphrase is to be kept secret as the only way to perform decryption. NOTE: This applet uses its own method of generating and displaying keys and messages.
Introduction
This program aims to provide the means to encrypt and decrypt filesusing the RSA algorithm.
How to Use
- Create an instance of
RSAKeyGenerator
. - Call it's
makeKey()
method, passing in a constant to specify which kind of key should be returned.RSAKey.PUBLIC_KEY
for encryptingRSAKey.PRIVATE_KEY
for decryptingRSAKey.COMPLETE_KEY
for efficient decryption using the Chinese Remainder Theorum
- Cast the
RSAKey
returned to the appropriate type ofRSAKey
.RSAPublicKey
RSAPrivateKey
RSACompleteKey
- Call the key's
use()
method, passing in the source and destination file paths.- the key will perform it's operation on the file specified by
source
- the key will write the result of it's operation to the file specified by
destination
- the key will perform it's operation on the file specified by
Additionally,
RSATest
now contains a main method for testing. Useage is as follows:java com.rhg.rsa.RSATest plaintext destination
where
plaintext
is the path to a readable file, and destination
is the prefix to use for storage of files created during the tests.Version History
2013/8/27
- Fixed and tested the code
- Now contains test class
RSATest
2012/12/01
- Commited the project to GitHub unchanged.
- I don't know if it works. It may not be the last version I had, as I'mnot even sure when I gave this copy to my friend, as it was almost 2 yearsago now.
Java Applet To Generate Rsa Keys And Encrypt Decrypt Free
2010/05/31
- Stoped working on the project.
Java Applet To Generate Rsa Keys And Encrypt Decrypt Mac
Author
Java Applet To Generate Rsa Keys And Encrypt Decryption
- Robert Grant