Package com.atlassian.crowd.embedded.api
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 TypeMethodDescriptiondefault boolean
Generate new encryption key, which should be used to encrypt password in following calls toencrypt(java.lang.String)
.Decrypt encrypted password, and return its original value.Encrypt plaintext password, and return encrypted value which can later be used in decrypt method to get plaintext password.
-
Method Details
-
encrypt
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
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 toencrypt(java.lang.String)
.- Returns:
- true if generation was successful, or false when encryption key migration is not supported
-