/** * <p> * Sets the salt generator to be used. If no salt generator is specified, * an instance of {@link org.jasypt.salt.RandomSaltGenerator} will be used. * </p> * * @param saltGenerator the salt generator to be used. */ public void setSaltGenerator(final SaltGenerator saltGenerator) { this.firstEncryptor.setSaltGenerator(saltGenerator); }
/** * <p> * Sets the salt generator to be used. If no salt generator is specified, * an instance of {@link org.jasypt.salt.RandomSaltGenerator} will be used. * </p> * * @param saltGenerator the salt generator to be used. */ public void setSaltGenerator(final SaltGenerator saltGenerator) { this.firstEncryptor.setSaltGenerator(saltGenerator); }
/** * <p> * Sets the salt generator to be used. If no salt generator is specified, * an instance of {@link org.jasypt.salt.RandomSaltGenerator} will be used. * </p> * * @param saltGenerator the salt generator to be used. */ public void setSaltGenerator(final SaltGenerator saltGenerator) { this.firstEncryptor.setSaltGenerator(saltGenerator); }
/** * Sets the salt generator to be used by the internal encryptor, * if a specific encryptor has not been set with <tt>setEncryptor(...)</tt>. * * @param saltGenerator the salt generator to be set for the internal * encryptor. */ public void setSaltGenerator(final SaltGenerator saltGenerator) { if (this.encryptorSet) { throw new EncryptionInitializationException( "An encryptor has been already set: no " + "further configuration possible on hibernate wrapper"); } final StandardPBEStringEncryptor standardPBEStringEncryptor = (StandardPBEStringEncryptor) this.encryptor; standardPBEStringEncryptor.setSaltGenerator(saltGenerator); }
private StringEncryptor getEncryptor() { StandardPBEStringEncryptor encryptor = new StandardPBEStringEncryptor(); encryptor.setPassword(engineProperties.getHashPassword()); encryptor.setSaltGenerator(new StringFixedSaltGenerator(salt)); return encryptor; }
StandardPBEStringEncryptor myFirstEncryptor = new StandardPBEStringEncryptor(); myFirstEncryptor.setProvider(new BouncyCastleProvider()); myFirstEncryptor.setAlgorithm("PBEWITHSHA256AND256BITAES-CBC-BC"); FixedStringSaltGenerator generator = new FixedStringSaltGenerator(); generator.setSalt("justAnotherSaltforGX"); //myFirstEncryptor.setSaltGenerator(new ZeroSaltGenerator()); myFirstEncryptor.setSaltGenerator(generator); myFirstEncryptor.setKeyObtentionIterations(1); String myPassword="creditCard"; myFirstEncryptor.setPassword(myPassword); String myText="Redeem Gacha "; String myFirstEncryptedText = myFirstEncryptor.encrypt(myText); System.out.println("myFirstEncryptedText AES encrypt=="+myFirstEncryptedText); System.out.println("myFirstEncryptedText AES decrypt =="+myFirstEncryptor.decrypt(myFirstEncryptedText));
@Override public StringEncryptor getEncryptor() { StandardPBEStringEncryptor encryptor = new StandardPBEStringEncryptor(); encryptor.setPassword(getPassword()); encryptor.setSaltGenerator(new StringFixedSaltGenerator(getSalt())); return encryptor; }