org.jasypt.digest.StringDigester Java Examples

The following examples show how to use org.jasypt.digest.StringDigester. 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: DigesterFactoryBean.java    From jasypt with 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 File: DigesterFactoryBean.java    From jasypt with 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 File: DigesterFactoryBean.java    From jasypt with 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 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 #5
Source File: TokenBasedRememberMeServices.java    From jasypt with Apache License 2.0 4 votes vote down vote up
public void setDigester(final StringDigester digester) {
    this.digester = digester;
}
 
Example #6
Source File: TokenBasedRememberMeServices.java    From jasypt with Apache License 2.0 4 votes vote down vote up
public void setDigester(final StringDigester digester) {
    this.digester = digester;
}
 
Example #7
Source File: TokenBasedRememberMeServices.java    From jasypt with Apache License 2.0 4 votes vote down vote up
public void setDigester(final StringDigester digester) {
    this.digester = digester;
}
 
Example #8
Source File: DefaultSecurityService.java    From nextreports-server with Apache License 2.0 4 votes vote down vote up
public void setSimpleDigester(StringDigester simpleDigester) {
	this.simpleDigester = simpleDigester;
}
 
Example #9
Source File: PasswordEncoder.java    From jasypt with 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 File: PasswordEncoder.java    From jasypt with 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 File: PasswordEncoder.java    From jasypt with 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 File: PasswordEncoder.java    From jasypt with 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 File: PasswordEncoder.java    From jasypt with 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 File: PasswordEncoder.java    From jasypt with 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 File: PasswordEncoder.java    From jasypt with 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;
}