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 File: EncryptablePropertiesPropertySource.java    From jasypt with 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 File: EncryptablePropertiesPropertySource.java    From jasypt with 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 File: EncryptablePropertiesPropertySource.java    From jasypt with 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 File: EncryptablePropertiesPropertySource.java    From jasypt with 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 File: DbProperties.java    From cosmic with 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 File: ApplicationProperties.java    From mycollab with 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 File: DbProperties.java    From cloudstack with 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 File: EncryptablePropertiesFactoryBean.java    From jasypt with Apache License 2.0 4 votes vote down vote up
public Class<?> getObjectType() {
    return EncryptableProperties.class;
}
 
Example #9
Source File: EncryptablePropertiesPropertySource.java    From jasypt with Apache License 2.0 4 votes vote down vote up
public EncryptablePropertiesPropertySource(final String name, final EncryptableProperties props) {
    super(name, props);
}
 
Example #10
Source File: EncryptablePropertiesFactoryBean.java    From jasypt with Apache License 2.0 4 votes vote down vote up
public Class<?> getObjectType() {
    return EncryptableProperties.class;
}
 
Example #11
Source File: EncryptablePropertiesPropertySource.java    From jasypt with Apache License 2.0 4 votes vote down vote up
public EncryptablePropertiesPropertySource(final String name, final EncryptableProperties props) {
    super(name, props);
}
 
Example #12
Source File: EncryptablePropertiesFactoryBean.java    From jasypt with Apache License 2.0 4 votes vote down vote up
public Class<?> getObjectType() {
    return EncryptableProperties.class;
}
 
Example #13
Source File: EncryptionService.java    From jasypt-spring-boot with MIT License 4 votes vote down vote up
public EncryptableProperties getEncryptableProperties() {
    return new EncryptableProperties(encryptor);
}
 
Example #14
Source File: PropertyDecrypter.java    From scheduling with GNU Affero General Public License v3.0 4 votes vote down vote up
public static Properties getDecryptableProperties() {
    StringEncryptor encryptor = getDefaultEncryptor();
    return new EncryptableProperties(encryptor);
}