public abstract class AbstractAesAdapter extends PropertyStorageAdapter
Modifier and Type | Field and Description |
---|---|
protected static byte[] |
EMPTY |
Constructor and Description |
---|
AbstractAesAdapter() |
Modifier and Type | Method and Description |
---|---|
protected byte[] |
cipher(byte[] iv,
byte[] input,
int mode) |
protected byte[] |
decrypt(byte[] data)
Unpacks the data to iv, ciphertext, mac, validates and decrypts.
|
protected byte[] |
encrypt(byte[] plainText)
Encrypts the provided plainText, and packs it with the iv and mac.
|
Object |
fromSpace(Object value)
Triggered when a property value arrives from the space and is about to be injected in the user's object.
|
protected byte[] |
generateInitializationVector(int length)
Generate initialization vector for encryption.
|
protected byte[] |
generateMac(byte[] cipherText,
byte[] iv) |
protected byte[] |
generateSubKey(byte[] rawKey,
int length,
byte[] salt,
byte[] subKey) |
protected SecretKey |
generateSubKey(String subKey,
int length,
String algorithm) |
String |
getName()
Returns a name used for display in monitoring tools.
|
protected Cipher |
getOrCreateCipher() |
protected Mac |
getOrCreateMac() |
protected byte[] |
getPassPhrase()
Returns the pass phrase which is used to generate the encryption key and mac key.
|
protected Random |
getSecureRandom() |
Class<?> |
getStorageClass()
Returns the class of the values which will be stored in the space.
|
protected String |
initEncryptionAlgorithm()
Provides the encryption algorithm.
|
protected int |
initEncryptionKeyLength()
Provides the encryption key length, in bytes.
|
protected abstract int |
initIvLengthBytes()
Provides the initialization vector length, in bytes.
|
protected String |
initMacAlgorithm() |
protected abstract boolean |
initMacEnabled() |
protected int |
initMacKeyLength() |
protected Random |
initSecureRandom() |
protected abstract String |
initTransformation()
Provides the cipher transformation string.
|
protected static byte[] |
readArrayRemaining(ByteBuffer byteBuffer) |
protected static byte[] |
readArrayWithByteLength(ByteBuffer byteBuffer) |
protected AlgorithmParameterSpec |
toParameterSpec(byte[] iv) |
Object |
toSpace(Object value)
Triggered when a property value is retrieved from the user's object and is about to be sent to the space.
|
protected static void |
writeArrayRemaining(ByteBuffer byteBuffer,
byte[] array) |
protected static void |
writeArrayWithByteLength(ByteBuffer byteBuffer,
byte[] array) |
base64Decode, base64Encode, deserialize, serialize, supportsEqualsMatching, supportsOrderedMatching, toBinaryWrapper, unwrapBinary, unzip, useBase64Wrapper, wrapBinary, zip
public String getName()
PropertyStorageAdapter
getName
in class PropertyStorageAdapter
public Class<?> getStorageClass()
PropertyStorageAdapter
getStorageClass
in class PropertyStorageAdapter
public Object toSpace(Object value) throws IOException
PropertyStorageAdapter
toSpace
in class PropertyStorageAdapter
value
- The original property valueIOException
- Thrown when processing the property value fails.public Object fromSpace(Object value) throws IOException, ClassNotFoundException
PropertyStorageAdapter
fromSpace
in class PropertyStorageAdapter
value
- The value which was stored in the spaceIOException
- Thrown when processing the property value fails.ClassNotFoundException
- Thrown when processing the property value fails due to a class loading issue.protected byte[] getPassPhrase() throws GeneralSecurityException
GeneralSecurityException
protected Random getSecureRandom()
protected Random initSecureRandom()
protected abstract String initTransformation()
protected abstract int initIvLengthBytes()
protected String initEncryptionAlgorithm()
protected int initEncryptionKeyLength()
protected byte[] encrypt(byte[] plainText) throws GeneralSecurityException
GeneralSecurityException
protected byte[] decrypt(byte[] data) throws GeneralSecurityException
GeneralSecurityException
protected byte[] generateInitializationVector(int length)
protected byte[] cipher(byte[] iv, byte[] input, int mode) throws GeneralSecurityException
GeneralSecurityException
protected Cipher getOrCreateCipher() throws GeneralSecurityException
GeneralSecurityException
protected AlgorithmParameterSpec toParameterSpec(byte[] iv)
protected abstract boolean initMacEnabled()
protected String initMacAlgorithm()
protected int initMacKeyLength()
protected byte[] generateMac(byte[] cipherText, byte[] iv) throws GeneralSecurityException
GeneralSecurityException
protected Mac getOrCreateMac() throws GeneralSecurityException
GeneralSecurityException
protected SecretKey generateSubKey(String subKey, int length, String algorithm) throws GeneralSecurityException
GeneralSecurityException
protected byte[] generateSubKey(byte[] rawKey, int length, byte[] salt, byte[] subKey) throws GeneralSecurityException
GeneralSecurityException
protected static void writeArrayWithByteLength(ByteBuffer byteBuffer, byte[] array)
protected static byte[] readArrayWithByteLength(ByteBuffer byteBuffer)
protected static void writeArrayRemaining(ByteBuffer byteBuffer, byte[] array)
protected static byte[] readArrayRemaining(ByteBuffer byteBuffer)
Copyright © GigaSpaces.