如何使用spring云加密RSA密钥管理器
我想实现spring cloud encrypt RSA key manager,如下所示: 信息:ar:'{cipher}2253c8971092fdbdc9f0b8448ed760ff6790360a566e382e24925109e1b7bdc1' 我添加类路径:如何使用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
<dependency>
<groupId>org.springframework.security</groupId>
<artifactId>spring-security-crypto</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.security</groupId>
<artifactId>spring-security-rsa</artifactId>
</dependency>
我的问题是:
/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