Interface Encryptor

All Known Subinterfaces:
SwitchableEncryptor
All Known Implementing Classes:
Base64Encryptor, CachedEncryptor, ClusterLockingEncryptor, DbConfigPasswordCipherEncryptor, MissingKeyHandlingEncryptor, PrefixBasedSwitchableEncryptor, SaltingEncryptor

public interface Encryptor
Encryptor can be used to encrypt / decrypt passwords. Password encrypted with encrypt(java.lang.String) can later be decrypted with decrypt(java.lang.String).
  • Method Summary

    Modifier and Type
    Method
    Description
    default boolean
    Generate new encryption key, which should be used to encrypt password in following calls to encrypt(java.lang.String).
    decrypt(String encryptedPassword)
    Decrypt encrypted password, and return its original value.
    encrypt(String password)
    Encrypt plaintext password, and return encrypted value which can later be used in decrypt method to get plaintext password.
  • Method Details

    • encrypt

      String encrypt(String password)
      Encrypt plaintext password, and return encrypted value which can later be used in decrypt method to get plaintext password.
      Returns:
      encrypted password.
      Throws:
      MissingKeyException - when encryption key has not been found in the file system or the default key is not set
    • decrypt

      String decrypt(String encryptedPassword)
      Decrypt encrypted password, and return its original value.

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

      Returns:
      decrypted password or unchanged encryptedPassword in case of any error
    • changeEncryptionKey

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