Class CasConfigurationJasyptCipherExecutor
- java.lang.Object
-
- org.apereo.cas.configuration.support.CasConfigurationJasyptCipherExecutor
-
- All Implemented Interfaces:
org.apereo.cas.util.crypto.CipherExecutor<java.lang.String,java.lang.String>
public class CasConfigurationJasyptCipherExecutor extends java.lang.Object implements org.apereo.cas.util.crypto.CipherExecutor<java.lang.String,java.lang.String>
This isCasConfigurationJasyptCipherExecutor
.- Since:
- 5.1.0
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
CasConfigurationJasyptCipherExecutor.JasyptEncryptionParameters
The Jasypt encryption parameters.
-
Field Summary
Fields Modifier and Type Field Description static java.lang.String
ALGS_THAT_REQUIRE_IV_PATTERN
Pattern for algorithms that require an initialization vector.static java.lang.String
ENCRYPTED_VALUE_PREFIX
Prefix inserted at the beginning of a value to indicate it's encrypted.
-
Constructor Summary
Constructors Constructor Description CasConfigurationJasyptCipherExecutor(org.springframework.core.env.Environment environment)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
configureInitializationVector()
PBEWithDigestAndAES
algorithms (from the JCE Provider of JAVA 8) require an initialization vector.java.lang.String
decode(java.lang.String value, java.lang.Object[] parameters)
java.lang.String
decryptValue(java.lang.String value)
Decrypt value string.java.lang.String
decryptValuePropagateExceptions(java.lang.String value)
Decrypt value string.java.lang.String
encode(java.lang.String value, java.lang.Object[] parameters)
java.lang.String
encryptValue(java.lang.String value)
Encrypt value string.java.lang.String
encryptValuePropagateExceptions(java.lang.String value)
Encrypt value string (but don't log error, for use in shell).java.lang.String
getName()
boolean
isVectorInitializationRequiredFor(java.lang.String algorithm)
Return true if the algorithm requires initialization vector.void
setAlgorithm(java.lang.String alg)
Sets algorithm.protected void
setAlgorithmForce(java.lang.String alg)
Sets algorithm (possibly to bad algorithm, for unit test usage).void
setKeyObtentionIterations(java.lang.String iter)
Sets key obtention iterations.void
setPassword(java.lang.String psw)
Sets password.void
setProviderName(java.lang.String pName)
Sets provider name.
-
-
-
Field Detail
-
ENCRYPTED_VALUE_PREFIX
public static final java.lang.String ENCRYPTED_VALUE_PREFIX
Prefix inserted at the beginning of a value to indicate it's encrypted.- See Also:
- Constant Field Values
-
ALGS_THAT_REQUIRE_IV_PATTERN
public static final java.lang.String ALGS_THAT_REQUIRE_IV_PATTERN
Pattern for algorithms that require an initialization vector. Regex matches all PBEWITHHMACSHA###ANDAES algorithms that aren't BouncyCastle.- See Also:
- Constant Field Values
-
-
Method Detail
-
setAlgorithm
public void setAlgorithm(java.lang.String alg)
Sets algorithm.- Parameters:
alg
- the alg
-
setAlgorithmForce
protected void setAlgorithmForce(java.lang.String alg)
Sets algorithm (possibly to bad algorithm, for unit test usage).- Parameters:
alg
- the alg
-
configureInitializationVector
public void configureInitializationVector()
PBEWithDigestAndAES
algorithms (from the JCE Provider of JAVA 8) require an initialization vector. Other algorithms may also use an initialization vector and it will increase the encrypted text's length.
-
isVectorInitializationRequiredFor
public boolean isVectorInitializationRequiredFor(java.lang.String algorithm)
Return true if the algorithm requires initialization vector.- Parameters:
algorithm
- the algorithm to check- Returns:
- true if algorithm requires initialization vector
-
setPassword
public void setPassword(java.lang.String psw)
Sets password.- Parameters:
psw
- the psw
-
setKeyObtentionIterations
public void setKeyObtentionIterations(java.lang.String iter)
Sets key obtention iterations.- Parameters:
iter
- the iter
-
setProviderName
public void setProviderName(java.lang.String pName)
Sets provider name.- Parameters:
pName
- the p name
-
encode
public java.lang.String encode(java.lang.String value, java.lang.Object[] parameters)
- Specified by:
encode
in interfaceorg.apereo.cas.util.crypto.CipherExecutor<java.lang.String,java.lang.String>
-
decode
public java.lang.String decode(java.lang.String value, java.lang.Object[] parameters)
- Specified by:
decode
in interfaceorg.apereo.cas.util.crypto.CipherExecutor<java.lang.String,java.lang.String>
-
getName
public java.lang.String getName()
- Specified by:
getName
in interfaceorg.apereo.cas.util.crypto.CipherExecutor<java.lang.String,java.lang.String>
-
encryptValue
public java.lang.String encryptValue(java.lang.String value)
Encrypt value string.- Parameters:
value
- the value- Returns:
- the string
-
encryptValuePropagateExceptions
public java.lang.String encryptValuePropagateExceptions(java.lang.String value)
Encrypt value string (but don't log error, for use in shell).- Parameters:
value
- the value- Returns:
- the string
-
decryptValue
public java.lang.String decryptValue(java.lang.String value)
Decrypt value string.- Parameters:
value
- the value- Returns:
- the string
-
decryptValuePropagateExceptions
public java.lang.String decryptValuePropagateExceptions(java.lang.String value)
Decrypt value string. (but don't log error, for use in shell).- Parameters:
value
- the value- Returns:
- the string
-
-