Java Code Examples for org.jasypt.digest.StandardStringDigester

The following examples show how to use org.jasypt.digest.StandardStringDigester. These examples are extracted from open source projects. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source Project: jasypt   Source File: StrongPasswordEncryptor.java    License: Apache License 2.0 5 votes vote down vote up
/**
 * 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();
}
 
Example 2
Source Project: jasypt   Source File: RFC2307SMD5PasswordEncryptor.java    License: Apache License 2.0 5 votes vote down vote up
/**
 * 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);
}
 
Example 3
Source Project: jasypt   Source File: RFC2307SSHAPasswordEncryptor.java    License: Apache License 2.0 5 votes vote down vote up
/**
 * 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);
}
 
Example 4
Source Project: jasypt   Source File: RFC2307SHAPasswordEncryptor.java    License: Apache License 2.0 5 votes vote down vote up
/**
 * 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}");
}
 
Example 5
Source Project: jasypt   Source File: RFC2307MD5PasswordEncryptor.java    License: Apache License 2.0 5 votes vote down vote up
/**
 * 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}");
}
 
Example 6
Source Project: bearchoke   Source File: EncryptionConfig.java    License: Apache License 2.0 5 votes vote down vote up
@Bean
public StandardStringDigester standardStringDigester() {
    StandardStringDigester ssd = new StandardStringDigester();
    ssd.setConfig(environmentStringDigesterConfig());

    return ssd;
}
 
Example 7
Source Project: jasypt   Source File: TestSpringConfiguration.java    License: Apache License 2.0 4 votes vote down vote up
public void testNamespace() throws Exception {
    
    StandardPBEByteEncryptor standardPBEByteEncryptor = 
           new StandardPBEByteEncryptor();
    standardPBEByteEncryptor.setPassword("jasypt");
    standardPBEByteEncryptor.setAlgorithm("PBEWithMD5AndDES");
       
    ByteEncryptor byteEncryptor = 
           (ByteEncryptor) ctx.getBean(BYTE_ENCRYPTOR_BEAN_NAME);
       assertTrue(ArrayUtils.isEquals(new byte[] {5, 7, 13}, 
               standardPBEByteEncryptor.decrypt(byteEncryptor.encrypt(new byte[] {5, 7, 13}))));
       
       
       
       
    StandardPBEStringEncryptor standardPBEStringEncryptor = 
           new StandardPBEStringEncryptor();
       standardPBEStringEncryptor.setPassword("jasypt");
       standardPBEStringEncryptor.setAlgorithm("PBEWithMD5AndDES");
       standardPBEStringEncryptor.setStringOutputType("hexadecimal");
       
    StringEncryptor stringEncryptor = 
           (StringEncryptor) ctx.getBean(STRING_ENCRYPTOR_BEAN_NAME);
       assertEquals("jasypt", 
               standardPBEStringEncryptor.decrypt(stringEncryptor.encrypt("jasypt")));
       
    
       
       StandardStringDigester standardStringDigester = 
           new StandardStringDigester();
       standardStringDigester.setAlgorithm("SHA-1");
       standardStringDigester.setStringOutputType("hexa");
       
       StringDigester stringDigester = 
           (StringDigester) ctx.getBean(STRING_DIGESTER_BEAN_NAME);
       assertTrue(stringDigester.matches("jasypt", 
               standardStringDigester.digest("jasypt")));
       assertTrue(standardStringDigester.matches("jasypt", 
               stringDigester.digest("jasypt")));
       
}
 
Example 8
Source Project: jasypt   Source File: ConfigurablePasswordEncryptor.java    License: Apache License 2.0 4 votes vote down vote up
/**
 * Creates a new instance of <tt>ConfigurablePasswordEncryptor</tt>
 *
 */
public ConfigurablePasswordEncryptor() {
    super();
    this.digester = new StandardStringDigester();
}
 
Example 9
Source Project: jasypt   Source File: BasicPasswordEncryptor.java    License: Apache License 2.0 4 votes vote down vote up
/**
 * Creates a new instance of <tt>BasicPasswordEncryptor</tt>
 *
 */
public BasicPasswordEncryptor() {
    super();
    this.digester = new StandardStringDigester();
    this.digester.initialize();
}
 
Example 10
Source Project: Spring-MVC-Blueprints   Source File: CartPasswordEncoder.java    License: MIT License 4 votes vote down vote up
public CartPasswordEncoder(){
	digester = new StandardStringDigester();
}