简体   繁体   English

使用 Spring 的密码加密/解密

[英]Password Encryption / Decryption using Spring

I would like to know whether Spring / Spring Security provide a means to Encrypt / Decrypt a password.我想知道 Spring / Spring Security 是否提供了一种加密/解密密码的方法。

The scenario would basically be to encrypt the password and store in the DB , and perform a user authentication against the same on login.该方案基本上是加密密码并存储在 DB 中,并在登录时针对相同的用户执行用户身份验证。

In case of securing access to database, LDAP or other resources, nowadays you can use Spring Boot Cloud CLI for passwords encryption and decryption在保护对数据库、LDAP 或其他资源的访问的情况下,现在您可以使用Spring Boot Cloud CLI 进行密码加密和解密

$ spring encrypt mysecret --key foo 682bc583f4641835fa2db009355293665d2647dade3375c0ee201de2a49f7bda $ spring 加密 mysecret --key foo 682bc583f4641835fa2db009355293665d2647dade3375c0ee201de2a49f7bda

$ spring decrypt --key foo 682bc583f4641835fa2db009355293665d2647dade3375c0ee201de2a49f7bda mysecret $ spring解密--key foo 682bc583f4641835fa2db009355293665d2647dade3375c0ee201de2a49f7bda mysecret

Later you can use these passwords in Spring Cloud Config .稍后您可以在Spring Cloud Config 中使用这些密码。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM