如何使用spring云加密RSA密钥管理器

如何使用spring云加密RSA密钥管理器,spring,encryption,cloud,rsa,Spring,Encryption,Cloud,Rsa,我想实现spring cloud encrypt RSA key manager,如下所示: 信息:ar:'{cipher}2253c8971092fdbdc9f0b8448ed760ff6790360a566e382e24925109e1b7bdc1' 我添加类路径: <dependency> <groupId>org.springframework.security</groupId> <artifactId

我想实现spring cloud encrypt RSA key manager,如下所示:

信息:ar:'{cipher}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>
我的问题是:

  • 例如,如果我想,请看上面的“{cipher}2253..” 加密我的密码“123456”,目标如下 “{cipher}加密密码”,如何实现“123456”到“{cipher}加密密码”
  • 如果加密的“{cipher}加密密码”和上述 “进来 密钥存储“microserver.jks已设置。我想知道什么 解密的“密钥”是什么?如何实现
  • 谁能帮我?谢谢

    例如,如果我想加密我的密码,请参见上面的“{cipher}2253..” 密码“123456”,并且目标看起来像{cipher}加密的 密码”,如何实现“123456”到“{cipher}加密密码 “

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

    curl localhost:8888/encrypt -d clear_text
    
    这将返回加密形式的
    明文

    如果是加密的 “{cipher}加密密码”和上面的“entrypt密钥存储” microserver.jks已设置。我想知道解密的“密钥”是什么 如何实施

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

    curl localhost:8888/decrypt -d cipher_text
    

    我跟随你的:call/encrypt-d文本结果是:“AQAK9ZZkY…”curl/decrypt-d cipher_文本结果是——它工作的原始“文本”!但是,运行配置服务器,它不会。在bootstrap.yml:info:“{cipher}AQAK9ZZkY…”密钥存储:位置:classpath:server.jks密码:jskk别名:server运行配置服务器时,控制台错误:无法解密:key=info FailsafeTextEncryptor未解密。您正确配置密钥库了吗?但是我不知道如何检查密钥库的配置!
    curl localhost:8888/decrypt -d cipher_text