Package org.jasypt.encryption.pbe

Examples of org.jasypt.encryption.pbe.StandardPBEStringEncryptor


    }

    final File dbPropsFile = PropertiesUtil.findConfigFile("db.properties");
    final Properties dbProps;
    EncryptionSecretKeyChanger keyChanger = new EncryptionSecretKeyChanger();
    StandardPBEStringEncryptor encryptor = new StandardPBEStringEncryptor();
    keyChanger.initEncryptor(encryptor, oldMSKey);
    dbProps = new EncryptableProperties(encryptor);
    PropertiesConfiguration backupDBProps = null;

    System.out.println("Parsing db.properties file");
View Full Code Here


    }
  }
 
  private boolean migrateProperties(File dbPropsFile, Properties dbProps, String newMSKey, String newDBKey){
    System.out.println("Migrating db.properties..");
    StandardPBEStringEncryptor msEncryptor = new StandardPBEStringEncryptor();;
    initEncryptor(msEncryptor, newMSKey);
   
    try {
      PropertiesConfiguration newDBProps = new PropertiesConfiguration(dbPropsFile);
      if(newDBKey!=null && !newDBKey.isEmpty()){
        newDBProps.setProperty("db.cloud.encrypt.secret", "ENC("+msEncryptor.encrypt(newDBKey)+")");
      }
      String prop = dbProps.getProperty("db.cloud.password");
      if(prop!=null && !prop.isEmpty()){
        newDBProps.setProperty("db.cloud.password", "ENC("+msEncryptor.encrypt(prop)+")");
      }
      prop = dbProps.getProperty("db.usage.password");
      if(prop!=null && !prop.isEmpty()){
        newDBProps.setProperty("db.usage.password", "ENC("+msEncryptor.encrypt(prop)+")");
      }
      newDBProps.save(dbPropsFile.getAbsolutePath());
    } catch (Exception e) {    
      e.printStackTrace();
      return false;
View Full Code Here

        }

        final File dbPropsFile = PropertiesUtil.findConfigFile("db.properties");
        final Properties dbProps;
        EncryptionSecretKeyChanger keyChanger = new EncryptionSecretKeyChanger();
        StandardPBEStringEncryptor encryptor = new StandardPBEStringEncryptor();
        keyChanger.initEncryptor(encryptor, oldMSKey);
        dbProps = new EncryptableProperties(encryptor);
        PropertiesConfiguration backupDBProps = null;

        System.out.println("Parsing db.properties file");
View Full Code Here

        }
    }

    private boolean migrateProperties(File dbPropsFile, Properties dbProps, String newMSKey, String newDBKey) {
        System.out.println("Migrating db.properties..");
        StandardPBEStringEncryptor msEncryptor = new StandardPBEStringEncryptor();
        ;
        initEncryptor(msEncryptor, newMSKey);

        try {
            PropertiesConfiguration newDBProps = new PropertiesConfiguration(dbPropsFile);
            if (newDBKey != null && !newDBKey.isEmpty()) {
                newDBProps.setProperty("db.cloud.encrypt.secret", "ENC(" + msEncryptor.encrypt(newDBKey) + ")");
            }
            String prop = dbProps.getProperty("db.cloud.password");
            if (prop != null && !prop.isEmpty()) {
                newDBProps.setProperty("db.cloud.password", "ENC(" + msEncryptor.encrypt(prop) + ")");
            }
            prop = dbProps.getProperty("db.usage.password");
            if (prop != null && !prop.isEmpty()) {
                newDBProps.setProperty("db.usage.password", "ENC(" + msEncryptor.encrypt(prop) + ")");
            }
            newDBProps.save(dbPropsFile.getAbsolutePath());
        } catch (Exception e) {
            e.printStackTrace();
            return false;
View Full Code Here

    }

    final File dbPropsFile = PropertiesUtil.findConfigFile("db.properties");
    final Properties dbProps;
    EncryptionSecretKeyChanger keyChanger = new EncryptionSecretKeyChanger();
    StandardPBEStringEncryptor encryptor = new StandardPBEStringEncryptor();
    keyChanger.initEncryptor(encryptor, oldMSKey);
    dbProps = new EncryptableProperties(encryptor);
    PropertiesConfiguration backupDBProps = null;

    System.out.println("Parsing db.properties file");
View Full Code Here

    }
  }
 
  private boolean migrateProperties(File dbPropsFile, Properties dbProps, String newMSKey, String newDBKey){
    System.out.println("Migrating db.properties..");
    StandardPBEStringEncryptor msEncryptor = new StandardPBEStringEncryptor();;
    initEncryptor(msEncryptor, newMSKey);
   
    try {
      PropertiesConfiguration newDBProps = new PropertiesConfiguration(dbPropsFile);
      if(newDBKey!=null && !newDBKey.isEmpty()){
        newDBProps.setProperty("db.cloud.encrypt.secret", "ENC("+msEncryptor.encrypt(newDBKey)+")");
      }
      String prop = dbProps.getProperty("db.cloud.password");
      if(prop!=null && !prop.isEmpty()){
        newDBProps.setProperty("db.cloud.password", "ENC("+msEncryptor.encrypt(prop)+")");
      }
      prop = dbProps.getProperty("db.usage.password");
      if(prop!=null && !prop.isEmpty()){
        newDBProps.setProperty("db.usage.password", "ENC("+msEncryptor.encrypt(prop)+")");
      }
      newDBProps.save(dbPropsFile.getAbsolutePath());
    } catch (Exception e) {    
      e.printStackTrace();
      return false;
View Full Code Here

            sc.setParameters("apiKey", accessKey);
            user =  findOneBy(sc);
            if ( user != null && user.getSecretKey() != null) {
                // if the cloud db is encrypted, decrypt the secret_key returned by cloud db before signature generation
                if( EncryptionSecretKeyCheckerUtil.useEncryption() ) {
                    StandardPBEStringEncryptor encryptor = EncryptionSecretKeyCheckerUtil.getEncryptor();
                    cloudSecretKey = encryptor.decrypt( user.getSecretKey() );
                } else {
                    cloudSecretKey = user.getSecretKey();
                }
            }
            return cloudSecretKey;
View Full Code Here

        EnvironmentPBEConfig config = new EnvironmentPBEConfig();
        config.setAlgorithm("PBEWithMD5AndDES");
        config.setPasswordEnvName("MY_APP_PASSWORD");

        StandardPBEStringEncryptor encryptor = new StandardPBEStringEncryptor();
        encryptor.setConfig(config);

        Properties props = new EncryptableProperties(encryptor);
        URL url = JasyptTest.class.getClassLoader().getResource("secret.conf");

        props.load(new FileInputStream(url.getFile()));
View Full Code Here

    /**
     * Creates a new instance of <tt>BasicTextEncryptor</tt>.
     */
    public BasicTextEncryptor() {
        super();
        this.encryptor = new StandardPBEStringEncryptor();
        this.encryptor.setAlgorithm("PBEWithMD5AndDES");
    }
View Full Code Here

    /**
     * Creates a new instance of <tt>StrongTextEncryptor</tt>.
     */
    public StrongTextEncryptor() {
        super();
        this.encryptor = new StandardPBEStringEncryptor();
        this.encryptor.setAlgorithm("PBEWithMD5AndTripleDES");
    }
View Full Code Here

TOP

Related Classes of org.jasypt.encryption.pbe.StandardPBEStringEncryptor

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.