Package com.avoka.fc.core.util
Class FormXmlCrypto
java.lang.Object
com.avoka.fc.core.util.FormXmlCrypto
Provides form XML data encryption and decryption functions.
- Since:
- 5.0
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic class
Provides a crypto exception. -
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic String
Decrypt and uncompress form xml data from client pipeline: client submission data base64 string -> get byte array data from Base64 string -> slice to Request key (32 bytes) + AES key (16 bytes) + encrypted Data (AES) -> decrypt data (byte[]) using AES key and last 16 bytes of request key being IV -> uncompress data using zlib (String)static String
Convert form xml data to a compressed encrypted string based on AES-CBC 128 bit.static String
getRequestKeyFromClientEncryptedCompressedData
(String formBase64Data) Return the TM RequestKey for the given base64 encoded form XML data.
-
Constructor Details
-
FormXmlCrypto
public FormXmlCrypto()
-
-
Method Details
-
encrypt
Convert form xml data to a compressed encrypted string based on AES-CBC 128 bit. pipeline: original form data (byte[]) -> compressed data (byte[] using zlib) -> AES encrypted data (using generated AES key and last 16 bytes of request key to be IV) -> combined data: (byte[]) request key (32 bytes) + AES key (16 bytes) + AES encrypted Data -> Base64 String of combined data- Parameters:
xmlData
- the byte array of form data (required)requestKey
- the TM request key (required)- Returns:
- a String with the compressed encrypted data in base64 format
-
decrypt
Decrypt and uncompress form xml data from client pipeline: client submission data base64 string -> get byte array data from Base64 string -> slice to Request key (32 bytes) + AES key (16 bytes) + encrypted Data (AES) -> decrypt data (byte[]) using AES key and last 16 bytes of request key being IV -> uncompress data using zlib (String)- Parameters:
formBase64Data
- the encrypted compressed data from client in base64 format (required)- Returns:
- a String of original form XML data
- Throws:
FormXmlCrypto.CryptoException
- if the form data could not be decrypted
-
getRequestKeyFromClientEncryptedCompressedData
Return the TM RequestKey for the given base64 encoded form XML data.- Parameters:
formBase64Data
- the form XML base 64 encoded data (requried)- Returns:
- the TM RequestKey for the given base64 encoded form XML data
-