org.jasypt.properties.EncryptableProperties Java Examples

The following examples show how to use org.jasypt.properties.EncryptableProperties. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source Project: jasypt   Author: jasypt   File: EncryptablePropertiesPropertySource.java    License: Apache License 2.0 5 votes vote down vote up
private static Properties processProperties(final Properties props, final TextEncryptor encryptor) {
    if (props == null) {
        return null;
    }
    if (props instanceof EncryptableProperties) {
        throw new IllegalArgumentException(
                "Properties object already is an " + EncryptableProperties.class.getName() + 
                " object. No encryptor should be specified.");
    }
    final EncryptableProperties encryptableProperties = new EncryptableProperties(encryptor);
    encryptableProperties.putAll(props);
    return encryptableProperties;
}
 
Example #2
Source Project: jasypt   Author: jasypt   File: EncryptablePropertiesPropertySource.java    License: Apache License 2.0 5 votes vote down vote up
private static Properties processProperties(final Properties props, final StringEncryptor encryptor) {
    if (props == null) {
        return null;
    }
    if (props instanceof EncryptableProperties) {
        throw new IllegalArgumentException(
                "Properties object already is an " + EncryptableProperties.class.getName() + 
                " object. No encryptor should be specified.");
    }
    final EncryptableProperties encryptableProperties = new EncryptableProperties(encryptor);
    encryptableProperties.putAll(props);
    return encryptableProperties;
}
 
Example #3
Source Project: jasypt   Author: jasypt   File: EncryptablePropertiesPropertySource.java    License: Apache License 2.0 5 votes vote down vote up
private static Properties processProperties(final Properties props, final TextEncryptor encryptor) {
    if (props == null) {
        return null;
    }
    if (props instanceof EncryptableProperties) {
        throw new IllegalArgumentException(
                "Properties object already is an " + EncryptableProperties.class.getName() + 
                " object. No encryptor should be specified.");
    }
    final EncryptableProperties encryptableProperties = new EncryptableProperties(encryptor);
    encryptableProperties.putAll(props);
    return encryptableProperties;
}
 
Example #4
Source Project: jasypt   Author: jasypt   File: EncryptablePropertiesPropertySource.java    License: Apache License 2.0 5 votes vote down vote up
private static Properties processProperties(final Properties props, final StringEncryptor encryptor) {
    if (props == null) {
        return null;
    }
    if (props instanceof EncryptableProperties) {
        throw new IllegalArgumentException(
                "Properties object already is an " + EncryptableProperties.class.getName() + 
                " object. No encryptor should be specified.");
    }
    final EncryptableProperties encryptableProperties = new EncryptableProperties(encryptor);
    encryptableProperties.putAll(props);
    return encryptableProperties;
}
 
Example #5
Source Project: cosmic   Author: MissionCriticalCloud   File: DbProperties.java    License: Apache License 2.0 5 votes vote down vote up
protected static Properties wrapEncryption(final Properties dbProps) throws IOException {
    final EncryptionSecretKeyChecker checker = new EncryptionSecretKeyChecker();
    checker.check(dbProps);

    if (EncryptionSecretKeyChecker.useEncryption()) {
        return dbProps;
    } else {
        final EncryptableProperties encrProps = new EncryptableProperties(EncryptionSecretKeyChecker.getEncryptor());
        encrProps.putAll(dbProps);
        return encrProps;
    }
}
 
Example #6
Source Project: mycollab   Author: MyCollab   File: ApplicationProperties.java    License: GNU Affero General Public License v3.0 5 votes vote down vote up
public static void loadProps() {
    StandardPBEStringEncryptor encryptor = new StandardPBEStringEncryptor();
    encryptor.setPassword(DECRYPT_PASS);

    properties = new EncryptableProperties(encryptor);
    try {
        File configFile = getAppConfigFile();

        if (configFile != null) {
            try (InputStreamReader isr = new InputStreamReader(new FileInputStream(configFile), "UTF-8")) {
                properties.load(isr);
            }
        } else {
            InputStream propStreams = Thread.currentThread().getContextClassLoader().getResourceAsStream(RESOURCE_PROPERTIES);
            if (propStreams == null) {
                // Probably we are running testing
                InputStream propStream = Thread.currentThread().getContextClassLoader().getResourceAsStream("default-mycollab-test.properties");
                if (propStream != null) {
                    try (InputStreamReader isr = new InputStreamReader(propStream, "UTF-8")) {
                        properties.load(isr);
                    }
                }
            }
        }
    } catch (Exception e) {
        throw new MyCollabException(e);
    }
}
 
Example #7
Source Project: cloudstack   Author: apache   File: DbProperties.java    License: Apache License 2.0 5 votes vote down vote up
protected static Properties wrapEncryption(Properties dbProps) throws IOException {
    EncryptionSecretKeyChecker checker = new EncryptionSecretKeyChecker();
    checker.check(dbProps);

    if (EncryptionSecretKeyChecker.useEncryption()) {
        return dbProps;
    } else {
        EncryptableProperties encrProps = new EncryptableProperties(EncryptionSecretKeyChecker.getEncryptor());
        encrProps.putAll(dbProps);
        return encrProps;
    }
}
 
Example #8
Source Project: jasypt   Author: jasypt   File: EncryptablePropertiesFactoryBean.java    License: Apache License 2.0 4 votes vote down vote up
public Class<?> getObjectType() {
    return EncryptableProperties.class;
}
 
Example #9
Source Project: jasypt   Author: jasypt   File: EncryptablePropertiesPropertySource.java    License: Apache License 2.0 4 votes vote down vote up
public EncryptablePropertiesPropertySource(final String name, final EncryptableProperties props) {
    super(name, props);
}
 
Example #10
Source Project: jasypt   Author: jasypt   File: EncryptablePropertiesFactoryBean.java    License: Apache License 2.0 4 votes vote down vote up
public Class<?> getObjectType() {
    return EncryptableProperties.class;
}
 
Example #11
Source Project: jasypt   Author: jasypt   File: EncryptablePropertiesPropertySource.java    License: Apache License 2.0 4 votes vote down vote up
public EncryptablePropertiesPropertySource(final String name, final EncryptableProperties props) {
    super(name, props);
}
 
Example #12
Source Project: jasypt   Author: jasypt   File: EncryptablePropertiesFactoryBean.java    License: Apache License 2.0 4 votes vote down vote up
public Class<?> getObjectType() {
    return EncryptableProperties.class;
}
 
Example #13
Source Project: jasypt-spring-boot   Author: ulisesbocchio   File: EncryptionService.java    License: MIT License 4 votes vote down vote up
public EncryptableProperties getEncryptableProperties() {
    return new EncryptableProperties(encryptor);
}
 
Example #14
Source Project: scheduling   Author: ow2-proactive   File: PropertyDecrypter.java    License: GNU Affero General Public License v3.0 4 votes vote down vote up
public static Properties getDecryptableProperties() {
    StringEncryptor encryptor = getDefaultEncryptor();
    return new EncryptableProperties(encryptor);
}