Interface SecureTokenService

All Known Implementing Classes:
DefaultSecureTokenService

public interface SecureTokenService
Service to Encrypt SecureTokenData into a short encrypted token and decrypt a token. The encrypted string is in Base64 format. The data is signed and encrypted using 2 separate keys. The keys are specified as hex character strings. Instances of this class are thread safe. Unlimited strength cryptography is required. The data block is calculated as: Signature key (not included in data block) Length prefixed padding SecureTokenData.Data SecureTokenData.Checksum SecureTokenData.TimeStamp padding MD5 signature of the above. All the above (except signature key) is AES encrypted using encryption key. Result is base64ed.
Spring Bean ID:
secureTokenService
  • Method Details

    • encryptData

      String encryptData(SecureToken data)
      Encrypt the SecureToken parameter to a String
      Parameters:
      data - The unencrypted token data
      Returns:
      encrypted token
      Throws:
      IllegalArgumentException
    • decryptData

      SecureToken decryptData(String encryptedToken)
      Decrypt the token to a SecureToken.
      Parameters:
      encryptedToken - the encrypted token data
      Returns:
      decrypted SecureToken
      Throws:
      IllegalArgumentException - if the token cannot be decrypted