@ ShellMethod ( key = "decrypt-value" , value = "Encrypt a CAS property value/setting via Jasypt" ) public void decryptValue ( @ ShellOption ( value = { "value" } , help = "Value to encrypt" ) final String value , @ ShellOption ( value = { "alg" } , help = "Algorithm to use to encrypt" ) final String alg , @ ShellOption ( value = { "provider" } , help = "Security provider to use to encrypt" ) final String provider , @ ShellOption ( value = { "password" } , help = "Password (encryption key) to encrypt" ) final String password , @ ShellOption ( value = { "iterations" } , help = "Key obtention iterations to encrypt" ) final String iterations ) { val cipher = new CasConfigurationJasyptCipherExecutor ( this . environment ) ; cipher . setAlgorithm ( alg ) ; cipher . setPassword ( password ) ; if ( Security . getProvider ( BouncyCastleProvider . PROVIDER_NAME ) == null ) { Security . addProvider ( new BouncyCastleProvider ( ) ) ; } cipher . setProviderName ( provider ) ; cipher . setKeyObtentionIterations ( iterations ) ; val encrypted = cipher . decryptValue ( value ) ; LOGGER . info ( "==== Decrypted Value ====\n{}" , encrypted ) ; }
Decrypt a value using Jasypt .