/** * <p> * Whether the plain (not hashed) salt bytes are to * be appended after the digest operation result bytes. The default behaviour is * to insert them before the digest result, 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 plain salt before digest result) will be applied. * </p> * * @since 1.7 * * @param invertPositionOfPlainSaltInEncryptionResults * whether plain salt will be appended after the digest operation * result instead of inserted before it (which is the * default). */ public synchronized void setInvertPositionOfPlainSaltInEncryptionResults( final boolean invertPositionOfPlainSaltInEncryptionResults) { this.firstDigester.setInvertPositionOfPlainSaltInEncryptionResults(invertPositionOfPlainSaltInEncryptionResults); }
/** * <p> * Whether the plain (not hashed) salt bytes are to * be appended after the digest operation result bytes. The default behaviour is * to insert them before the digest result, 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 plain salt before digest result) will be applied. * </p> * * @since 1.7 * * @param invertPositionOfPlainSaltInEncryptionResults * whether plain salt will be appended after the digest operation * result instead of inserted before it (which is the * default). */ public synchronized void setInvertPositionOfPlainSaltInEncryptionResults( final boolean invertPositionOfPlainSaltInEncryptionResults) { this.firstDigester.setInvertPositionOfPlainSaltInEncryptionResults(invertPositionOfPlainSaltInEncryptionResults); }
/** * <p> * Whether the plain (not hashed) salt bytes are to * be appended after the digest operation result bytes. The default behaviour is * to insert them before the digest result, 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 plain salt before digest result) will be applied. * </p> * * @since 1.7 * * @param invertPositionOfPlainSaltInEncryptionResults * whether plain salt will be appended after the digest operation * result instead of inserted before it (which is the * default). */ public synchronized void setInvertPositionOfPlainSaltInEncryptionResults( final boolean invertPositionOfPlainSaltInEncryptionResults) { this.firstDigester.setInvertPositionOfPlainSaltInEncryptionResults(invertPositionOfPlainSaltInEncryptionResults); }
/** * 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); }
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 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); }
/** * 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); }
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; } }