componentes de cifrado y descifrado empresarial jasypt

¡El método de encriptación más elegante en Obtener historial! ninguno de ellos

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

Spring Boot utiliza el análisis del principio de cifrado de 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)
        CachingDelegateEncryptablegetio.
            Descriptor en InvalidConfigurationPropertyValueFailureAnalyzer.get (PropertySource <?>, String) (org.springframework.boot.diagnostics.analyzer)
            EncryptablePropertySourceMethodInterceptor.invoke (MethodInvocation
            ) (com.ulisesbocchio.jasfiguraspringSource. boot.context.properties.source)
            PropertySourcesPlaceholdersResolver.resolvePlaceholder (String) (org.springframework.boot.context.properties.bind)
            SpringConfigurationPropertySource.getConfigurationProperty (ConfigurationPropertyName) (org.springframework.boot.context.properties.springframework.boot.context.properties.springframework.boot.context.properties
            EncryptableMapPropertySourceWrapper.getProperty (String) (com.ulisesbocchio.jasyptspringboot.wrapper)
            Constante de enumeración 'KUBERNETES' en 'CloudPlatform'.isAutoDetected (EnumerablePropertySource <?>) (Org.springframework.boot.cloud.
            Composite) 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 usos) (org.springframework.core.env)
            PropertySourcesPropertyResolver.getProperty (String, Class <T>, booleano) ( org.springframework.core.env)
            JsonPropertyValue en 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 El
componente jasypt puede descifrar kits de descifrado en cualquier ubicación
porque esencialmente escanea las claves y valores de todas las fuentes de datos en todos los entornos. Si el valor es ENC (texto cifrado) se descifrará utilizando la clase de descifrado inyectada.

Application.yaml nueva configuración

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

Uso de código:

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

 

 

 

Supongo que te gusta

Origin blog.csdn.net/nmjhehe/article/details/108712803
Recomendado
Clasificación