|
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectes.rediris.crypt.RSATool
public class RSATool
RSATool is a helper class for encrypting/decrypting messages using RSA algorithm in ECB mode.
Also, it uses PKCS1 padding when makes its operations with messages.
Keys are in PEM (PKCS#8) format, so you need to include the Bouncy Castle Library.
Constructor Summary | |
---|---|
RSATool()
Generate an RSATool object, adding the Bouncy Castle Provider |
Method Summary | |
---|---|
String |
decode(String data)
|
String |
encode(String data)
Encrypt a message using the private key |
Key |
getRsaPrivateKey()
Get the private key, which has should been previously read |
PublicKey |
getRsaPublicKey()
Get the public key, which has should been previously read |
void |
readRsaPrivateKeyPEM(String filename)
Read a private key file in PEM PKCS 8 format. |
void |
readRsaPublicKeyPEM(String filename)
Read a public key file in PEM PKCS 8 format. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public RSATool()
Method Detail |
---|
public Key getRsaPrivateKey()
public void readRsaPrivateKeyPEM(String filename) throws IOException
-----BEGIN RSA PRIVATE KEY----- ... -----END RSA PRIVATE KEY-----
filename
- The name of the file
IOException
public PublicKey getRsaPublicKey()
public void readRsaPublicKeyPEM(String filename) throws IOException
-----BEGIN PUBLIC KEY----- ... -----END PUBLIC KEY-----
filename
- The name of the file
IOException
public String encode(String data)
data
- The message you want to encrypt
public String decode(String data)
|
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |