public class EncryptionKey extends java.lang.Object implements ISecretKey
Constructor and Description |
---|
EncryptionKey()
Creates an uninitialized key.
|
EncryptionKey(byte[] key) |
Modifier and Type | Method and Description |
---|---|
static EncryptionKey |
generateNewKey() |
static EncryptionKey |
generateNewKey(int keyLengthInBytes) |
javax.crypto.spec.SecretKeySpec |
getJCESecretKeySpec() |
byte[] |
getKeyCloneInBytes()
Returns a new copy of the key
|
byte[] |
getKeyInBytes() |
EncryptionKey |
readFromBase64(java.lang.String base64) |
EncryptionKey |
readFromFile(java.io.File file) |
EncryptionKey |
readFromFile(java.lang.String file) |
EncryptionKey |
readFromHex(java.lang.String hex) |
EncryptionKey |
readFromJsonObject(morg.json.JSONObject json) |
EncryptionKey |
readFromJsonString(java.lang.String json) |
EncryptionKey |
readFromStream(java.io.InputStream in) |
void |
wipe()
Wipes the key (bytes) in this object - meaning overwrites it with arbitrary data.
|
java.lang.String |
writeToBase64() |
byte[] |
writeToBytes()
Returns a new copy of the key
|
void |
writeToFile(java.io.File file) |
void |
writeToFile(java.lang.String file) |
java.lang.String |
writeToHex() |
morg.json.JSONObject |
writeToJsonObject() |
java.lang.String |
writeToJsonString() |
void |
writeToStream(java.io.OutputStream out) |
public EncryptionKey(byte[] key)
public EncryptionKey()
public byte[] getKeyInBytes()
getKeyInBytes
in interface ISecretKey
public byte[] getKeyCloneInBytes()
public byte[] writeToBytes()
public java.lang.String writeToBase64()
public java.lang.String writeToHex()
public java.lang.String writeToJsonString()
public morg.json.JSONObject writeToJsonObject()
public void writeToStream(java.io.OutputStream out)
public void writeToFile(java.lang.String file)
public void writeToFile(java.io.File file)
public EncryptionKey readFromBase64(java.lang.String base64)
public EncryptionKey readFromHex(java.lang.String hex)
public EncryptionKey readFromJsonString(java.lang.String json)
public EncryptionKey readFromJsonObject(morg.json.JSONObject json)
public EncryptionKey readFromStream(java.io.InputStream in)
public EncryptionKey readFromFile(java.lang.String file)
public EncryptionKey readFromFile(java.io.File file)
public javax.crypto.spec.SecretKeySpec getJCESecretKeySpec()
public void wipe()
wipe
in interface ISecretKey
public static final EncryptionKey generateNewKey()
public static final EncryptionKey generateNewKey(int keyLengthInBytes)