Class CachedEncryptor

java.lang.Object
com.atlassian.crowd.crypto.CachedEncryptor
All Implemented Interfaces:
Encryptor

public class CachedEncryptor extends Object implements Encryptor
Wrapper that caches encryption and decryption results.
  • Constructor Details

  • Method Details

    • encrypt

      public String encrypt(String password)
      Description copied from interface: Encryptor
      Encrypt plaintext password, and return encrypted value which can later be used in decrypt method to get plaintext password.
      Specified by:
      encrypt in interface Encryptor
      Returns:
      encrypted password.
    • decrypt

      public String decrypt(String encryptedPassword)
      Description copied from interface: Encryptor
      Decrypt encrypted password, and return its original value.

      In case of any error during decryption (such as missing decryption key) return encryptedPassword.

      Specified by:
      decrypt in interface Encryptor
      Returns:
      decrypted password or unchanged encryptedPassword in case of any error
    • changeEncryptionKey

      public boolean changeEncryptionKey()
      Description copied from interface: Encryptor
      Generate new encryption key, which should be used to encrypt password in following calls to Encryptor.encrypt(java.lang.String).
      Specified by:
      changeEncryptionKey in interface Encryptor
      Returns:
      true if generation was successful, or false when encryption key migration is not supported