Package org.jasypt.util.password

Examples of org.jasypt.util.password.ConfigurablePasswordEncryptor


                config.setSaltGeneratorClassName(params.get(key));
            } else {
                throw new IllegalArgumentException("Unsupported encryption parameter: " + key);
            }
        }
        this.passwordEncryptor = new ConfigurablePasswordEncryptor();
        this.passwordEncryptor.setConfig(config);
        try {
            this.passwordEncryptor.encryptPassword("test");
        } catch (EncryptionInitializationException e) {
            throw new IllegalArgumentException(e);
View Full Code Here


                config.setSaltGeneratorClassName(params.get(key));
            } else {
                throw new IllegalArgumentException("Unsupported encryption parameter: " + key);
            }
        }
        this.passwordEncryptor = new ConfigurablePasswordEncryptor();
        this.passwordEncryptor.setConfig(config);
        try {
            this.passwordEncryptor.encryptPassword("test");
        } catch (EncryptionInitializationException e) {
            throw new IllegalArgumentException(e);
View Full Code Here

   * @throws java.lang.Exception
   */
  @Test
  public void testPasswordEncryptionUsingConfigurableEncryptor() throws Exception {
    // Declare a configurable encryptor
    ConfigurablePasswordEncryptor pe = new ConfigurablePasswordEncryptor();
    // Configure it
    pe.setAlgorithm("SHA-512");
    pe.setPlainDigest(false);
    pe.setStringOutputType("base64");
    // "Encrypt password", is not an real encryption because "Encryptor"
    // generate a digest
    String encryptedPassword = pe.encryptPassword(TEXT_TO_ENCRYPT);
    System.out.printf("testPasswordEncryptionUsingConfigurableEncryptor : '%s' become '%s'\n", TEXT_TO_ENCRYPT, encryptedPassword);
    // Valid "encrypted" password
    Assert.assertTrue(pe.checkPassword(TEXT_TO_ENCRYPT, encryptedPassword));
  }
View Full Code Here

                config.setSaltGeneratorClassName(params.get(key));
            } else {
                throw new IllegalArgumentException("Unsupported encryption parameter: " + key);
            }
        }
        this.passwordEncryptor = new ConfigurablePasswordEncryptor();
        this.passwordEncryptor.setConfig(config);
        try {
            this.passwordEncryptor.encryptPassword("test");
        } catch (EncryptionInitializationException e) {
            throw new IllegalArgumentException(e);
View Full Code Here

        /*
         * Create an MD5 password encryptor that uses an 8-byte salt with one
         * hash iteration.  This encryptor should be  capable of validating
         * legacy uPortal passwords.
         */
        md5Encryptor = new ConfigurablePasswordEncryptor();
        SimpleDigesterConfig md5Config = new SimpleDigesterConfig();
        md5Config.setIterations(1);
        md5Config.setAlgorithm("MD5");
        md5Config.setSaltSizeBytes(8);
        md5Encryptor.setConfig(md5Config);
       
        /*
         * Create a stronger SHA-256 password encryptor for setting and
         * validating new passwords.
         */
        sha256Encryptor = new ConfigurablePasswordEncryptor();
        SimpleDigesterConfig shaConfig = new SimpleDigesterConfig();
        shaConfig.setIterations(1000);
        shaConfig.setAlgorithm("SHA-256");
        shaConfig.setSaltSizeBytes(8);
        sha256Encryptor.setConfig(shaConfig);
View Full Code Here

        /*
         * Create an MD5 password encryptor that uses an 8-byte salt with one
         * hash iteration.  This encryptor should be  capable of validating
         * legacy uPortal passwords.
         */
        md5Encryptor = new ConfigurablePasswordEncryptor();
        SimpleDigesterConfig md5Config = new SimpleDigesterConfig();
        md5Config.setIterations(1);
        md5Config.setAlgorithm("MD5");
        md5Config.setSaltSizeBytes(8);
        md5Encryptor.setConfig(md5Config);
       
        /*
         * Create a stronger SHA-256 password encryptor for setting and
         * validating new passwords.
         */
        sha256Encryptor = new ConfigurablePasswordEncryptor();
        SimpleDigesterConfig shaConfig = new SimpleDigesterConfig();
        shaConfig.setIterations(1000);
        shaConfig.setAlgorithm("SHA-256");
        shaConfig.setSaltSizeBytes(8);
        sha256Encryptor.setConfig(shaConfig);
View Full Code Here

        // long start = System.currentTimeMillis();
       
    //if(app.logintest(user, pass)==null){
     
      // fail.. so see if was a plain text password
        ConfigurablePasswordEncryptor passwordEncryptor = new ConfigurablePasswordEncryptor();
      passwordEncryptor.setAlgorithm("SHA-1");
      passwordEncryptor.setPlainDigest(true);
      String encryptedPassword = (passwordEncryptor
          .encryptPassword(user + settings.readSetting("salt") + pass)).trim();
     
      if(app.logintest(user, encryptedPassword)==null){
//        Util.debug("login failure, took " + (System.currentTimeMillis() - start) + " ms", this);
        return false;
View Full Code Here

        if(ADMIN_ONLY) if( ! user.equals(settings.readSetting("user0"))) shutDown("must be admin user for telnet");
             
        // try salted
        if(app.logintest(user, pass)==null){
         
            ConfigurablePasswordEncryptor passwordEncryptor = new ConfigurablePasswordEncryptor();
          passwordEncryptor.setAlgorithm("SHA-1");
          passwordEncryptor.setPlainDigest(true);
          String encryptedPassword = (passwordEncryptor
              .encryptPassword(user + settings.readSetting("salt") + pass)).trim();
         
          // try plain text
          if(app.logintest(user, encryptedPassword)==null)
            shutDown("login failure: " + user);
View Full Code Here

TOP

Related Classes of org.jasypt.util.password.ConfigurablePasswordEncryptor

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.