@Override protected CharArrayPasswordEncoder createCharEncoder() { return new CharArrayPasswordEncoder() { StandardByteDigester digester = new StandardByteDigester(); { digester.setAlgorithm("SHA-256"); digester.setIterations(100000); digester.setSaltSizeBytes(16); digester.initialize(); } @Override public String encodePassword(char[] rawPass, Object salt) { return new String(Base64.encodeBase64(digester.digest(toBytes(rawPass)))); } @Override public boolean isPasswordValid(String encPass, char[] rawPass, Object salt) { return digester.matches(toBytes(rawPass), Base64.decodeBase64(encPass.getBytes())); } }; }
/** * <p> * Sets the size of the salt to be used to compute the digest. * 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> * * <p> * If salt size is set to zero, then no salt will be used. * </p> * * @param saltSizeBytes the size of the salt to be used, in bytes. */ public synchronized void setSaltSizeBytes(final int saltSizeBytes) { this.firstDigester.setSaltSizeBytes(saltSizeBytes); }
/** * <p> * Sets the size of the salt to be used to compute the digest. * 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> * * <p> * If salt size is set to zero, then no salt will be used. * </p> * * @param saltSizeBytes the size of the salt to be used, in bytes. */ public synchronized void setSaltSizeBytes(final int saltSizeBytes) { this.firstDigester.setSaltSizeBytes(saltSizeBytes); }
/** * <p> * Sets the size of the salt to be used to compute the digest. * 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> * * <p> * If salt size is set to zero, then no salt will be used. * </p> * * @param saltSizeBytes the size of the salt to be used, in bytes. */ public void setSaltSizeBytes(final int saltSizeBytes) { this.byteDigester.setSaltSizeBytes(saltSizeBytes); }
/** * <p> * Sets the size of the salt to be used to compute the digest. * 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> * * <p> * If salt size is set to zero, then no salt will be used. * </p> * * @param saltSizeBytes the size of the salt to be used, in bytes. */ public void setSaltSizeBytes(final int saltSizeBytes) { this.byteDigester.setSaltSizeBytes(saltSizeBytes); }
/** * <p> * Sets the size of the salt to be used to compute the digest. * 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> * * <p> * If salt size is set to zero, then no salt will be used. * </p> * * @param saltSizeBytes the size of the salt to be used, in bytes. */ public void setSaltSizeBytes(final int saltSizeBytes) { this.byteDigester.setSaltSizeBytes(saltSizeBytes); }
/** * Creates a new instance of <tt>Digester</tt>. It will use * the default algorithm unless one is specified with * {@link #setAlgorithm(String)}. * */ public Digester() { super(); this.digester = new StandardByteDigester(); this.digester.setIterations(ITERATIONS); this.digester.setSaltSizeBytes(SALT_SIZE_BYTES); }
/** * Creates a new instance of <tt>Digester</tt>. It will use * the default algorithm unless one is specified with * {@link #setAlgorithm(String)}. * */ public Digester() { super(); this.digester = new StandardByteDigester(); this.digester.setIterations(ITERATIONS); this.digester.setSaltSizeBytes(SALT_SIZE_BYTES); }
/** * Creates a new instance of <tt>Digester</tt>. It will use * the default algorithm unless one is specified with * {@link #setAlgorithm(String)}. * */ public Digester() { super(); this.digester = new StandardByteDigester(); this.digester.setIterations(ITERATIONS); this.digester.setSaltSizeBytes(SALT_SIZE_BYTES); }
/** * <p> * Creates a new instance of <tt>Digester</tt>, specifying * the algorithm to be used. * </p> */ public Digester(final String algorithm) { super(); this.digester = new StandardByteDigester(); this.digester.setIterations(ITERATIONS); this.digester.setSaltSizeBytes(SALT_SIZE_BYTES); this.digester.setAlgorithm(algorithm); }
/** * <p> * Creates a new instance of <tt>Digester</tt>, specifying * the algorithm to be used. * </p> */ public Digester(final String algorithm) { super(); this.digester = new StandardByteDigester(); this.digester.setIterations(ITERATIONS); this.digester.setSaltSizeBytes(SALT_SIZE_BYTES); this.digester.setAlgorithm(algorithm); }
/** * <p> * Creates a new instance of <tt>Digester</tt>, specifying * the algorithm to be used. * </p> */ public Digester(final String algorithm) { super(); this.digester = new StandardByteDigester(); this.digester.setIterations(ITERATIONS); this.digester.setSaltSizeBytes(SALT_SIZE_BYTES); this.digester.setAlgorithm(algorithm); }
/** * <p> * Creates a new instance of <tt>Digester</tt>, specifying * the algorithm to be used. * </p> * * @since 1.3 */ public Digester(final String algorithm, final String providerName) { super(); this.digester = new StandardByteDigester(); this.digester.setIterations(ITERATIONS); this.digester.setSaltSizeBytes(SALT_SIZE_BYTES); this.digester.setAlgorithm(algorithm); this.digester.setProviderName(providerName); }
private static StandardByteDigester newStandardByteDigester(String algorithm, int iterations, int saltSizeBytes) { final StandardByteDigester standardByteDigester = new StandardByteDigester(); standardByteDigester.setAlgorithm(algorithm); standardByteDigester.setIterations(iterations); standardByteDigester.setSaltSizeBytes(saltSizeBytes); standardByteDigester.initialize(); return standardByteDigester; } }
/** * <p> * Creates a new instance of <tt>Digester</tt>, specifying * the algorithm to be used. * </p> * * @since 1.3 */ public Digester(final String algorithm, final String providerName) { super(); this.digester = new StandardByteDigester(); this.digester.setIterations(ITERATIONS); this.digester.setSaltSizeBytes(SALT_SIZE_BYTES); this.digester.setAlgorithm(algorithm); this.digester.setProviderName(providerName); }
/** * <p> * Creates a new instance of <tt>Digester</tt>, specifying * the algorithm to be used. * </p> * * @since 1.3 */ public Digester(final String algorithm, final Provider provider) { super(); this.digester = new StandardByteDigester(); this.digester.setIterations(ITERATIONS); this.digester.setSaltSizeBytes(SALT_SIZE_BYTES); this.digester.setAlgorithm(algorithm); this.digester.setProvider(provider); }
/** * <p> * Creates a new instance of <tt>Digester</tt>, specifying * the algorithm to be used. * </p> * * @since 1.3 */ public Digester(final String algorithm, final Provider provider) { super(); this.digester = new StandardByteDigester(); this.digester.setIterations(ITERATIONS); this.digester.setSaltSizeBytes(SALT_SIZE_BYTES); this.digester.setAlgorithm(algorithm); this.digester.setProvider(provider); }
/** * <p> * Creates a new instance of <tt>Digester</tt>, specifying * the algorithm to be used. * </p> * * @since 1.3 */ public Digester(final String algorithm, final String providerName) { super(); this.digester = new StandardByteDigester(); this.digester.setIterations(ITERATIONS); this.digester.setSaltSizeBytes(SALT_SIZE_BYTES); this.digester.setAlgorithm(algorithm); this.digester.setProviderName(providerName); }
/** * <p> * Creates a new instance of <tt>Digester</tt>, specifying * the algorithm to be used. * </p> * * @since 1.3 */ public Digester(final String algorithm, final Provider provider) { super(); this.digester = new StandardByteDigester(); this.digester.setIterations(ITERATIONS); this.digester.setSaltSizeBytes(SALT_SIZE_BYTES); this.digester.setAlgorithm(algorithm); this.digester.setProvider(provider); }
private LegacyJasyptPasswordEncryptor() { this.digester = new StandardByteDigester(); this.digester.setAlgorithm("SHA-256"); this.digester.setIterations(100000); this.digester.setSaltSizeBytes(16); this.digester.initialize(); this.base64 = new Base64(); }