@SuppressWarnings({ "rawtypes", "unchecked" }) @Override public void initialize(Subject subject, CallbackHandler callbackHandler, Map sharedState, Map options) { String encryptionPassword = (String)options.get(ENCRYPTION_PASSWORD); String passwordEnvName = options.get(PASSWORD_ENV_NAME) != null ? (String)options.get(PASSWORD_ENV_NAME) : DEFAULT_PASSWORD_ENV_NAME; String passwordAlgorithm = options.get(PASSWORD_ALGORITHM) != null ? (String)options.get(PASSWORD_ALGORITHM) : DEFAULT_PASSWORD_ALGORITHM; EnvironmentStringPBEConfig envConfig = new EnvironmentStringPBEConfig(); envConfig.setAlgorithm(passwordAlgorithm); //If the password was set, use it //else look up the password from the environment if (encryptionPassword == null) { envConfig.setPasswordEnvName(passwordEnvName); } else { envConfig.setPassword(encryptionPassword); } configurationEncryptor.setConfig(envConfig); EncryptableProperties encryptableOptions = new EncryptableProperties(configurationEncryptor); encryptableOptions.putAll(options); super.initialize(subject, callbackHandler, sharedState, encryptableOptions); }
StandardPBEStringEncryptor encryptor = EncryptionSecretKeyChecker.getEncryptor(); EncryptableProperties encrDbProps = new EncryptableProperties(encryptor); encrDbProps.putAll(dbProps); dbProps = encrDbProps;
protected static Properties wrapEncryption(Properties dbProps) throws IOException { EncryptionSecretKeyChecker checker = new EncryptionSecretKeyChecker(); checker.check(dbProps); if (EncryptionSecretKeyChecker.useEncryption()) { return dbProps; } else { EncryptableProperties encrProps = new EncryptableProperties(EncryptionSecretKeyChecker.getEncryptor()); encrProps.putAll(dbProps); return encrProps; } }
private static Properties processProperties(final Properties props, final TextEncryptor encryptor) { if (props == null) { return null; } if (props instanceof EncryptableProperties) { throw new IllegalArgumentException( "Properties object already is an " + EncryptableProperties.class.getName() + " object. No encryptor should be specified."); } final EncryptableProperties encryptableProperties = new EncryptableProperties(encryptor); encryptableProperties.putAll(props); return encryptableProperties; }
private static Properties processProperties(final Properties props, final StringEncryptor encryptor) { if (props == null) { return null; } if (props instanceof EncryptableProperties) { throw new IllegalArgumentException( "Properties object already is an " + EncryptableProperties.class.getName() + " object. No encryptor should be specified."); } final EncryptableProperties encryptableProperties = new EncryptableProperties(encryptor); encryptableProperties.putAll(props); return encryptableProperties; }
private static Properties processProperties(final Properties props, final TextEncryptor encryptor) { if (props == null) { return null; } if (props instanceof EncryptableProperties) { throw new IllegalArgumentException( "Properties object already is an " + EncryptableProperties.class.getName() + " object. No encryptor should be specified."); } final EncryptableProperties encryptableProperties = new EncryptableProperties(encryptor); encryptableProperties.putAll(props); return encryptableProperties; }
private static Properties processProperties(final Properties props, final StringEncryptor encryptor) { if (props == null) { return null; } if (props instanceof EncryptableProperties) { throw new IllegalArgumentException( "Properties object already is an " + EncryptableProperties.class.getName() + " object. No encryptor should be specified."); } final EncryptableProperties encryptableProperties = new EncryptableProperties(encryptor); encryptableProperties.putAll(props); return encryptableProperties; }
private EncryptableProperties processEncryptable(final Properties props) { if (this.encryptor == null) { throw new IllegalArgumentException( "\"encryptor\" property in EncryptableProperties definition cannot be null"); } if (this.encryptor instanceof TextEncryptor) { final EncryptableProperties encryptableProperties = new EncryptableProperties((TextEncryptor)this.encryptor); encryptableProperties.putAll(props); return encryptableProperties; } else if (this.encryptor instanceof StringEncryptor) { final EncryptableProperties encryptableProperties = new EncryptableProperties((StringEncryptor)this.encryptor); encryptableProperties.putAll(props); return encryptableProperties; } throw new IllegalArgumentException( "\"encryptor\" property in EncryptableProperties definition must be either " + "an org.jasypt.util.text.TextEncryptor or an org.jasypt.encryption.StringEncryptor " + "object. An object of class " + this.encryptor.getClass().getName() + " has been " + "specified instead."); }
private EncryptableProperties processEncryptable(final Properties props) { if (this.encryptor == null) { throw new IllegalArgumentException( "\"encryptor\" property in EncryptableProperties definition cannot be null"); } if (this.encryptor instanceof TextEncryptor) { final EncryptableProperties encryptableProperties = new EncryptableProperties((TextEncryptor)this.encryptor); encryptableProperties.putAll(props); return encryptableProperties; } else if (this.encryptor instanceof StringEncryptor) { final EncryptableProperties encryptableProperties = new EncryptableProperties((StringEncryptor)this.encryptor); encryptableProperties.putAll(props); return encryptableProperties; } throw new IllegalArgumentException( "\"encryptor\" property in EncryptableProperties definition must be either " + "an org.jasypt.util.text.TextEncryptor or an org.jasypt.encryption.StringEncryptor " + "object. An object of class " + this.encryptor.getClass().getName() + " has been " + "specified instead."); }
private EncryptableProperties processEncryptable(final Properties props) { if (this.encryptor == null) { throw new IllegalArgumentException( "\"encryptor\" property in EncryptableProperties definition cannot be null"); } if (this.encryptor instanceof TextEncryptor) { final EncryptableProperties encryptableProperties = new EncryptableProperties((TextEncryptor)this.encryptor); encryptableProperties.putAll(props); return encryptableProperties; } else if (this.encryptor instanceof StringEncryptor) { final EncryptableProperties encryptableProperties = new EncryptableProperties((StringEncryptor)this.encryptor); encryptableProperties.putAll(props); return encryptableProperties; } throw new IllegalArgumentException( "\"encryptor\" property in EncryptableProperties definition must be either " + "an org.jasypt.util.text.TextEncryptor or an org.jasypt.encryption.StringEncryptor " + "object. An object of class " + this.encryptor.getClass().getName() + " has been " + "specified instead."); }
@SuppressWarnings({ "rawtypes", "unchecked" }) @Override public void initialize(Subject subject, CallbackHandler callbackHandler, Map sharedState, Map options) { String encryptionPassword = (String)options.get(ENCRYPTION_PASSWORD); String passwordEnvName = options.get(PASSWORD_ENV_NAME) != null ? (String)options.get(PASSWORD_ENV_NAME) : DEFAULT_PASSWORD_ENV_NAME; String passwordAlgorithm = options.get(PASSWORD_ALGORITHM) != null ? (String)options.get(PASSWORD_ALGORITHM) : DEFAULT_PASSWORD_ALGORITHM; EnvironmentStringPBEConfig envConfig = new EnvironmentStringPBEConfig(); envConfig.setAlgorithm(passwordAlgorithm); //If the password was set, use it //else look up the password from the environment if (encryptionPassword == null) { envConfig.setPasswordEnvName(passwordEnvName); } else { envConfig.setPassword(encryptionPassword); } configurationEncryptor.setConfig(envConfig); EncryptableProperties encryptableOptions = new EncryptableProperties(configurationEncryptor); encryptableOptions.putAll(options); super.initialize(subject, callbackHandler, sharedState, encryptableOptions); }
@SuppressWarnings({ "rawtypes", "unchecked" }) @Override public void initialize(Subject subject, CallbackHandler callbackHandler, Map sharedState, Map options) { String encryptionPassword = (String)options.get(ENCRYPTION_PASSWORD); String passwordEnvName = options.get(PASSWORD_ENV_NAME) != null ? (String)options.get(PASSWORD_ENV_NAME) : DEFAULT_PASSWORD_ENV_NAME; String passwordAlgorithm = options.get(PASSWORD_ALGORITHM) != null ? (String)options.get(PASSWORD_ALGORITHM) : DEFAULT_PASSWORD_ALGORITHM; EnvironmentStringPBEConfig envConfig = new EnvironmentStringPBEConfig(); envConfig.setAlgorithm(passwordAlgorithm); //If the password was set, use it //else look up the password from the environment if (encryptionPassword == null) { envConfig.setPasswordEnvName(passwordEnvName); } else { envConfig.setPassword(encryptionPassword); } configurationEncryptor.setConfig(envConfig); EncryptableProperties encryptableOptions = new EncryptableProperties(configurationEncryptor); encryptableOptions.putAll(options); super.initialize(subject, callbackHandler, sharedState, encryptableOptions); }
final StandardPBEStringEncryptor encryptor = EncryptionSecretKeyChecker.getEncryptor(); final EncryptableProperties encrDbProps = new EncryptableProperties(encryptor); encrDbProps.putAll(dbProps); dbProps = encrDbProps;
protected static Properties wrapEncryption(final Properties dbProps) throws IOException { final EncryptionSecretKeyChecker checker = new EncryptionSecretKeyChecker(); checker.check(dbProps); if (EncryptionSecretKeyChecker.useEncryption()) { return dbProps; } else { final EncryptableProperties encrProps = new EncryptableProperties(EncryptionSecretKeyChecker.getEncryptor()); encrProps.putAll(dbProps); return encrProps; } } }