Class EncryptionUtils
java.lang.Object
org.gridgain.internal.encryption.utils.EncryptionUtils
Encryption of data encryption key based on JDK-provided cipher algorithm implementations.
-
Method Summary
Modifier and TypeMethodDescriptionstatic voidclear(byte @Nullable [] array) Clears the internal copy of the array.static voidclear(char @Nullable [] array) Clears the internal copy of the array.static voiddecrypt(Cipher cipher, ByteBuffer srcBuf, ByteBuffer destBuf, Key key) Decrypts data with decryption key.static org.gridgain.internal.encryption.provider.DataEncryptionKeydecryptKey(byte[] encDataKey, Key key, String cipherAlgorithm) Decrypts data encryption key with key encryption key.static voidencrypt(Cipher cipher, Random rnd, ByteBuffer srcBuf, ByteBuffer res, Key key) Encrypts data with key.static intencryptedSize(Cipher cipher, int plainDataSize) Returns data size with encryption overhead.static byte[]encryptKey(Random rnd, org.gridgain.internal.encryption.provider.DataEncryptionKey dataKey, Key key, String cipherAlgorithm) Encrypts data encryption key with key encryption key.static introundToBlockSize(Cipher cipher, int value) Returns the next larger positive multiple of block size for the given value.
-
Method Details
-
encrypt
Encrypts data with key.- Parameters:
cipher- Cipher.rnd- Random generator.srcBuf- Source buffer.res- Destination buffer where IV is entered first, followed by encrypted data.key- Key for encryption.
-
encryptKey
public static byte[] encryptKey(Random rnd, org.gridgain.internal.encryption.provider.DataEncryptionKey dataKey, Key key, String cipherAlgorithm) Encrypts data encryption key with key encryption key.- Parameters:
dataKey- Data encryption key.key- Key encryption key.- Returns:
- Encrypted data encryption key.
-
decryptKey
public static org.gridgain.internal.encryption.provider.DataEncryptionKey decryptKey(byte[] encDataKey, Key key, String cipherAlgorithm) Decrypts data encryption key with key encryption key.- Parameters:
encDataKey- Encrypted data encryption key.key- Key encryption key.- Returns:
- Data encryption key.
-
decrypt
Decrypts data with decryption key.- Parameters:
cipher- Cipher.srcBuf- Source buffer where IV is entered first, followed by encrypted data.destBuf- Destination buffer.key- key for decryption.
-
clear
public static void clear(byte @Nullable [] array) Clears the internal copy of the array.- Parameters:
array- The array.
-
clear
public static void clear(char @Nullable [] array) Clears the internal copy of the array.- Parameters:
array- The array.
-
encryptedSize
Returns data size with encryption overhead.- Parameters:
cipher- Encryption algorithmplainDataSize- Plain data size.- Returns:
- Encrypted data size.
-
roundToBlockSize
Returns the next larger positive multiple of block size for the given value.- Parameters:
cipher- Encryption algorithm.value- From which next value multiple of block size will be found.- Returns:
- The next larger positive multiple of block size.
-