O método de criptografia mais elegante em Get history! nenhum deles
https://www.jianshu.com/p/64ceda636e81
Spring boot usa análise de princípio de criptografia 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.getProperty (EncryptablePropertyResolver, EncryptablePropertyFilter, PropertySource <T>,
String) (com.ulisesbocchio.jasyptspringboot.cachingDelegateEncryptable)
Descritor em InvalidConfigurationPropertyValueFailureAnalyzer.get (PropertySource <?>, String) (org.springframework.boot.diagnostics.analyzer)
EncryptablePropertySourceMethodInterceptor.invoke (MethodInvocation) (org.springframework.boot.diagnostics.analyzer)
EncryptablePropertySourceMethodInterceptor.invoke (MethodInvocation) (com.ulisesopigurationPrigurationConfiguration. 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)
Constante Enum 'KUBERNETES' em 'CloudPlatform'.isAutoDetected (EnumerablePropertySource <?>) (Org.spropertySource.getProt.cloud)
Composite ( org.spropertySource.getProt.cloud) springframework.core.env)
EncryptablePropertySource.getProperty (EncryptablePropertyResolver, EncryptablePropertyFilter, PropertySource <T>, String) (com.ulisesbocchio.jasyptspringboot)
EncryptablePropertySourcejaswrapper.getProperty (
ambiente). org.springframework.core.env)
FilteredPropertySource.getProperty (String) (org.springframework.boot.context.config)
PropertySource.containsProperty (String) (2 usos) (org.springframework.core.env)
PropertySourcesPropertyResolver.getProperty (String, Class <T>, boolean) ( org.springframework.core.env)
JsonPropertyValue em 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 O
componente jasypt pode descriptografar kits de descriptografia em qualquer local
porque essencialmente verifica as chaves e valores de todos os DataSources em todos os ambientes. Se o valor for ENC (texto cifrado) será descriptografado usando a classe de descriptografia injetada.
Nova configuração de Application.yaml
cloud:
sk: ENC(AAAAAgAAAAAAAAAFAAAAAgAAAAemTVNASXWCKkSSa9mh6nnob1/YCybIongIJE9g3R0gIgAAAAAAAAAAAAAAMBlx0Eh3mK43HUG+9m76ZyrMsGy8uLK9e7ldbmWMlDnstvy8ccGvQKG24SCdHwlfRQ==)
Uso do código:
@Value("${cloud.sk}")
private String sk;
System.out.println("cloud.ak---" + sk);
//cloud.ak---3822905103e749b48355caa2b188424d