|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object ch.elca.el4j.services.security.encryption.RSACipher
public class RSACipher
Lightweight support for basic asymmetric encryption (RSA algorithm).
Adapted from RSA.java, an RSA Encryption Implementation. Copyright (C) 2003 Eugene Luzgin, eugene@luzgin.com
Constructor Summary | |
---|---|
RSACipher(int keyLength)
Creates a new cipher for encryption and decryption. |
|
RSACipher(String publicKey)
Creates a new cipher for encryption and decryption. |
Method Summary | |
---|---|
String |
decrypt(String encryptedMessage)
Decripts a given message, by using the private key of this cipher. |
String |
encrypt(String text)
Encrypts a given text, by using the public key of the cipher. |
String |
getPublicKey()
Returns the public key of this cipher. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public RSACipher(int keyLength)
keyLength
- The length of the key. That the algorithm does not work with all values, typical key lengths are 512,
1024, 2048, 3072 and 4096. Note that longer keys are more secure but also slower (several minutes).
Keys of length < 1024 are considered unsecure, 1024 is the minimum but still not perfectly secure.public RSACipher(String publicKey)
publicKey
- The public key of the key pair.Method Detail |
---|
public String getPublicKey()
public String encrypt(String text)
text
- The string to encrypt.
public String decrypt(String encryptedMessage)
encryptedMessage
- The message to decrypt.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |