/** * <p> * Whether the salt bytes are to be appended after the * message ones before performing the digest operation on the whole. The * default behaviour is to insert those bytes before the message bytes, but * setting this configuration item to <tt>true</tt> allows compatibility * with some external systems and specifications (e.g. LDAP {SSHA}). * </p> * <p> * If this parameter is not explicitly set, the default behaviour * (insertion of salt before message) will be applied. * </p> * * @param invertPositionOfSaltInMessageBeforeDigesting * whether salt will be appended after the message before applying * the digest operation on the whole, instead of inserted before it * (which is the default). */ public synchronized void setInvertPositionOfSaltInMessageBeforeDigesting( final boolean invertPositionOfSaltInMessageBeforeDigesting) { this.firstDigester.setInvertPositionOfSaltInMessageBeforeDigesting(invertPositionOfSaltInMessageBeforeDigesting); }
/** * <p> * Whether the salt bytes are to be appended after the * message ones before performing the digest operation on the whole. The * default behaviour is to insert those bytes before the message bytes, but * setting this configuration item to <tt>true</tt> allows compatibility * with some external systems and specifications (e.g. LDAP {SSHA}). * </p> * <p> * If this parameter is not explicitly set, the default behaviour * (insertion of salt before message) will be applied. * </p> * * @param invertPositionOfSaltInMessageBeforeDigesting * whether salt will be appended after the message before applying * the digest operation on the whole, instead of inserted before it * (which is the default). */ public synchronized void setInvertPositionOfSaltInMessageBeforeDigesting( final boolean invertPositionOfSaltInMessageBeforeDigesting) { this.firstDigester.setInvertPositionOfSaltInMessageBeforeDigesting(invertPositionOfSaltInMessageBeforeDigesting); }
/** * <p> * Whether the salt bytes are to be appended after the * message ones before performing the digest operation on the whole. The * default behaviour is to insert those bytes before the message bytes, but * setting this configuration item to <tt>true</tt> allows compatibility * with some external systems and specifications (e.g. LDAP {SSHA}). * </p> * <p> * If this parameter is not explicitly set, the default behaviour * (insertion of salt before message) will be applied. * </p> * * @param invertPositionOfSaltInMessageBeforeDigesting * whether salt will be appended after the message before applying * the digest operation on the whole, instead of inserted before it * (which is the default). */ public synchronized void setInvertPositionOfSaltInMessageBeforeDigesting( final boolean invertPositionOfSaltInMessageBeforeDigesting) { this.firstDigester.setInvertPositionOfSaltInMessageBeforeDigesting(invertPositionOfSaltInMessageBeforeDigesting); }
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; } }
/** * 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 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); }
/** * 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); }
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; } }