如何使用spring cloud encrypt RSA Key Manager

how to use spring cloud encrypt RSA Key Manager

我想实现 spring 云加密 RSA 密钥管理器,如下所示:

信息:ar:'{密码}2253c8971092fdbdc9f0b8448ed760ff6790360a566e382e24925109e1b7bdc1'

我添加类路径:

     <dependency>
        <groupId>org.springframework.security</groupId>
        <artifactId>spring-security-crypto</artifactId>
    </dependency>
    <dependency>
        <groupId>org.springframework.security</groupId>
        <artifactId>spring-security-rsa</artifactId>
    </dependency>

并在正确的位置安装 JCE8。

在我的 bootstrap.yml 中:

加密:
密钥库:

       location: classpath:microserver.jks
       password: ${KEYSTORE_PASSWORD:jsk8iiu2e}
       alias:  serverconfig

我的问题是:

  1. 例如上面的“{cipher}2253..”,如果我想 加密我的密码“123456”,目标看起来像 “{cipher}加密密码”,如何实现“123456”为“{cipher}加密密码”?
  2. 如果加密的“{cipher}加密密码”及以上 "入口 key-store " microserver.jks 已设置。我想知道什么 是'key'解密,如何实现?

谁能帮帮我?谢谢!

look like above "{cipher}2253.." for example ,if i want to encrypt my password "123456", and the target looks like "{cipher}encrypted password" , how to implemented "123456" to "{cipher}encrypted password "?

Config 服务器公开 /encrypt/decrypt 端点,您可以使用它们来加密明文或解密密文。例如:

curl localhost:8888/encrypt -d clear_text

这将 return clear_text

的加密形式

if the encrypted "{cipher}encrypted password" and the above "entrypt key-store " microserver.jks had set . i want to know what is the 'key' to decrypt and how to implement ?

只需调用 /decrypt 端点,如下所示:

curl localhost:8888/decrypt -d cipher_text