/** * Creates a new instance of <tt>StrongIntegerNumberEncryptor</tt>. */ public StrongIntegerNumberEncryptor() { super(); this.encryptor = new StandardPBEBigIntegerEncryptor(); this.encryptor.setAlgorithm("PBEWithMD5AndTripleDES"); }
/** * <p> * Set the number of hashing iterations applied to obtain the * encryption key. * </p> * <p> * This mechanism is explained in * <a href="http://www.rsasecurity.com/rsalabs/node.asp?id=2127" * target="_blank">PKCS #5: Password-Based Cryptography Standard</a>. * </p> * * @param keyObtentionIterations the number of iterations */ public void setKeyObtentionIterations(final int keyObtentionIterations) { this.firstEncryptor.setKeyObtentionIterations(keyObtentionIterations); }
/** * Sets a password. * * @param password the password to be set. */ public void setPassword(final String password) { this.encryptor.setPassword(password); }
new StandardPBEBigIntegerEncryptor(); newEncryptor.setPassword(this.password); newEncryptor.setAlgorithm(this.algorithm); newEncryptor.setKeyObtentionIterations( this.keyObtentionIterations.intValue()); newEncryptor.initialize();
/** * Creates a new instance of <tt>PooledStandardPBEBigIntegerEncryptor</tt>. */ public PooledPBEBigIntegerEncryptor() { super(); this.firstEncryptor = new StandardPBEBigIntegerEncryptor(); }
/** * Sets a password, as a char[]. * * @since 1.8 * @param password the password to be set. */ public void setPasswordCharArray(final char[] password) { this.encryptor.setPasswordCharArray(password); }
/** * Decrypts a number. * * @param encryptedNumber the number to be decrypted. * @see StandardPBEBigIntegerEncryptor#decrypt(BigInteger) */ public BigInteger decrypt(final BigInteger encryptedNumber) { return this.encryptor.decrypt(encryptedNumber); }
/** * Encrypts a number * * @param number the number to be encrypted. * @see StandardPBEBigIntegerEncryptor#encrypt(BigInteger) */ public BigInteger encrypt(final BigInteger number) { return this.encryptor.encrypt(number); }
/** * <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 algorithm to be used for encryption, like * <tt>PBEWithMD5AndDES</tt>. * </p> * <p> * This algorithm has to be supported by your JCE provider (if you specify * one, or the default JVM provider if you don't) and, if it is supported, * you can also specify <i>mode</i> and <i>padding</i> for * it, like <tt>ALGORITHM/MODE/PADDING</tt>. * </p> * * @param algorithm the name of the algorithm to be used. */ public void setAlgorithm(final String algorithm) { this.firstEncryptor.setAlgorithm(algorithm); }
/** * <p> * Sets a <tt>{@link org.jasypt.encryption.pbe.config.PBEConfig}</tt> object * for the encryptor. If this config * object is set, it will be asked values for: * </p> * * <ul> * <li>Algorithm</li> * <li>Security Provider (or provider name)</li> * <li>Password</li> * <li>Hashing iterations for obtaining the encryption key</li> * <li>Salt generator</li> * <li>Output type (base64, hexadecimal) * (only <tt>StringPBEConfig</tt>)</li> * </ul> * * <p> * The non-null values it returns will override the default ones, * <i>and will be overriden by any values specified with a <tt>setX</tt> * method</i>. * </p> * * @param config the <tt>PBEConfig</tt> object to be used as the * source for configuration parameters. */ public synchronized void setConfig(final PBEConfig config) { this.firstEncryptor.setConfig(config); this.config = config; }
this.pool = this.firstEncryptor.cloneAndInitializeEncryptor(this.poolSize);
/** * Creates a new instance of <tt>PooledStandardPBEBigIntegerEncryptor</tt>. */ public PooledPBEBigIntegerEncryptor() { super(); this.firstEncryptor = new StandardPBEBigIntegerEncryptor(); }
/** * Sets a password, as a char[]. * * @since 1.8 * @param password the password to be set. */ public void setPasswordCharArray(final char[] password) { this.encryptor.setPasswordCharArray(password); }
/** * Decrypts a number. * * @param encryptedNumber the number to be decrypted. * @see StandardPBEBigIntegerEncryptor#decrypt(BigInteger) */ public BigInteger decrypt(final BigInteger encryptedNumber) { return this.encryptor.decrypt(encryptedNumber); }
/** * Encrypts a number * * @param number the number to be encrypted. * @see StandardPBEBigIntegerEncryptor#encrypt(BigInteger) */ public BigInteger encrypt(final BigInteger number) { return this.encryptor.encrypt(number); }
/** * <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 algorithm to be used for encryption, like * <tt>PBEWithMD5AndDES</tt>. * </p> * <p> * This algorithm has to be supported by your JCE provider (if you specify * one, or the default JVM provider if you don't) and, if it is supported, * you can also specify <i>mode</i> and <i>padding</i> for * it, like <tt>ALGORITHM/MODE/PADDING</tt>. * </p> * * @param algorithm the name of the algorithm to be used. */ public void setAlgorithm(final String algorithm) { this.firstEncryptor.setAlgorithm(algorithm); }
/** * <p> * Sets a <tt>{@link org.jasypt.encryption.pbe.config.PBEConfig}</tt> object * for the encryptor. If this config * object is set, it will be asked values for: * </p> * * <ul> * <li>Algorithm</li> * <li>Security Provider (or provider name)</li> * <li>Password</li> * <li>Hashing iterations for obtaining the encryption key</li> * <li>Salt generator</li> * <li>Output type (base64, hexadecimal) * (only <tt>StringPBEConfig</tt>)</li> * </ul> * * <p> * The non-null values it returns will override the default ones, * <i>and will be overriden by any values specified with a <tt>setX</tt> * method</i>. * </p> * * @param config the <tt>PBEConfig</tt> object to be used as the * source for configuration parameters. */ public synchronized void setConfig(final PBEConfig config) { this.firstEncryptor.setConfig(config); this.config = config; }
this.pool = this.firstEncryptor.cloneAndInitializeEncryptor(this.poolSize);