by

Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • Jul 28 02:31
    ulisesbocchio commented #209
  • Jul 28 02:28
    mrlonis commented #209
  • Jul 28 02:21
    ulisesbocchio commented #209
  • Jul 28 02:11
    mrlonis commented #209
  • Jul 24 02:01
    DamonK commented #232
  • Jul 23 16:40
    rupert-madden-abbott commented #232
  • Jul 23 09:49
    tkalmar edited #233
  • Jul 23 08:40
    patpatpat123 closed #231
  • Jul 23 08:40
    patpatpat123 commented #231
  • Jul 22 20:42
    tkalmar opened #234
  • Jul 22 20:38
  • Jul 22 20:35
    tkalmar opened #233
  • Jul 22 14:34
    rupert-madden-abbott commented #231
  • Jul 22 07:34
    DamonK opened #232
  • Jul 21 17:55
    patpatpat123 opened #231
  • Jul 16 18:09
    gouthamkunduru commented #207
  • Jul 16 18:05
    gouthamkunduru commented #207
  • Jul 16 18:02
    gouthamkunduru commented #207
  • Jul 16 18:01
    gouthamkunduru commented #207
  • Jul 10 18:58
    ulisesbocchio commented #230
NadhemNiNo
@NadhemNiNo
@ulisesbocchio All works perfectly now. i had some issues with my maven plugin. I have succeeded now to integrate jasypt in my project ans it works as expected. thanks again
Ryan Dawson
@ryandawsonuk
I'm guessing people stuck with java7 just have to settle for the spring jasypt integration?
Ulises Bocchio
@ulisesbocchio
There's a java 7 version @ryandawsonuk
Ryan Dawson
@ryandawsonuk
that would be great - where do I get the java 7 version?
Ryan Dawson
@ryandawsonuk
this makes me very happy, thanks
Ryan Dawson
@ryandawsonuk
I'm hitting this bug in jasypt 1.9.2 - https://sourceforge.net/p/jasypt/bugs/32/
actually doesn't look like they've released 1.9.3 yet
Ulises Bocchio
@ulisesbocchio_twitter
hmm...
yeah, last version was 1.9.2
I don't think they'll be releasing a new version any time soon
Ryan Dawson
@ryandawsonuk
Fortunately I think it would be ok for me if takes them a few months. It would be a problem if they can't guarantee it will get fixed (esp given a fix has been offered and they just need to incorporate it).
Ryan Dawson
@ryandawsonuk
if we think the jasypt guys need a hand then I'd be interested in talking about that. surprised they're not making it easier for community to contribute
Ulises Bocchio
@ulisesbocchio
I haven't seen a release from the for a while, did you check their website?
Ryan Dawson
@ryandawsonuk
Previous comments in tickets on sourceforge indicate they were targetting may for a release. Think they're just running behind.
Ulises Bocchio
@ulisesbocchio
Ok thanks, good to know
BBK-PiJ-2016-11
@BBK-PiJ-2016-11
hey @ulisesbocchio, first of all -- thanks for the work put into the package so far -- is there any way to look for encryptable properties recursively in the resources directory? currently it's only picking up application.properties. I've got some other .properties files stored in directories under the resources dir..
Comven
@Comven
@EncryptablePropertySources({@EncryptablePropertySource("classpath:encrypted.properties"),
@EncryptablePropertySource("classpath:encrypted2.properties")})
BBK-PiJ-2016-11
@BBK-PiJ-2016-11
any change of some sort of wildcard being used here?
chance*
I'd like the app to be able to look inside the resources directory and all subdirectories for .properties files
without needing to specify individual property files as they might be different depending on the deployment
Ulises Bocchio
@ulisesbocchio
hey @BBK-PiJ-2016-11 the plugin decorates any existing property sources in the environment
it doesn't really look for any files
it uses whatever is loaded by Spring by default and any other property sources you may have loaded
Ulises Bocchio
@ulisesbocchio
you could do something like this @BBK-PiJ-2016-11 :
    @Bean
    public PropertySource allPropertiesSource() throws Exception {
        PathMatchingResourcePatternResolver resolver = new PathMatchingResourcePatternResolver();
        Resource[] resources = resolver.getResources("classpath*:*.properties");
        PropertySourceLoader loader = new PropertiesPropertySourceLoader();
        Function<Resource, PropertySource> toSource = resource -> {
            try {
                return loader.load(resource.getFilename(), resource).get(0);
            } catch (Exception e) {
                throw new RuntimeException(e);
            }
        };
        Function<List<PropertySource>, PropertySource> collector = sources -> {
            CompositePropertySource ps = new CompositePropertySource("all properties");
            sources.forEach(ps::addPropertySource);
            return ps;
        };
        return Arrays.stream(resources).map(toSource).collect(Collectors.collectingAndThen(Collectors.toList(), collector));
    }
BBK-PiJ-2016-11
@BBK-PiJ-2016-11
thanks @ulisesbocchio, appreciate it! I'll give this a try today and let you know how I got on. =)
Ravattailor
@Ravattailor
Hi can anyone please help, while I am loading my configration file while bootstraping my application, apllication is not starting and I am not getting any clue of error in logs

import org.jasypt.encryption.pbe.PooledPBEStringEncryptor;
import org.jasypt.encryption.pbe.config.SimpleStringPBEConfig;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import com.ulisesbocchio.jasyptspringboot.EncryptablePropertyDetector;
import com.ulisesbocchio.jasyptspringboot.EncryptablePropertyResolver;
import com.ulisesbocchio.jasyptspringboot.annotation.EncryptablePropertySource;
import com.ulisesbocchio.jasyptspringboot.annotation.EncryptablePropertySources;

/**

  • @author Ravat
    /

@Configuration
@EncryptablePropertySources({ @EncryptablePropertySource("classpath:platform-encrypted.properties") })
public class PlatformEncryptionConfiguration {

@Bean(name = "encryptablePropertyDetector")
public EncryptablePropertyDetector encryptablePropertyDetector() {
    return new MyEncryptablePropertyDetector();
}

@Bean(name="encryptablePropertyResolver")
EncryptablePropertyResolver encryptablePropertyResolver() {
    return new MyEncryptablePropertyResolver();
}

private class MyEncryptablePropertyDetector implements EncryptablePropertyDetector {
    @Override
    public boolean isEncrypted(String value) {
        if (value != null) {
            return value.startsWith("3DES@");
        }
        return false;
    }

    @Override
    public String unwrapEncryptedValue(String value) {
        return value.substring("3DES@".length());
    }
}

private class MyEncryptablePropertyResolver implements EncryptablePropertyResolver {


    private final PooledPBEStringEncryptor encryptor;

    public MyEncryptablePropertyResolver() {
        this.encryptor = new PooledPBEStringEncryptor();
        SimpleStringPBEConfig config = new SimpleStringPBEConfig();
        config.setPasswordCharArray("password".toCharArray());
        config.setAlgorithm("3DES");
        config.setKeyObtentionIterations("1000");
        config.setPoolSize(1);
        config.setProviderName("SunJCE");
        config.setSaltGeneratorClassName("org.jasypt.salt.RandomSaltGenerator");
        config.setStringOutputType("base64");
        encryptor.setConfig(config);
    }

    @Override
    public String resolvePropertyValue(String value) {
        if (value != null && value.startsWith("{cipher}")) {
            return encryptor.decrypt(value.substring("{cipher}".length()));
        }
        return value;
    }
}

}

in spring.factories -> org.springframework.cloud.bootstrap.BootstrapConfiguration=\

<packg>.PlatformEncryptionConfiguration.class

here are some logs
12:38:52.095 [main] DEBUG com.ulisesbocchio.jasyptspringboot.environment.StandardEncryptableEnvironment - Replacing PropertySource 'systemEnvironment' with 'systemEnvironment'
12:38:52.122 [main] DEBUG org.springframework.aop.framework.CglibAopProxy - Creating CGLIB proxy: target source is SingletonTargetSource for target object [org.springframework.core.env.MutablePropertySources@5a4aa2f2]
12:38:52.229 [main] DEBUG org.springframework.aop.framework.CglibAopProxy - Unable to apply any optimizations to advised method: public void org.springframework.core.env.MutablePropertySources.addFirst(org.springframework.core.env.PropertySource)
12:38:52.229 [main] DEBUG org.springframework.aop.framework.CglibAopProxy - Unable to apply any optimizations to advised method: public void org.springframework.core.env.MutablePropertySources.addLast(org.springframework.core.env.PropertySource)
12:38:52.229 [main] DEBUG org.springframework.aop.framework.CglibAopProxy - Unable to apply any optimizations to advised method: public void org.springframework.core.env.MutablePropertySources.addBefore(java.lang.String,org.springframework.core.env.PropertySource)
12:38:52.229 [main] DEBUG org.springframework.aop.framework.CglibAopProxy - Unable to apply any optimizations to advised method: public void org.springframework.core.env.MutablePropertySources.addAfter(java.lang.String,org.springframework.core.env.PropertySource)
12:38:52.229 [main] DEBUG org.springframework.aop.framework.CglibAopProxy - Unable to apply any optimizations to advised method: public int org.springframework.core.env.MutablePropertySources.precedenceOf(org.springframework.core.env.PropertySource)
12:38:52.230 [main] DEBUG org.springframework.aop.framework.CglibAopProxy - Unable to apply any optimizations to advised method: protected void org.springframework.core.env.MutablePropertySources.assertLegalRelativeAddition(java.lang.String,org.springframework.core.env.PropertySource)
12:38:52.230 [main] DEBUG org.springframework.aop.framework.CglibAopProxy - Unable to apply any optimizations to advised method: protected void org.springframework.core.env.MutablePropertySources.removeIfPresent(org.springframework.core.env.PropertySource)
12:38:52.230 [main] DEBUG org.springframework.aop.framework.CglibAopProxy - Unable to apply any optimizations to advised method: public org.springframework.core.env.PropertySource org.springframework.core.env.MutablePropertySources.remove(java.lang.String)
12:38:52.230 [main] DEBUG org.springframework.aop.framework.CglibAopProxy - Unable to apply any optimizations to advised method: public org.springframework.core.env.PropertySource org.springframework.core.env.MutablePropertySources.get(java.lang.String)
12:38:52.230 [main] DEBUG org.springframework.aop.framework.CglibAopProxy - Unable to apply any optimizations to advised method: public java.lang.String org.springframework.core.env.MutablePropertySources.toString()
12:38:52.230 [main] DEBUG org.springframework.aop.framework.CglibAopProxy - Unable to apply any optimizations to advised method: public void org.springframework.core.env.MutablePropertySources.replace(java.lang.String,org.springframework.core.env.PropertySource)
12:38:52.230 [main] DEBUG org.springframework.aop.framework.CglibAopProxy - Unable to apply any optimizations to advised method: public boolean org.springframework.core.env.MutablePropertySources.contains(java.lang.String)
12:38:52.230 [main] DEBUG org.springframework.aop.framework.CglibAopProxy - Unable to apply any optimizations to advised method: public int org.springframework.core.env.MutablePropertySources.size()
12:38:52.230 [main] DEBUG org.springframework.aop.framework.CglibAopProxy - Unable to apply any optimizations to advised method: public java.util.Iterator org.springframework.core.env.MutablePropertySources.iterator()
12:38:52.230 [main] DEBUG org.springframework.aop.framework.CglibAopProxy - Found 'equals' method: public boolean java.lang.Object.equals(java.lang.Object)
12:38:52.230 [main] DEBUG org.springframework.aop.framework.CglibAopProxy - Found 'hashCode' method:
Ulises Bocchio
@ulisesbocchio
@Ravattailor I don’t see a full stack trace of the error. Can you please open an issue on github?
Ravattailor
@Ravattailor
Sure
Ravattailor
@Ravattailor
@ulisesbocchio , I have the reset branch and tried again after that I didn't get same Issue again
but have some doubt related to 3DES.
can you please help me on this
Daniyar Yeralin
@yeralin

Hey, guys may I ask for help?

I added com.github.ulisesbocchio:jasypt-spring-boot-starter:1.17 to Spring Boot app. I encrypted MySQL password with test, and added this JVM arg -Djasypt.encryptor.password=test.

I start my Spring Boot app, see following logs:

2018-10-12 12:30:05 INFO  EnableEncryptablePropertiesBeanFactoryPostProcessor:48 - Post-processing PropertySource instances
2018-10-12 12:30:05 INFO  EncryptablePropertySourceConverter:38 - Converting PropertySource bootstrap [org.springframework.core.env.MapPropertySource] to EncryptableMapPropertySourceWrapper
2018-10-12 12:30:05 INFO  EncryptablePropertySourceConverter:38 - Converting PropertySource servletConfigInitParams [org.springframework.core.env.PropertySource$StubPropertySource] to EncryptablePropertySourceWrapper
2018-10-12 12:30:05 INFO  EncryptablePropertySourceConverter:38 - Converting PropertySource servletContextInitParams [org.springframework.core.env.PropertySource$StubPropertySource] to EncryptablePropertySourceWrapper
2018-10-12 12:30:05 INFO  EncryptablePropertySourceConverter:38 - Converting PropertySource jndiProperties [org.springframework.jndi.JndiPropertySource] to EncryptablePropertySourceWrapper
2018-10-12 12:30:05 INFO  EncryptablePropertySourceConverter:38 - Converting PropertySource systemProperties [org.springframework.core.env.MapPropertySource] to EncryptableMapPropertySourceWrapper
2018-10-12 12:30:05 INFO  EncryptablePropertySourceConverter:38 - Converting PropertySource systemEnvironment [org.springframework.core.env.SystemEnvironmentPropertySource] to EncryptableMapPropertySourceWrapper
2018-10-12 12:30:05 INFO  EncryptablePropertySourceConverter:38 - Converting PropertySource random [org.springframework.boot.context.config.RandomValuePropertySource] to EncryptablePropertySourceWrapper
2018-10-12 12:30:05 INFO  EncryptablePropertySourceConverter:38 - Converting PropertySource springCloudClientHostInfo [org.springframework.core.env.MapPropertySource] to EncryptableMapPropertySourceWrapper
2018-10-12 12:30:05 INFO  EncryptablePropertySourceConverter:38 - Converting PropertySource defaultProperties [org.springframework.core.env.MapPropertySource] to EncryptableMapPropertySourceWrapper

But when I try to resolve my MySQL pwd:

@Value("${spring.datasource.password}")
private String password;

It never decrypts it, it is resolved as ENC(...) instead of decrypted password.

I'm very close, and I feel like I'm missing something

Daniyar Yeralin
@yeralin

resolved by upgrading to 1.18
BenEfrati
@BenEfrati
Hi, I have a problem when using jasypt and spring cloud
Inside logback.xml file I'm using springProperty.
In bootstrap phase, the property resolved (from bootstrap.yml), but after fetching configuration from config server, the property not resolved, result in <propertyName>_IS_UNDEFINED.
I think the problem is in jasypt-spring boot since the problem occurs only when adding jasypt-spring-boot-starter as a dependency.
Attached sample project:
https://github.com/BenEfrati/jasypt-logback-error/files/3168889/jasypt-logback-error.zip
BenEfrati
@BenEfrati
image
BenEfrati
@BenEfrati

Adding


        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-actuator</artifactId>
        </dependency>

to this sample and adding to application.yml


management:
  endpoints:
    web:
      exposure:
        include: "*"

now go to http://localhost:8080/actuator/env
as you can see, the property spring.application.name resolved from bootstrap.yml

Tomasz Siwiec
@TomaszSiwiec
Hello, is it possible to use Jasypt with spring-boot 2.1.5? If not , when we can except compatibility with that version?
Ulises Bocchio
@ulisesbocchio
I think it should be possible @TomaszSiwiec
Tomasz Siwiec
@TomaszSiwiec
When can we except official version for spring-boot 2.1.5?
Ganesh Kumar
@tmpganesh_twitter
@ulisesbocchio I’m using spring boot 1.5 + jasypt 1.12 + hikariCP. When I use EnableEncryptableProperties in main class, properties are not binding to bean, when I remove the annotation, it works. When I debug the app, I could properties are converted to EncryptableMapPropertySourceWrapper object, but properties are not binding to actual config class. Any help?
Ulises Bocchio
@ulisesbocchio
What’s hikariCP?
murali474
@murali474
hi ,
I am currently using jasypt-springboot 2.0 version to secure my db pwd. But the problem is i am getting confused which alogithm i should choose for production purpose.
Note: I am using PBEWithMD5AndDES algorithm now.
And the other question is do i need to write custom bean configuration to set provider name and other details for production purpose?
faizahmad1057
@faizahmad1057

Could anyone please help to resolve this issue.
I am getting below when I am Starting Springboot or doing Run As SpringBoot

Exception in thread "main" java.lang.IllegalArgumentException: Cannot instantiate interface org.springframework.context.ApplicationListener : com.ulisesbocchio.jasyptspringboot.configuration.EnableEncryptablePropertiesBeanFactoryPostProcessor
at org.springframework.boot.SpringApplication.createSpringFactoriesInstances(SpringApplication.java:450)
at org.springframework.boot.SpringApplication.getSpringFactoriesInstances(SpringApplication.java:429)
at org.springframework.boot.SpringApplication.getSpringFactoriesInstances(SpringApplication.java:420)
at org.springframework.boot.SpringApplication.<init>(SpringApplication.java:270)
at org.springframework.boot.SpringApplication.<init>(SpringApplication.java:249)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1260)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1248)
at com.cisco.sbg.ces.configservice.ConfigserviceApplication.main(ConfigserviceApplication.java:16)
Caused by: java.lang.NoClassDefFoundError: org/slf4j/LoggerFactory
at com.ulisesbocchio.jasyptspringboot.configuration.EnableEncryptablePropertiesBeanFactoryPostProcessor.<clinit>(EnableEncryptablePropertiesBeanFactoryPostProcessor.java:35)