Package org.jasypt.encryption.pbe

Examples of org.jasypt.encryption.pbe.StandardPBEStringEncryptor.encrypt()


        StandardPBEStringEncryptor enc = new StandardPBEStringEncryptor();
        EnvironmentStringPBEConfig env = new EnvironmentStringPBEConfig();
        env.setAlgorithm("PBEWithMD5AndDES");
        env.setPassword("password");
        enc.setConfig(env);
        String val = enc.encrypt("bar");
        System.setProperty("foo", val);

        System.setProperty("org.bundles.framework.storage", "target/bundles/" + System.currentTimeMillis());
        System.setProperty("karaf.name", "root");
View Full Code Here


    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)+")");
      }
View Full Code Here

      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)+")");
      }
View Full Code Here

      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

   */
  public static String encryptString(String plaintext, String password) {

    StandardPBEStringEncryptor encryptor = initCypher();
    encryptor.setPassword(password);
    String output = encryptor.encrypt(plaintext);
    return output;
  }

  /**
   * Inits the cypher, using the our CRYPTO_ALGORITM.
View Full Code Here

        StandardPBEStringEncryptor enc = new StandardPBEStringEncryptor();
        EnvironmentStringPBEConfig env = new EnvironmentStringPBEConfig();
        env.setAlgorithm("PBEWithMD5AndDES");
        env.setPassword("password");
        enc.setConfig(env);
        String val = enc.encrypt("bar");
        System.setProperty("foo", val);

        System.setProperty("org.osgi.framework.storage", "target/osgi/" + System.currentTimeMillis());
        System.setProperty("karaf.name", "root");
View Full Code Here

      // by "ENC()" the EncryptableProperties object assume that the value isn't
      // encrypted and read it as is...
      Properties properties = new EncryptableProperties(encryptor);
      // Fill properties container
      // --Encrypt value
      String encryptedValue = encryptor.encrypt(TEXT_TO_ENCRYPT);
      // --Add value to the properties container
      properties.setProperty("PASSWORD", "ENC(" + encryptedValue + ")");
      // --Add a non encrypted propety
      properties.setProperty("LOGIN", "MY_LOGIN");
      // Save properties to a file
View Full Code Here

      throws SysCryptoException {
    logger.debug("entering encryptString");
    try {
      StandardPBEStringEncryptor encryptor = initCypher();
      encryptor.setPassword(password);
      String output = encryptor.encrypt(plaintext);

      logger.debug("exiting encryptString");
      return output;

    } catch (EncryptionOperationNotPossibleException ex) {
View Full Code Here

    String encryptedPassword = null;
    StandardPBEStringEncryptor encryptor = new StandardPBEStringEncryptor();
    if (TYPE_ENCRYP.PBES.equals(type)) {
      // Encrypt
      encryptor.setPassword(SEED_PBES);
      encryptedPassword = encryptor.encrypt(text);
    } else if (TYPE_ENCRYP.BC.equals(type)) {
      encryptor.setProvider(new BouncyCastleProvider());
      encryptor.setPassword(SEED_BC);
      encryptor.setAlgorithm("PBEWITHSHA256AND128BITAES-CBC-BC");
      encryptedPassword = encryptor.encrypt(text);
View Full Code Here

      encryptedPassword = encryptor.encrypt(text);
    } else if (TYPE_ENCRYP.BC.equals(type)) {
      encryptor.setProvider(new BouncyCastleProvider());
      encryptor.setPassword(SEED_BC);
      encryptor.setAlgorithm("PBEWITHSHA256AND128BITAES-CBC-BC");
      encryptedPassword = encryptor.encrypt(text);
    } else {
      throw new EncryptDecryptUtilException(
          "Error can not determine the type of encryption algorithm to use");
    }
    LOG.info("Encryption done and encrypted password is : "
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.