public class RsaCipher extends AbstractPluginAdapter implements TextEncrypter
PUBLIC_KEY or one that is custom defined looked for on the
classpath. The public/private keypair can be easily generated with
RsaKeyGenerator.generateKeyPair(boolean, int, java.io.File, java.io.File).SwingWorker.StateValue| Modifier and Type | Field and Description |
|---|---|
static String |
PUBLIC_KEY
Public key resource name and path this cipher needs for encryption.
|
configuration| Constructor and Description |
|---|
RsaCipher()
Constructs instance backed by
PUBLIC_KEY. |
RsaCipher(String publicKeyResourcePath)
Constructs an instance backed by user defined resource representing
a valid public key.
|
| Modifier and Type | Method and Description |
|---|---|
String |
decrypt(String cipherText,
PrivateKey privateKey) |
String |
decrypt(String cipherText,
String privateKeyResourcePath) |
String |
encrypt(String text)
Encrypts single string of text with the implementation specific
algorithm.
|
doInBackgroundinitializeaddPropertyChangeListener, cancel, done, execute, firePropertyChange, get, get, getProgress, getPropertyChangeSupport, getState, isCancelled, isDone, process, publish, removePropertyChangeListener, run, setProgressclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitinitializepublic static final String PUBLIC_KEY
public RsaCipher()
throws IOException
PUBLIC_KEY. Exception is thrown
if that file is not found.IOException - if public key file is not on classpathpublic RsaCipher(String publicKeyResourcePath) throws IOException
publicKeyResourcePath - IOExceptionpublic String encrypt(String text)
TextEncrypterencrypt in interface TextEncryptertext - value to be encryptedpublic String decrypt(String cipherText, PrivateKey privateKey)
public String decrypt(String cipherText, String privateKeyResourcePath) throws IOException
IOExceptionCopyright © 2012-2013 Bambi Software Foundation. All Rights Reserved.