Class EncryptionUtils

java.lang.Object
org.gridgain.internal.encryption.utils.EncryptionUtils

public final class EncryptionUtils extends Object
Encryption of data encryption key based on JDK-provided cipher algorithm implementations.
  • Method Summary

    Modifier and Type
    Method
    Description
    static void
    clear(byte @Nullable [] array)
    Clears the internal copy of the array.
    static void
    clear(char @Nullable [] array)
    Clears the internal copy of the array.
    static void
    decrypt(Cipher cipher, ByteBuffer srcBuf, ByteBuffer destBuf, Key key)
    Decrypts data with decryption key.
    static org.gridgain.internal.encryption.provider.DataEncryptionKey
    decryptKey(byte[] encDataKey, Key key, String cipherAlgorithm)
    Decrypts data encryption key with key encryption key.
    static void
    encrypt(Cipher cipher, Random rnd, ByteBuffer srcBuf, ByteBuffer res, Key key)
    Encrypts data with key.
    static int
    encryptedSize(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 int
    roundToBlockSize(Cipher cipher, int value)
    Returns the next larger positive multiple of block size for the given value.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Method Details

    • encrypt

      public static void encrypt(Cipher cipher, Random rnd, ByteBuffer srcBuf, ByteBuffer res, Key key)
      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

      public static void decrypt(Cipher cipher, ByteBuffer srcBuf, ByteBuffer destBuf, Key key)
      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

      public static int encryptedSize(Cipher cipher, int plainDataSize)
      Returns data size with encryption overhead.
      Parameters:
      cipher - Encryption algorithm
      plainDataSize - Plain data size.
      Returns:
      Encrypted data size.
    • roundToBlockSize

      public static int roundToBlockSize(Cipher cipher, int value)
      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.