Package org.jasypt.util.password

Examples of org.jasypt.util.password.StrongPasswordEncryptor.encryptPassword()


  public void testPasswordEncryptionUsingStrongEncryptor() throws Exception {
    // Declare a strong encryptor
    StrongPasswordEncryptor pe = new StrongPasswordEncryptor();
    // "Encrypt password", is not an real encryption because "Encryptor"
    // generate a digest. by default the SHA-256 algorithm is used
    String encryptedPassword = pe.encryptPassword(TEXT_TO_ENCRYPT);
    System.out.printf("testPasswordEncryptionUsingStrongEncryptor : '%s' become '%s'\n", TEXT_TO_ENCRYPT, encryptedPassword);
    // Valid "encrypted" password
    Assert.assertTrue(pe.checkPassword(TEXT_TO_ENCRYPT, encryptedPassword));
  }
View Full Code Here


     * @param args command line arguments.
     */
    public static void main(final String[] args) {
        final StrongPasswordEncryptor bpe = new StrongPasswordEncryptor();

        logger.debug(bpe.encryptPassword("cry30"));
        final String passw1 = "cry3011111111111111111111111111111111111111111111111111111111"; // NOPMD by r39 on 3/30/11 1:29 PM
        final String passw2 = "cry301"; // NOPMD by r39 on 3/30/11 1:28 PM

        final String encrypted1 = bpe.encryptPassword(passw1);
        final String encrypted2 = bpe.encryptPassword(passw2);
View Full Code Here

        logger.debug(bpe.encryptPassword("cry30"));
        final String passw1 = "cry3011111111111111111111111111111111111111111111111111111111"; // NOPMD by r39 on 3/30/11 1:29 PM
        final String passw2 = "cry301"; // NOPMD by r39 on 3/30/11 1:28 PM

        final String encrypted1 = bpe.encryptPassword(passw1);
        final String encrypted2 = bpe.encryptPassword(passw2);

        logger.debug(bpe.checkPassword(passw1, encrypted1));
        logger.debug(bpe.checkPassword(passw1, encrypted2));
        logger.debug(bpe.checkPassword(passw2, encrypted1));
View Full Code Here

        logger.debug(bpe.encryptPassword("cry30"));
        final String passw1 = "cry3011111111111111111111111111111111111111111111111111111111"; // NOPMD by r39 on 3/30/11 1:29 PM
        final String passw2 = "cry301"; // NOPMD by r39 on 3/30/11 1:28 PM

        final String encrypted1 = bpe.encryptPassword(passw1);
        final String encrypted2 = bpe.encryptPassword(passw2);

        logger.debug(bpe.checkPassword(passw1, encrypted1));
        logger.debug(bpe.checkPassword(passw1, encrypted2));
        logger.debug(bpe.checkPassword(passw2, encrypted1));
        logger.debug(bpe.checkPassword(passw2, encrypted2));
View Full Code Here

  public void changePassword(Request request, Response response) throws JSONException {
    JSONObject jsonPassword = new JSONObject( request.getBody().asString() );

    StrongPasswordEncryptor passwordEncryptor = new StrongPasswordEncryptor();
    String newPassword = passwordEncryptor.encryptPassword( jsonPassword.getString("password") );

    adminPasswordStore.setPassword( newPassword );
  }

  public void setAdminPasswordStore(AdminPasswordStore adminPasswordStore) {
View Full Code Here

     * @param password password
     * @return password encrypt
     */
    public static final String encryptPassworD(final String password) {
        final StrongPasswordEncryptor passwordEncryptor = new StrongPasswordEncryptor();
        return passwordEncryptor.encryptPassword(password);
    }


    /**
     * Check if password is correct.
View Full Code Here

     * @param password password
     * @return
     */
    private String encodingPassword(final String password){
        final StrongPasswordEncryptor passwordEncryptor = new StrongPasswordEncryptor();
        return  passwordEncryptor.encryptPassword(password);
    }

    /**
     * Load domain permission.
     * @param permission permission
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.