Package org.ondc

Class EncryptionUtil

java.lang.Object
org.ondc.EncryptionUtil

public class EncryptionUtil extends Object
Utility class for encrypting and decrypting payload.
  • Field Details

    • IV_BIT_LENGTH

      public static final int IV_BIT_LENGTH
      The standard Initialization Vector (IV) length (96 bits).
      See Also:
    • AUTH_TAG_BIT_LENGTH

      public static final int AUTH_TAG_BIT_LENGTH
      The standard authentication tag length (128 bits).
      See Also:
  • Method Details

    • encryptData

      public static String encryptData(String key, String data)
      Encrypts the specified plain text using AES/GCM/NoPadding.
      Parameters:
      key - The Shared Key.
      data - The Raw Data to be Encrypted.
      Returns:
      The Encrypted data in base64 encoded format.
    • decryptData

      public static String decryptData(String key, String eData)
      Decrypts the Encrypted Data using Shared Key.
      Parameters:
      key - The Shared Key.
      eData - The Encrypted Data.
      Returns:
      The Raw Decrypted data.