Class FormXmlCrypto

java.lang.Object
com.avoka.fc.core.util.FormXmlCrypto

public class FormXmlCrypto extends Object
Provides form XML data encryption and decryption functions.
Since:
5.0
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Class
    Description
    static class 
    Provides a crypto exception.
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    static String
    decrypt(String formBase64Data)
    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
    encrypt(byte[] xmlData, String requestKey)
    Convert form xml data to a compressed encrypted string based on AES-CBC 128 bit.
    static String
    Return the TM RequestKey for the given base64 encoded form XML data.

    Methods inherited from class java.lang.Object

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

    • FormXmlCrypto

      public FormXmlCrypto()
  • Method Details

    • encrypt

      public static String encrypt(byte[] xmlData, String requestKey)
      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

      public static String decrypt(String formBase64Data) throws FormXmlCrypto.CryptoException
      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

      public static String getRequestKeyFromClientEncryptedCompressedData(String formBase64Data)
      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