Package org.jasypt.properties

Examples of org.jasypt.properties.EncryptableProperties


    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");
    try {
      dbProps.load(new FileInputStream(dbPropsFile));
View Full Code Here


        try {
            File dbPropsFile = PropertiesUtil.findConfigFile(propsFileName);
            final Properties dbProps;
            if (EncryptionSecretKeyChecker.useEncryption()) {
                StandardPBEStringEncryptor encryptor = EncryptionSecretKeyChecker.getEncryptor();
                dbProps = new EncryptableProperties(encryptor);
            } else {
                dbProps = new Properties();
            }
            try {
                dbProps.load(new FileInputStream(dbPropsFile));
View Full Code Here

      final File dbPropsFile = PropertiesUtil.findConfigFile("db.properties");
        final Properties dbProps;
       
        if(EncryptionSecretKeyChecker.useEncryption()){
          StandardPBEStringEncryptor encryptor = EncryptionSecretKeyChecker.getEncryptor();
          dbProps = new EncryptableProperties(encryptor);
          try {
        dbProps.load(new FileInputStream(dbPropsFile));
      } catch (FileNotFoundException e) {
        throw new CloudRuntimeException("db.properties file not found while reading DB secret key", e);
      } catch (IOException e) {
View Full Code Here

      // property value an put
      // encrypted property value using the syntax "ENC(encrypted_value)"
      // in the property container. If the encrypted value is not surrounded
      // 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
      File f = File.createTempFile("JASYPT", ".properties");
      fos = new FileOutputStream(f);
      properties.store(fos, "Sample properties file");
      System.out.printf("testPropertiesFilePropertiesEncryption : Properties file saved to '%s'\n", f.getAbsolutePath());
      // Clear all properties and reload properties file
      properties.clear();
      Assert.assertNull(properties.getProperty("PASSWORD"));
      Assert.assertNull(properties.getProperty("LOGIN"));
      fis = new FileInputStream(f);
      properties.load(fis);
      // Valid properties stored value, the property decryption value is
      // realized on the fly the EncryptableProperties object...
      Assert.assertEquals(TEXT_TO_ENCRYPT, properties.getProperty("PASSWORD"));
      Assert.assertEquals("MY_LOGIN", properties.getProperty("LOGIN"));
    } finally {
      IOUtils.closeQuietly(fos);
      IOUtils.closeQuietly(fis);
    }
View Full Code Here

        _name = name;
        File dbPropsFile = PropertiesUtil.findConfigFile("db.properties");
        final Properties dbProps;
        if (EncryptionSecretKeyChecker.useEncryption()) {
            StandardPBEStringEncryptor encryptor = EncryptionSecretKeyChecker.getEncryptor();
            dbProps = new EncryptableProperties(encryptor);
        } else {
            dbProps = new Properties();
        }
        try {
            dbProps.load(new FileInputStream(dbPropsFile));
View Full Code Here

        try {
            File dbPropsFile = PropertiesUtil.findConfigFile(propsFileName);
            final Properties dbProps;
            if (EncryptionSecretKeyChecker.useEncryption()) {
                StandardPBEStringEncryptor encryptor = EncryptionSecretKeyChecker.getEncryptor();
                dbProps = new EncryptableProperties(encryptor);
            } else {
                dbProps = new Properties();
            }
            try {
                dbProps.load(new FileInputStream(dbPropsFile));
View Full Code Here

        checker.check(dbProps);

        if (EncryptionSecretKeyChecker.useEncryption()) {
            return dbProps;
        } else {
            EncryptableProperties encrProps = new EncryptableProperties(EncryptionSecretKeyChecker.getEncryptor());
            encrProps.putAll(dbProps);
            return encrProps;
        }
    }
View Full Code Here

                EncryptionSecretKeyChecker checker = new EncryptionSecretKeyChecker();
                checker.check(dbProps);

                if (EncryptionSecretKeyChecker.useEncryption()) {
                    StandardPBEStringEncryptor encryptor = EncryptionSecretKeyChecker.getEncryptor();
                    EncryptableProperties encrDbProps = new EncryptableProperties(encryptor);
                    encrDbProps.putAll(dbProps);
                    dbProps = encrDbProps;
                }
            } catch (IOException e) {
                throw new IllegalStateException("Failed to load db.properties", e);
            } finally {
View Full Code Here

    private void updateRegionEntries(Connection conn) {
        File dbPropsFile = PropertiesUtil.findConfigFile("db.properties");
        final Properties dbProps;
        if (EncryptionSecretKeyChecker.useEncryption()) {
            StandardPBEStringEncryptor encryptor = EncryptionSecretKeyChecker.getEncryptor();
            dbProps = new EncryptableProperties(encryptor);
        } else {
            dbProps = new Properties();
        }
        try {
            dbProps.load(new FileInputStream(dbPropsFile));
View Full Code Here

    private void updateRegionEntries(Connection conn) {
        File dbPropsFile = PropertiesUtil.findConfigFile("db.properties");
        final Properties dbProps;
        if (EncryptionSecretKeyChecker.useEncryption()) {
            StandardPBEStringEncryptor encryptor = EncryptionSecretKeyChecker.getEncryptor();
            dbProps = new EncryptableProperties(encryptor);
        } else {
            dbProps = new Properties();
        }
        try {
            dbProps.load(new FileInputStream(dbPropsFile));
View Full Code Here

TOP

Related Classes of org.jasypt.properties.EncryptableProperties

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.