Comments (6)
checkout the demo app https://github.com/ulisesbocchio/jasypt-spring-boot/tree/master/jasypt-spring-boot-demo-custom-encryptor
That works just fine. That one renames the actual bean name in application.yml, but you can just remove the renaming in application.yml and rename the static bean as jasyptStringEncryptor
and it works just fine.
Please make sure you declare your bean static:
@Bean(name="jasyptStringEncryptor")
static public StringEncryptor stringEncryptor() {
PooledPBEStringEncryptor encryptor = new PooledPBEStringEncryptor();
SimpleStringPBEConfig config = new SimpleStringPBEConfig();
config.setPassword("password");
config.setAlgorithm("PBEWithMD5AndDES");
config.setKeyObtentionIterations("1000");
config.setPoolSize("1");
config.setProviderName("SunJCE");
config.setSaltGeneratorClassName("org.jasypt.salt.RandomSaltGenerator");
config.setStringOutputType("base64");
encryptor.setConfig(config);
return encryptor;
}
from jasypt-spring-boot.
Are you experiencing any error? I'm not sure what you're asking. The bean rename is to overcome a limitation of Spring that doesn't allow ${pace.holders} in bean names. Since I want users to be able to define their own bean name if they want.
from jasypt-spring-boot.
Hi Ulises,
Let me try to describe the scenario a little better this time. I went
through your brief documentation on GitHub and inferred that if I write a
decryption method that returns an object of type StringEncryptor with a
@bean(name="jasyptStringEncryptor") preceeding it, the default
StringEncryptor will not be initialized by jasypt-spring-boot. So I did the
same but upon running the application, I saw that my custom encryptor was
being overriden by jasypt's default string encryptor having the same bean
name. As per my understanding the default is overridden by the custom and
not the other way round. Inspite of me writing the custom method and
providing certain value to fields such as the randomsaltgenerator and
keyobtentioniterations, it always picked up the default values and in the
logs i could see that:
- It overrides the custom bean with the default one
- As a result it uses the default property values.
Hope this explains the scenario better.
I would also like to mention that I really appreciate the work you are
doing to make life easier for developers around the globe.
Thanks & Regards,
Debanjan.
On Apr 21, 2016 4:49 AM, "Ulises Bocchio" [email protected] wrote:
Are you experiencing any error? I'm not sure what you're asking. The bean
rename is to overcome a limitation of Spring that doesn't allow
${pace.holders} in bean names. Since I want users to be able to define
their own bean name if they want.
—
You are receiving this because you authored the thread.
Reply to this email directly or view it on GitHub
#23 (comment)
from jasypt-spring-boot.
Hi Ulises,
I am not using yml currently but I will surely give it a try. Thanks for
your time and your prompt reply.
Thanks & Regards,
Debanjan.
On Apr 21, 2016 5:19 AM, "Ulises Bocchio" [email protected] wrote:
checkout the demo app
https://github.com/ulisesbocchio/jasypt-spring-boot/tree/master/jasypt-spring-boot-demo-custom-encryptorThat works just fine. That one renames the actual bean name in
application.yml, but you can just remove the renaming in application.yml
and rename the static bean as jasyptStringEncryptor and it works just
fine.
Please make sure you declare your bean static:@Bean(name="jasyptStringEncryptor") static public StringEncryptor stringEncryptor() { PooledPBEStringEncryptor encryptor = new PooledPBEStringEncryptor(); SimpleStringPBEConfig config = new SimpleStringPBEConfig(); config.setPassword("password"); config.setAlgorithm("PBEWithMD5AndDES"); config.setKeyObtentionIterations("1000"); config.setPoolSize("1"); config.setProviderName("SunJCE"); config.setSaltGeneratorClassName("org.jasypt.salt.RandomSaltGenerator"); config.setStringOutputType("base64"); encryptor.setConfig(config); return encryptor; }
—
You are receiving this because you authored the thread.
Reply to this email directly or view it on GitHub
#23 (comment)
from jasypt-spring-boot.
no problem buddy, it doesn't matter whether you use yaml or not. Just make your custom encryptor bean static and that should fix it.
I'm closing this, please reopen should you haven further issues
Best,
Uli
from jasypt-spring-boot.
I am getting below error -
Caused by: com.ulisesbocchio.jasyptspringboot.exception.DecryptionException: Decryption of Properties failed, make sure encryption/decryption passwords match
at com.ulisesbocchio.jasyptspringboot.resolver.DefaultPropertyResolver.resolvePropertyValue(DefaultPropertyResolver.java:37) ~[jasypt-spring-boot-1.16.jar:na]
at com.ulisesbocchio.jasyptspringboot.resolver.DefaultLazyPropertyResolver.resolvePropertyValue(DefaultLazyPropertyResolver.java:41) ~[jasypt-spring-boot-1.16.jar:na]
at com.ulisesbocchio.jasyptspringboot.EncryptablePropertySource.getProperty(EncryptablePropertySource.java:16) ~[jasypt-spring-boot-1.16.jar:na]
at com.ulisesbocchio.jasyptspringboot.wrapper.EncryptableMapPropertySourceWrapper.getProperty(EncryptableMapPropertySourceWrapper.java:29) ~[jasypt-spring-boot-1.16.jar:na]
at org.springframework.boot.bind.PropertySourcesPropertyValues.getEnumerableProperty(PropertySourcesPropertyValues.java:153) ~[spring-boot-1.4.3.RELEASE.jar:1.4.3.RELEASE]
at org.springframework.boot.bind.PropertySourcesPropertyValues.processEnumerablePropertySource(PropertySourcesPropertyValues.java:136) ~[spring-boot-1.4.3.RELEASE.jar:1.4.3.RELEASE]
at org.springframework.boot.bind.PropertySourcesPropertyValues.processPropertySource(PropertySourcesPropertyValues.java:115) ~[spring-boot-1.4.3.RELEASE.jar:1.4.3.RELEASE]
at org.springframework.boot.bind.PropertySourcesPropertyValues.(PropertySourcesPropertyValues.java:105) ~[spring-boot-1.4.3.RELEASE.jar:1.4.3.RELEASE]
at org.springframework.boot.bind.PropertiesConfigurationFactory.getPropertySourcesPropertyValues(PropertiesConfigurationFactory.java:336) ~[spring-boot-1.4.3.RELEASE.jar:1.4.3.RELEASE]
at org.springframework.boot.bind.PropertiesConfigurationFactory.getPropertyValues(PropertiesConfigurationFactory.java:329) ~[spring-boot-1.4.3.RELEASE.jar:1.4.3.RELEASE]
at org.springframework.boot.bind.PropertiesConfigurationFactory.doBindPropertiesToTarget(PropertiesConfigurationFactory.java:284) ~[spring-boot-1.4.3.RELEASE.jar:1.4.3.RELEASE]
at org.springframework.boot.bind.PropertiesConfigurationFactory.bindPropertiesToTarget(PropertiesConfigurationFactory.java:256) ~[spring-boot-1.4.3.RELEASE.jar:1.4.3.RELEASE]
at org.springframework.boot.context.properties.ConfigurationPropertiesBindingPostProcessor.postProcessBeforeInitialization(ConfigurationPropertiesBindingPostProcessor.java:347) ~[spring-boot-1.4.3.RELEASE.jar:1.4.3.RELEASE]
... 110 common frames omitted
Caused by: org.jasypt.exceptions.EncryptionOperationNotPossibleException: null
at org.jasypt.encryption.pbe.StandardPBEByteEncryptor.decrypt(StandardPBEByteEncryptor.java:981) ~[jasypt-1.8.jar:na]
at org.jasypt.encryption.pbe.StandardPBEStringEncryptor.decrypt(StandardPBEStringEncryptor.java:717) ~[jasypt-1.8.jar:na]
at org.jasypt.encryption.pbe.PooledPBEStringEncryptor.decrypt(PooledPBEStringEncryptor.java:500) ~[jasypt-1.8.jar:na]
at com.ulisesbocchio.jasyptspringboot.encryptor.DefaultLazyEncryptor.decrypt(DefaultLazyEncryptor.java:81) ~[jasypt-spring-boot-1.16.jar:na]
at com.ulisesbocchio.jasyptspringboot.resolver.DefaultPropertyResolver.resolvePropertyValue(DefaultPropertyResolver.java:35) ~[jasypt-spring-boot-1.16.jar:na]
... 122 common frames omitted
from jasypt-spring-boot.
Related Issues (20)
- 3.x.x 以后可以自定义加密器吗,配置jasypt.encryptor.bean的方式
- GraalVM native app startup with errors. HOT 1
- Windows and Linux compatibility issues HOT 3
- AES256GCM, Base64 decod of key file failed...
- StackOverflowError with SpringBoot 3.1.5 and jasypt-spring-boot-starter 3.0.5 with ${cors.origins.allowed:#{http://localhost:4200}} HOT 2
- jasypt not decrypting already encrypted property (i.e in application.properties file) in xml based configuration spring boot project HOT 3
- Usage of StandardEncryptableEnvironment with additional active profile(s) and custom prefix and suffix breaks decryption
- String Encryptor custom Bean not found with name 'jasyptStringEncryptor' after upgrading to AWS CLOUD Spring3(implementation platform("io.awspring.cloud:spring-cloud-aws-dependencies:3.0.4)
- Source code to refer in order to understanding how jasypt able to "intercept" and "massage" the configuration value
- NoSuchAlgorithmException: SHA1PRNG SecureRandom not available HOT 1
- nacos password decryption in application.yml HOT 2
- jasypt-spring-boot-starter-3.0.5 does not work with springboot latest version 3.2.2
- When will the service "jasypt-spring-boot" 3.0.5 end?
- Is this project still maintained?
- Is there a plan for the project to support jdk17?
- jasypt.encryptor.password property is treated as sensitive by code scan tools
- can not decrypt in spring cloud alibaba 20222.0.0.0 with nacos
- Stack overflow when config is AA=${AA}
- jasypt: ecryption of Properties failed, make sure encryption/decryption passwords match apres upgrading from version 2.3 to 3.0.5 HOT 1
- one and the same project got two mvn result by Mac and Win
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from jasypt-spring-boot.