org.polyglotted.crypto.asymmetric
Class RsaDecrypter

java.lang.Object
  extended by org.polyglotted.crypto.api.AbstractCrypto
      extended by org.polyglotted.crypto.asymmetric.RsaDecrypter
All Implemented Interfaces:
Crypto

public class RsaDecrypter
extends AbstractCrypto

RsaDecrypter uses RSA algorithm of Asymmetric key cryptography to convert unreadable cipher text into plain text.

Author:
Shankar Vasudevan

Nested Class Summary
 
Nested classes/interfaces inherited from class org.polyglotted.crypto.api.AbstractCrypto
AbstractCrypto.Mode
 
Field Summary
 
Fields inherited from class org.polyglotted.crypto.api.AbstractCrypto
cipher
 
Fields inherited from interface org.polyglotted.crypto.api.Crypto
AES_ALGORITHM, RSA_ALGORITHM
 
Constructor Summary
RsaDecrypter(PrivateKey key)
          Create a new RsaDecrypter
 
Method Summary
 String crypt(String text)
          Perform encrypt or decrypt action
static String decrypt(InputStream privKeyIs, String cipherText)
          Decrypt the given text with a private key
static void decryptFile(InputStream privKeyIs, InputStream input, OutputStream output)
          Decrypt the incoming file and copy the resulting data into the output stream.
static void decryptPropertyFile(InputStream privKeyIs, InputStream propertyIs, OutputStream output, String prefix)
          Decrypt the incoming property file and copy the resulting data into the output stream.
 AbstractCrypto.Mode getMode()
           
 
Methods inherited from class org.polyglotted.crypto.api.AbstractCrypto
crypt, encrypt, getAlgorithm, getCipher, getHeaderLine, handlePropertyFirstLine
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

RsaDecrypter

public RsaDecrypter(PrivateKey key)
Create a new RsaDecrypter

Parameters:
key - the PrivateKey for the decryption
Method Detail

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

decrypt

public static String decrypt(InputStream privKeyIs,
                             String cipherText)
Decrypt the given text with a private key

Parameters:
privKeyIs - the private key input stream
input - the cipher data to be decryted
Returns:
the String containing plain text

decryptFile

public static void decryptFile(InputStream privKeyIs,
                               InputStream input,
                               OutputStream output)
Decrypt the incoming file and copy the resulting data into the output stream.

Parameters:
privKeyIs - the private key input stream
input - the file input stream
output - the output stream to write the decrypted values

decryptPropertyFile

public static void decryptPropertyFile(InputStream privKeyIs,
                                       InputStream propertyIs,
                                       OutputStream output,
                                       String prefix)
Decrypt the incoming property file and copy the resulting data into the output stream.

Parameters:
privKeyIs - the private key input stream
propertyIs - the property file input stream
output - the output stream to write the decrypted values
prefix - the String prefix for lines which have to be decryted


Copyright © 2012-2013 Polyglotted Org. All Rights Reserved.