Java Code Examples for org.jasypt.digest.StringDigester

The following examples show how to use org.jasypt.digest.StringDigester. 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: DigesterFactoryBean.java    License: Apache License 2.0 5 votes vote down vote up
public Class<?> getObjectType() {
    if (this.digesterType == DIGESTER_TYPE_BYTE) {
        return ByteDigester.class;
    } else if (this.digesterType == DIGESTER_TYPE_STRING) {
        return StringDigester.class;
    } else {
        throw new IllegalArgumentException("Unknown digester type: " + this.digesterType);
    }
}
 
Example 2
Source Project: jasypt   Source File: DigesterFactoryBean.java    License: Apache License 2.0 5 votes vote down vote up
public Class<?> getObjectType() {
    if (this.digesterType == DIGESTER_TYPE_BYTE) {
        return ByteDigester.class;
    } else if (this.digesterType == DIGESTER_TYPE_STRING) {
        return StringDigester.class;
    } else {
        throw new IllegalArgumentException("Unknown digester type: " + this.digesterType);
    }
}
 
Example 3
Source Project: jasypt   Source File: DigesterFactoryBean.java    License: Apache License 2.0 5 votes vote down vote up
public Class<?> getObjectType() {
    if (this.digesterType == DIGESTER_TYPE_BYTE) {
        return ByteDigester.class;
    } else if (this.digesterType == DIGESTER_TYPE_STRING) {
        return StringDigester.class;
    } else {
        throw new IllegalArgumentException("Unknown digester type: " + this.digesterType);
    }
}
 
Example 4
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 5
Source Project: jasypt   Source File: TokenBasedRememberMeServices.java    License: Apache License 2.0 4 votes vote down vote up
public void setDigester(final StringDigester digester) {
    this.digester = digester;
}
 
Example 6
Source Project: jasypt   Source File: TokenBasedRememberMeServices.java    License: Apache License 2.0 4 votes vote down vote up
public void setDigester(final StringDigester digester) {
    this.digester = digester;
}
 
Example 7
Source Project: jasypt   Source File: TokenBasedRememberMeServices.java    License: Apache License 2.0 4 votes vote down vote up
public void setDigester(final StringDigester digester) {
    this.digester = digester;
}
 
Example 8
Source Project: nextreports-server   Source File: DefaultSecurityService.java    License: Apache License 2.0 4 votes vote down vote up
public void setSimpleDigester(StringDigester simpleDigester) {
	this.simpleDigester = simpleDigester;
}
 
Example 9
Source Project: jasypt   Source File: PasswordEncoder.java    License: Apache License 2.0 2 votes vote down vote up
/**
 * Sets a string digester to be used. Only one of 
 * <tt>setPasswordEncryptor</tt> or <tt>setStringDigester</tt> should be
 * called. If both are, the last call will define which method will be
 * used.
 * 
 * @param stringDigester the string digester instance to be used.
 */
public void setStringDigester(final StringDigester stringDigester) {
    this.stringDigester = stringDigester;
    this.useEncryptor = Boolean.FALSE;
}
 
Example 10
Source Project: jasypt   Source File: PasswordEncoder.java    License: Apache License 2.0 2 votes vote down vote up
/**
 * Sets a string digester to be used. Only one of 
 * <tt>setPasswordEncryptor</tt> or <tt>setStringDigester</tt> should be
 * called. If both are, the last call will define which method will be
 * used.
 * 
 * @param stringDigester the string digester instance to be used.
 */
public void setStringDigester(final StringDigester stringDigester) {
    this.stringDigester = stringDigester;
    this.useEncryptor = Boolean.FALSE;
}
 
Example 11
Source Project: jasypt   Source File: PasswordEncoder.java    License: Apache License 2.0 2 votes vote down vote up
/**
 * Sets a string digester to be used. Only one of 
 * <tt>setPasswordEncryptor</tt> or <tt>setStringDigester</tt> should be
 * called. If both are, the last call will define which method will be
 * used.
 * 
 * @param stringDigester the string digester instance to be used.
 */
public void setStringDigester(final StringDigester stringDigester) {
    this.stringDigester = stringDigester;
    this.useEncryptor = Boolean.FALSE;
}
 
Example 12
Source Project: jasypt   Source File: PasswordEncoder.java    License: Apache License 2.0 2 votes vote down vote up
/**
 * Sets a string digester to be used. Only one of 
 * <tt>setPasswordEncryptor</tt> or <tt>setStringDigester</tt> should be
 * called. If both are, the last call will define which method will be
 * used.
 * 
 * @param stringDigester the string digester instance to be used.
 */
public void setStringDigester(final StringDigester stringDigester) {
    this.stringDigester = stringDigester;
    this.useEncryptor = Boolean.FALSE;
}
 
Example 13
Source Project: jasypt   Source File: PasswordEncoder.java    License: Apache License 2.0 2 votes vote down vote up
/**
 * Sets a string digester to be used. Only one of 
 * <tt>setPasswordEncryptor</tt> or <tt>setStringDigester</tt> should be
 * called. If both are, the last call will define which method will be
 * used.
 * 
 * @param stringDigester the string digester instance to be used.
 */
public void setStringDigester(final StringDigester stringDigester) {
    this.stringDigester = stringDigester;
    this.useEncryptor = Boolean.FALSE;
}
 
Example 14
Source Project: jasypt   Source File: PasswordEncoder.java    License: Apache License 2.0 2 votes vote down vote up
/**
 * Sets a string digester to be used. Only one of 
 * <tt>setPasswordEncryptor</tt> or <tt>setStringDigester</tt> should be
 * called. If both are, the last call will define which method will be
 * used.
 * 
 * @param stringDigester the string digester instance to be used.
 */
public void setStringDigester(final StringDigester stringDigester) {
    this.stringDigester = stringDigester;
    this.useEncryptor = Boolean.FALSE;
}
 
Example 15
Source Project: jasypt   Source File: PasswordEncoder.java    License: Apache License 2.0 2 votes vote down vote up
/**
 * Sets a string digester to be used. Only one of 
 * <tt>setPasswordEncryptor</tt> or <tt>setStringDigester</tt> should be
 * called. If both are, the last call will define which method will be
 * used.
 * 
 * @param stringDigester the string digester instance to be used.
 */
public void setStringDigester(final StringDigester stringDigester) {
    this.stringDigester = stringDigester;
    this.useEncryptor = Boolean.FALSE;
}