org.polyglotted.crypto.asymmetric
Class RsaEncrypter
java.lang.Object
org.polyglotted.crypto.api.AbstractCrypto
org.polyglotted.crypto.asymmetric.RsaEncrypter
- All Implemented Interfaces:
- Crypto
public class RsaEncrypter
- extends AbstractCrypto
RsaEncrypter uses RSA algorithm of Asymmetric key cryptography to convert plain text into unreadable cipher text.
- Author:
- Shankar Vasudevan
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
RsaEncrypter
public RsaEncrypter(PublicKey key)
- Create a new RsaEncrypter
- Parameters:
key - the PublicKey for the encryption
getMode
public AbstractCrypto.Mode getMode()
- Specified by:
getMode in class AbstractCrypto
- Returns:
- if this crypto performs an encrypt or decrypt operation
crypt
public String crypt(String text)
- Description copied from interface:
Crypto
- Perform encrypt or decrypt action
- Parameters:
text - the String to crypt
- Returns:
- the result String
setBase64Options
public void setBase64Options(int options)
- Parameters:
options - the Base64Options for encoding
encrypt
public static String encrypt(InputStream pubKeyIs,
String input)
- Encrypt the given text with a public key
- Parameters:
pubKeyIs - the public key input streaminput - the input data
- Returns:
- the encrypted cipher value
encryptFile
public static void encryptFile(InputStream pubKeyIs,
InputStream input,
OutputStream output)
- Encrypt the incoming property file and copy the resulting data into the output stream.
- Parameters:
pubKeyIs - the public key input streaminput - the file input streamoutput - the output stream to write the encrypted values
encryptPropertyFile
public static void encryptPropertyFile(InputStream pubKeyIs,
InputStream propertyIs,
OutputStream output,
String prefix)
- Encrypt the incoming property file and copy the resulting data into the output stream.
- Parameters:
pubKeyIs - the public key input streampropertyIs - the property file input streamoutput - the output stream to write the encrypted valuesprefix - the String prefix for lines which have to be encrypted
Copyright © 2012-2013 Polyglotted Org. All Rights Reserved.