org.polyglotted.crypto.symmetric
Class AesEncrypter

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

public class AesEncrypter
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
AesEncrypter(String passPhrase)
          Create a new AesEncrypter
 
Method Summary
 String crypt(String text)
          Perform encrypt or decrypt action
static String encrypt(String passPhrase, String text)
          Utility method to encrypt any password protected data
static void encryptPropertyFile(String passPhrase, InputStream propertyIs, OutputStream output, String prefix)
          Encrypt 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

AesEncrypter

public AesEncrypter(String passPhrase)
Create a new AesEncrypter

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 text)
Description copied from interface: Crypto
Perform encrypt or decrypt action

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

encrypt

public static String encrypt(String passPhrase,
                             String text)
Utility method to encrypt any password protected data

Parameters:
passPhrase - the password to encrypt with
text - the text to be encrypted
Returns:
the encrypted String

encryptPropertyFile

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

Parameters:
passPhrase - the password to encrypt with
propertyIs - the property file input stream
output - the output stream to write the encrypted values
prefix - the String prefix for lines which have to be encrypted


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