org.jasypt.digest.StandardStringDigester Java Examples

The following examples show how to use org.jasypt.digest.StandardStringDigester. 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 File: StrongPasswordEncryptor.java    From jasypt with 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 File: RFC2307SMD5PasswordEncryptor.java    From jasypt with 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 File: RFC2307SSHAPasswordEncryptor.java    From jasypt with 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 File: RFC2307SHAPasswordEncryptor.java    From jasypt with 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 File: RFC2307MD5PasswordEncryptor.java    From jasypt with 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 File: EncryptionConfig.java    From bearchoke with 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 File: TestSpringConfiguration.java    From jasypt with 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 File: ConfigurablePasswordEncryptor.java    From jasypt with 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 File: BasicPasswordEncryptor.java    From jasypt with 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 File: CartPasswordEncoder.java    From Spring-MVC-Blueprints with MIT License 4 votes vote down vote up
public CartPasswordEncoder(){
	digester = new StandardStringDigester();
}