org.polyglotted.crypto.symmetric
Class AesDecrypter

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

public class AesDecrypter
extends AbstractCrypto


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
AesDecrypter(String passPhrase)
          Create a new AesDecrypter.
AesDecrypter(String passPhrase, byte[] iv)
          Create a new AesDecrypter
 
Method Summary
 String crypt(String cipherText)
          Perform encrypt or decrypt action
static String decrypt(String passPhrase, String cipherText)
          Decrypt the given text with a private key
static void decryptPropertyFile(String passPhrase, 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

AesDecrypter

public AesDecrypter(String passPhrase)
Create a new AesDecrypter. This method does not initialize the cipher and cannot be used for encrypting without initializing it first

Parameters:
passPhrase - the Passphrase for the secret key

AesDecrypter

public AesDecrypter(String passPhrase,
                    byte[] iv)
Create a new AesDecrypter

Parameters:
passPhrase - the Passphrase for the secret key
salt - the salt for the secret key
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 cipherText)
Description copied from interface: Crypto
Perform encrypt or decrypt action

Parameters:
cipherText - the String to crypt
Returns:
the result String

decrypt

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

Parameters:
passPhrase - the password to decrypt with
input - the cipher data to be decryted
Returns:
the String containing plain text

decryptPropertyFile

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

Parameters:
passPhrase - the password to decrypt with
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.