jasypt 业务加解密组件

Get史上最优雅加密方式!没有之一

https://www.jianshu.com/p/64ceda636e81

spring boot使用jasypt加密原理解析

https://blog.csdn.net/u013905744/article/details/86508236

ctrl+alt+h

com.ulisesbocchio.jasyptspringboot.resolver.DefaultPropertyResolver#resolvePropertyValue

EncryptableEnvironment.maybeDecrypt(String)  (com.ulisesbocchio.jasyptspringboot.environment)
DefaultLazyPropertyResolver.resolvePropertyValue(String)  (com.ulisesbocchio.jasyptspringboot.resolver)
    EncryptableEnvironment.maybeDecrypt(String)  (com.ulisesbocchio.jasyptspringboot.environment)
    DefaultLazyPropertyResolver.resolvePropertyValue(String)  (com.ulisesbocchio.jasyptspringboot.resolver)
    EncryptablePropertySource.getProperty(EncryptablePropertyResolver, EncryptablePropertyFilter, PropertySource<T>, String)  (com.ulisesbocchio.jasyptspringboot)
        CachingDelegateEncryptablePropertySource.getProperty(String)  (com.ulisesbocchio.jasyptspringboot.caching)
            Descriptor in InvalidConfigurationPropertyValueFailureAnalyzer.get(PropertySource<?>, String)  (org.springframework.boot.diagnostics.analyzer)
            EncryptablePropertySourceMethodInterceptor.invoke(MethodInvocation)  (com.ulisesbocchio.jasyptspringboot.aop)
            SpringIterableConfigurationPropertySource.getConfigurationProperty(ConfigurationPropertyName)  (org.springframework.boot.context.properties.source)
            PropertySourcesPlaceholdersResolver.resolvePlaceholder(String)  (org.springframework.boot.context.properties.bind)
            SpringConfigurationPropertySource.getConfigurationProperty(ConfigurationPropertyName)  (org.springframework.boot.context.properties.source)
            EncryptableMapPropertySourceWrapper.getProperty(String)  (com.ulisesbocchio.jasyptspringboot.wrapper)
            Enum constant 'KUBERNETES' in 'CloudPlatform'.isAutoDetected(EnumerablePropertySource<?>)  (org.springframework.boot.cloud)
            CompositePropertySource.getProperty(String)  (org.springframework.core.env)
            EncryptablePropertySource.getProperty(EncryptablePropertyResolver, EncryptablePropertyFilter, PropertySource<T>, String)  (com.ulisesbocchio.jasyptspringboot)
            EncryptablePropertySourceWrapper.getProperty(String)  (com.ulisesbocchio.jasyptspringboot.wrapper)
            SystemEnvironmentPropertySource.containsProperty(String)  (org.springframework.core.env)
            FilteredPropertySource.getProperty(String)  (org.springframework.boot.context.config)
            PropertySource.containsProperty(String)(2 usages)  (org.springframework.core.env)
            PropertySourcesPropertyResolver.getProperty(String, Class<T>, boolean)  (org.springframework.core.env)
            JsonPropertyValue in SpringApplicationJsonEnvironmentPostProcessor.get(PropertySource<?>)  (org.springframework.boot.env)
            EncryptableEnumerablePropertySourceWrapper.getProperty(String)  (com.ulisesbocchio.jasyptspringboot.wrapper)
EncryptablePropertySource.getProperty(EncryptablePropertyResolver, EncryptablePropertyFilter, PropertySource<T>, String)  (com.ulisesbocchio.jasyptspringboot)
代码集成请参考:

https://github.com/heheliu321/itcast-base-root/tree/itcast-base-root
jasypt组件能够解密任何位置的解密套件
因为它本质扫描全部environment下的全部DataSources的key,value,如果value是ENC(密文),则会使用注入的解密类解密。

application.yaml新增配置

    cloud:
      sk: ENC(AAAAAgAAAAAAAAAFAAAAAgAAAAemTVNASXWCKkSSa9mh6nnob1/YCybIongIJE9g3R0gIgAAAAAAAAAAAAAAMBlx0Eh3mK43HUG+9m76ZyrMsGy8uLK9e7ldbmWMlDnstvy8ccGvQKG24SCdHwlfRQ==)

代码使用:

    @Value("${cloud.sk}")
    private String sk;
    
    System.out.println("cloud.ak---" + sk);
    //cloud.ak---3822905103e749b48355caa2b188424d

 

 

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值