Package org.ondc
Class EncryptionUtil
java.lang.Object
org.ondc.EncryptionUtil
Utility class for encrypting and decrypting payload.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classThe POJO class for Encrypted Data. -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intThe standard authentication tag length (128 bits).static final intThe standard Initialization Vector (IV) length (96 bits). -
Method Summary
Modifier and TypeMethodDescriptionstatic StringdecryptData(String key, String eData) Decrypts the Encrypted Data using Shared Key.static StringencryptData(String key, String data) Encrypts the specified plain text using AES/GCM/NoPadding.
-
Field Details
-
IV_BIT_LENGTH
public static final int IV_BIT_LENGTHThe standard Initialization Vector (IV) length (96 bits).- See Also:
-
AUTH_TAG_BIT_LENGTH
public static final int AUTH_TAG_BIT_LENGTHThe standard authentication tag length (128 bits).- See Also:
-
-
Method Details
-
encryptData
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
Decrypts the Encrypted Data using Shared Key.- Parameters:
key- The Shared Key.eData- The Encrypted Data.- Returns:
- The Raw Decrypted data.
-