Package org.jasypt.digest

Examples of org.jasypt.digest.StandardStringDigester


            final String digestedPassword) {

        boolean authenticated = super.authenticate(password, cipherAlgorithm, digestedPassword);
        // if "normal" authentication fails and cipher is SMD5, we're probably handling an "old" MD5 password
        if (!authenticated && CipherAlgorithm.SMD5 == cipherAlgorithm) {
            StandardStringDigester digester = new StandardStringDigester();
            digester.setAlgorithm("MD5");
            digester.setIterations(1);
            digester.setSaltSizeBytes(0);
            digester.setStringOutputType(CommonUtils.STRING_OUTPUT_TYPE_HEXADECIMAL);

            authenticated = digester.matches(password, digestedPassword);
        }
        return authenticated;
    }
View Full Code Here


        return password;
    }

    private static StandardStringDigester getDigester(final CipherAlgorithm cipherAlgorithm) {
        StandardStringDigester digester = new StandardStringDigester();

        if (cipherAlgorithm.getAlgorithm().startsWith("S-")) {
            // Salted ...
            digester.setAlgorithm(cipherAlgorithm.getAlgorithm().replaceFirst("S\\-", ""));
            digester.setIterations(100000);
            digester.setSaltSizeBytes(16);
        } else {
            // Not salted ...
            digester.setAlgorithm(cipherAlgorithm.getAlgorithm());
            digester.setIterations(1);
            digester.setSaltSizeBytes(0);
        }

        digester.setStringOutputType(CommonUtils.STRING_OUTPUT_TYPE_HEXADECIMAL);
        return digester;
    }
View Full Code Here

public class SignupUtils {
  public static String generateEmailConfirmHash(User user)
  {
    //FIXME: This should really use its own salt, but this is sufficient for now, since the encrypted password uses a salt
    StandardStringDigester digestor = new StandardStringDigester();
    return digestor.digest(user.getName() + user.getPasswordEncrypted())
  }
View Full Code Here

    return digestor.digest(user.getName() + user.getPasswordEncrypted())
  }
 
  public static boolean checkEmailHash(User user, String hash)
  {
    StandardStringDigester digestor = new StandardStringDigester();
    return digestor.matches(user.getName() + user.getPasswordEncrypted(), hash)
  }
View Full Code Here

        return password;
    }

    private static StandardStringDigester getDigester(final CipherAlgorithm cipherAlgorithm) {
        StandardStringDigester digester = new StandardStringDigester();

        if (cipherAlgorithm.getAlgorithm().startsWith("S-")) {
            // Salted ...
            digester.setAlgorithm(cipherAlgorithm.getAlgorithm().replaceFirst("S\\-", ""));
            digester.setIterations(100000);
            digester.setSaltSizeBytes(16);
        } else {
            // Not salted ...
            digester.setAlgorithm(cipherAlgorithm.getAlgorithm());
            digester.setIterations(1);
            digester.setSaltSizeBytes(0);
        }

        digester.setStringOutputType(CommonUtils.STRING_OUTPUT_TYPE_HEXADECIMAL);
        return digester;
    }
View Full Code Here

    // Display it
    String str = String.valueOf(Hex.encodeHex(digest));
    System.out.printf("testDigesters : Byte digest '%s'\n", str);
    /* STRING Digester */
    // Create a String digester
    StandardStringDigester stringDigester = new StandardStringDigester();
    // Configure it
    stringDigester.setAlgorithm("SHA-512");
    stringDigester.setSaltSizeBytes(128);
    // Generate a digest
    str = stringDigester.digest(TEXT_TO_ENCRYPT);
    // Display it
    System.out.printf("testDigesters : String digest '%s'\n", str);
  }
View Full Code Here

        if (stringOutputType != null) {
            config.setStringOutputType(stringOutputType);
        }
       
       
        StandardStringDigester digester = new StandardStringDigester();
        digester.setConfig(config);
       
        return digester.digest(input);
       
    }
View Full Code Here

     * 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();
    }
View Full Code Here

     * Creates a new instance of <tt>BasicPasswordEncryptor</tt>
     *
     */
    public BasicPasswordEncryptor() {
        super();
        this.digester = new StandardStringDigester();
        this.digester.initialize();
    }
View Full Code Here

     * Creates a new instance of <tt>ConfigurablePasswordEncryptor</tt>
     *
     */
    public ConfigurablePasswordEncryptor() {
        super();
        this.digester = new StandardStringDigester();
    }
View Full Code Here

TOP

Related Classes of org.jasypt.digest.StandardStringDigester

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.