org.polyglotted.crypto.api
Class AbstractCrypto
java.lang.Object
org.polyglotted.crypto.api.AbstractCrypto
- All Implemented Interfaces:
- Crypto
- Direct Known Subclasses:
- AesDecrypter, AesEncrypter, RsaDecrypter, RsaEncrypter
public abstract class AbstractCrypto
- extends Object
- implements Crypto
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Methods inherited from interface org.polyglotted.crypto.api.Crypto |
crypt |
cipher
protected final Cipher cipher
AbstractCrypto
public AbstractCrypto(Cipher cipher)
getCipher
public Cipher getCipher()
- Specified by:
getCipher in interface Crypto
- Returns:
- the cipher that is used by this crypto
getAlgorithm
public String getAlgorithm()
- Specified by:
getAlgorithm in interface Crypto
- Returns:
- the algorithm that is used by this crypto
handlePropertyFirstLine
public boolean handlePropertyFirstLine(String firstLine,
PrintWriter writer)
getHeaderLine
protected String getHeaderLine()
encrypt
protected byte[] encrypt(String text)
- encrypt the given text
- Parameters:
text - the String representing plain text
- Returns:
- byte[] representing cipher value
crypt
public final byte[] crypt(byte[] cipherText)
- crypt the given text
- Specified by:
crypt in interface Crypto
- Parameters:
cipherText - the byte[] cipher value
- Returns:
- byte[] representing plain text
getMode
public abstract AbstractCrypto.Mode getMode()
- Returns:
- if this crypto performs an encrypt or decrypt operation
Copyright © 2012-2013 Polyglotted Org. All Rights Reserved.