/** * <p> * Sets the algorithm to be used for digesting, like <tt>MD5</tt> * or <tt>SHA-1</tt>. * </p> * <p> * This algorithm has to be supported by your security infrastructure, and * it should be allowed as an algorithm for creating * java.security.MessageDigest instances. * </p> * <p> * If you are specifying a security provider with {@link #setProvider(Provider)} or * {@link #setProviderName(String)}, this algorithm should be * supported by your specified provider. * </p> * <p> * If you are not specifying a provider, you will be able to use those * algorithms provided by the default security provider of your JVM vendor. * For valid names in the Sun JVM, see <a target="_blank" * href="http://java.sun.com/j2se/1.5.0/docs/guide/security/CryptoSpec.html#AppA">Java * Cryptography Architecture API Specification & * Reference</a>. * </p> * * @param algorithm the name of the algorithm to be used. */ public synchronized void setAlgorithm(final String algorithm) { this.firstDigester.setAlgorithm(algorithm); }
/** * Creates a new instance of <tt>StrongPasswordEncryptor</tt> * */ public StrongPasswordEncryptor() { super(); this.digester = new StandardStringDigester(); this.digester.setAlgorithm("SHA-256"); this.digester.setIterations(100000); this.digester.setSaltSizeBytes(16); this.digester.initialize(); }
/** * Creates a new instance of <tt>StrongPasswordEncryptor</tt> * */ public StrongPasswordEncryptor() { super(); this.digester = new StandardStringDigester(); this.digester.setAlgorithm("SHA-256"); this.digester.setIterations(100000); this.digester.setSaltSizeBytes(16); this.digester.initialize(); }
/** * Creates a new instance of <tt>RFC2307SHAPasswordEncryptor</tt> * */ public RFC2307SHAPasswordEncryptor() { super(); this.digester = new StandardStringDigester(); this.digester.setAlgorithm("SHA-1"); this.digester.setIterations(1); this.digester.setSaltSizeBytes(0); this.digester.setPrefix("{SHA}"); }
/** * Creates a new instance of <tt>RFC2307SHAPasswordEncryptor</tt> * */ public RFC2307SHAPasswordEncryptor() { super(); this.digester = new StandardStringDigester(); this.digester.setAlgorithm("SHA-1"); this.digester.setIterations(1); this.digester.setSaltSizeBytes(0); this.digester.setPrefix("{SHA}"); }
/** * Creates a new instance of <tt>RFC2307MD5PasswordEncryptor</tt> * */ public RFC2307MD5PasswordEncryptor() { super(); this.digester = new StandardStringDigester(); this.digester.setAlgorithm("MD5"); this.digester.setIterations(1); this.digester.setSaltSizeBytes(0); this.digester.setPrefix("{MD5}"); }
/** * Creates a new instance of <tt>StrongPasswordEncryptor</tt> * */ public StrongPasswordEncryptor() { super(); this.digester = new StandardStringDigester(); this.digester.setAlgorithm("SHA-256"); this.digester.setIterations(100000); this.digester.setSaltSizeBytes(16); this.digester.initialize(); }
/** * Creates a new instance of <tt>RFC2307MD5PasswordEncryptor</tt> * */ public RFC2307MD5PasswordEncryptor() { super(); this.digester = new StandardStringDigester(); this.digester.setAlgorithm("MD5"); this.digester.setIterations(1); this.digester.setSaltSizeBytes(0); this.digester.setPrefix("{MD5}"); }
/** * Creates a new instance of <tt>RFC2307MD5PasswordEncryptor</tt> * */ public RFC2307MD5PasswordEncryptor() { super(); this.digester = new StandardStringDigester(); this.digester.setAlgorithm("MD5"); this.digester.setIterations(1); this.digester.setSaltSizeBytes(0); this.digester.setPrefix("{MD5}"); }
/** * Creates a new instance of <tt>RFC2307SHAPasswordEncryptor</tt> * */ public RFC2307SHAPasswordEncryptor() { super(); this.digester = new StandardStringDigester(); this.digester.setAlgorithm("SHA-1"); this.digester.setIterations(1); this.digester.setSaltSizeBytes(0); this.digester.setPrefix("{SHA}"); }
private StandardStringDigester getDigester(final CipherAlgorithm cipherAlgorithm) { StandardStringDigester digester = digesters.get(cipherAlgorithm); if (digester == null) { digester = new StandardStringDigester(); if (cipherAlgorithm.getAlgorithm().startsWith("S-")) { // Salted ... digester.setAlgorithm(cipherAlgorithm.getAlgorithm().replaceFirst("S\\-", "")); digester.setIterations(SALT_ITERATIONS); digester.setSaltSizeBytes(SALT_SIZE_BYTES); digester.setInvertPositionOfPlainSaltInEncryptionResults(IPOPSIER); digester.setInvertPositionOfSaltInMessageBeforeDigesting(IPOSIMBD); digester.setUseLenientSaltSizeCheck(ULSSC); } else { // Not salted ... digester.setAlgorithm(cipherAlgorithm.getAlgorithm()); digester.setIterations(1); digester.setSaltSizeBytes(0); } digester.setStringOutputType(CommonUtils.STRING_OUTPUT_TYPE_HEXADECIMAL); digesters.put(cipherAlgorithm, digester); } return digester; } }
private StandardStringDigester getDigester(final CipherAlgorithm cipherAlgorithm) { StandardStringDigester digester = new StandardStringDigester(); if (cipherAlgorithm.getAlgorithm().startsWith("S-")) { // Salted ... digester.setAlgorithm(cipherAlgorithm.getAlgorithm().replaceFirst("S\\-", "")); digester.setIterations(SALT_ITERATIONS); digester.setSaltSizeBytes(SALT_SIZE_BYTES); digester.setInvertPositionOfPlainSaltInEncryptionResults(IPOPSIER); digester.setInvertPositionOfSaltInMessageBeforeDigesting(IPOSIMBD); digester.setUseLenientSaltSizeCheck(ULSSC); } else { // Not salted ... digester.setAlgorithm(cipherAlgorithm.getAlgorithm()); digester.setIterations(1); digester.setSaltSizeBytes(0); } digester.setStringOutputType(CommonUtils.STRING_OUTPUT_TYPE_HEXADECIMAL); return digester; } }
@Override public void initialize() throws InitializationException { this.encryptor = new StrongTextEncryptor(); this.encryptor.setPassword(this.passwordConfig.getSystemPassword()); this.digester = new StandardStringDigester(); this.digester.setAlgorithm("SHA-512"); this.digester.setIterations(100); this.digester.setSaltSizeBytes(16); this.digester.initialize(); }
/** * Creates a new instance of <tt>RFC2307OpenLDAPSSHAPasswordEncryptor</tt> * */ public RFC2307SMD5PasswordEncryptor() { super(); this.digester = new StandardStringDigester(); this.digester.setAlgorithm("MD5"); this.digester.setIterations(1); this.digester.setSaltSizeBytes(8); this.digester.setPrefix("{SMD5}"); this.digester.setInvertPositionOfSaltInMessageBeforeDigesting(true); this.digester.setInvertPositionOfPlainSaltInEncryptionResults(true); this.digester.setUseLenientSaltSizeCheck(true); }
@Override public void initialize() throws InitializationException { this.encryptor = new StrongTextEncryptor(); this.encryptor.setPassword(this.passwordConfig.getSystemPassword()); this.digester = new StandardStringDigester(); this.digester.setAlgorithm("SHA-512"); this.digester.setIterations(100); this.digester.setSaltSizeBytes(16); this.digester.initialize(); }
/** * Creates a new instance of <tt>RFC2307OpenLDAPSSHAPasswordEncryptor</tt> * */ public RFC2307SMD5PasswordEncryptor() { super(); this.digester = new StandardStringDigester(); this.digester.setAlgorithm("MD5"); this.digester.setIterations(1); this.digester.setSaltSizeBytes(8); this.digester.setPrefix("{SMD5}"); this.digester.setInvertPositionOfSaltInMessageBeforeDigesting(true); this.digester.setInvertPositionOfPlainSaltInEncryptionResults(true); this.digester.setUseLenientSaltSizeCheck(true); }
/** * Creates a new instance of <tt>RFC2307OpenLDAPSSHAPasswordEncryptor</tt> * */ public RFC2307SSHAPasswordEncryptor() { super(); this.digester = new StandardStringDigester(); this.digester.setAlgorithm("SHA-1"); this.digester.setIterations(1); this.digester.setSaltSizeBytes(8); this.digester.setPrefix("{SSHA}"); this.digester.setInvertPositionOfSaltInMessageBeforeDigesting(true); this.digester.setInvertPositionOfPlainSaltInEncryptionResults(true); this.digester.setUseLenientSaltSizeCheck(true); }
/** * Creates a new instance of <tt>RFC2307OpenLDAPSSHAPasswordEncryptor</tt> * */ public RFC2307SMD5PasswordEncryptor() { super(); this.digester = new StandardStringDigester(); this.digester.setAlgorithm("MD5"); this.digester.setIterations(1); this.digester.setSaltSizeBytes(8); this.digester.setPrefix("{SMD5}"); this.digester.setInvertPositionOfSaltInMessageBeforeDigesting(true); this.digester.setInvertPositionOfPlainSaltInEncryptionResults(true); this.digester.setUseLenientSaltSizeCheck(true); }
/** * Creates a new instance of <tt>RFC2307OpenLDAPSSHAPasswordEncryptor</tt> * */ public RFC2307SSHAPasswordEncryptor() { super(); this.digester = new StandardStringDigester(); this.digester.setAlgorithm("SHA-1"); this.digester.setIterations(1); this.digester.setSaltSizeBytes(8); this.digester.setPrefix("{SSHA}"); this.digester.setInvertPositionOfSaltInMessageBeforeDigesting(true); this.digester.setInvertPositionOfPlainSaltInEncryptionResults(true); this.digester.setUseLenientSaltSizeCheck(true); }
/** * Creates a new instance of <tt>RFC2307OpenLDAPSSHAPasswordEncryptor</tt> * */ public RFC2307SSHAPasswordEncryptor() { super(); this.digester = new StandardStringDigester(); this.digester.setAlgorithm("SHA-1"); this.digester.setIterations(1); this.digester.setSaltSizeBytes(8); this.digester.setPrefix("{SSHA}"); this.digester.setInvertPositionOfSaltInMessageBeforeDigesting(true); this.digester.setInvertPositionOfPlainSaltInEncryptionResults(true); this.digester.setUseLenientSaltSizeCheck(true); }