|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectgoldengate.common.crypto.KeyObject
public abstract class KeyObject
This class handles method to crypt and decrypt using the chosen algorithm.
Usage:
Constructor Summary | |
---|---|
KeyObject()
Empty constructor |
Method Summary | |
---|---|
byte[] |
crypt(byte[] plaintext)
Crypt one array of bytes and returns the crypted array of bytes |
byte[] |
crypt(String plaintext)
Crypt one String and returns the crypted array of bytes |
String |
cryptToHex(byte[] plaintext)
Crypt one array of bytes and returns the crypted String as HEX format |
String |
cryptToHex(String plaintext)
Crypt one String and returns the crypted String as HEX format |
byte[] |
decodeHex(String encoded)
|
byte[] |
decrypt(byte[] ciphertext)
Decrypt an array of bytes and returns the uncrypted array of bytes |
byte[] |
decryptHexFile(File file)
Decode from a file containing a HEX crypted string |
byte[] |
decryptHexInBytes(byte[] ciphertext)
Decrypt an array of bytes as HEX format representing a crypted array of bytes and returns the uncrypted array of bytes |
byte[] |
decryptHexInBytes(String ciphertext)
Decrypt a String as HEX format representing a crypted array of bytes and returns the uncrypted array of bytes |
String |
decryptHexInString(String ciphertext)
Decrypt a String as HEX format representing a crypted array of bytes and returns the uncrypted String |
String |
decryptInString(byte[] ciphertext)
Decrypt an array of bytes and returns the uncrypted String |
String |
encodeHex(byte[] bytes)
|
void |
generateKey()
Generate a key from nothing |
abstract String |
getAlgorithm()
|
abstract String |
getInstance()
|
abstract int |
getKeySize()
|
Key |
getSecretKey()
|
byte[] |
getSecretKeyInBytes()
Returns the key as an array of bytes in order to be stored somewhere else and retrieved using the setSecretKey(byte[] keyData) method. |
boolean |
keyReady()
|
void |
saveSecretKey(File file)
Save a Key to a File |
void |
setSecretKey(byte[] keyData)
Reconstruct a key from an array of bytes |
void |
setSecretKey(File file)
Create a Key from a File |
void |
setSecretKey(Key secretKey)
Set the secretKey |
Cipher |
toCrypt()
Returns a cipher for encryption associated with the key |
Cipher |
toDecrypt()
Returns a cipher for decryption associated with the key |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public KeyObject()
Method Detail |
---|
public abstract String getAlgorithm()
public abstract String getInstance()
public abstract int getKeySize()
public Key getSecretKey()
public boolean keyReady()
public byte[] getSecretKeyInBytes()
public void setSecretKey(Key secretKey)
secretKey
- public void setSecretKey(byte[] keyData)
public void setSecretKey(File file) throws CryptoException, IOException
file
-
CryptoException
IOException
public void saveSecretKey(File file) throws CryptoException, IOException
file
-
CryptoException
IOException
public void generateKey() throws Exception
Exception
public Cipher toCrypt()
public byte[] crypt(byte[] plaintext) throws Exception
plaintext
-
Exception
public String cryptToHex(byte[] plaintext) throws Exception
plaintext
-
Exception
public byte[] crypt(String plaintext) throws Exception
plaintext
-
Exception
public String cryptToHex(String plaintext) throws Exception
plaintext
-
Exception
public Cipher toDecrypt()
public byte[] decrypt(byte[] ciphertext) throws Exception
ciphertext
-
Exception
public String decryptInString(byte[] ciphertext) throws Exception
ciphertext
-
Exception
public byte[] decryptHexInBytes(String ciphertext) throws Exception
ciphertext
-
Exception
public byte[] decryptHexInBytes(byte[] ciphertext) throws Exception
ciphertext
-
Exception
public String decryptHexInString(String ciphertext) throws Exception
ciphertext
-
Exception
public byte[] decryptHexFile(File file) throws Exception
file
-
Exception
public byte[] decodeHex(String encoded)
encoded
-
public String encodeHex(byte[] bytes)
bytes
-
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |