Spring Cloud Config 加密 API 忽略末尾的特殊字符

Spring Cloud Config Encryption API ignores special characters at the end

我们已经使用 Spring 云配置外部化了我们的应用程序配置。我们还使用加密 API 在纯文本密码进入 yaml 属性 文件之前对其进行加密。

我正在努力为下游系统加密密码,该系统末尾有特殊字符。云配置加密 API 以某种方式忽略了这一点。当您使用解密 API 解密密码时,您会得到末尾没有特殊字符的纯文本。

我正在使用 curl 来调用 API -

curl 10.102.82.1:11901/encrypt -d AXIzFDH4XZA=  

出于某种原因,纯文本中间的特殊字符可以正常工作,但如果你在末尾有它,那么它会被忽略。可能这个密码已经被散列了,但我仍然很想知道如何处理这个。

设置明确的 Content-Type:text/plain 以确保 curl 在有特殊字符时正确编码数据

curl -H "Content-Type: text/plain" 10.102.82.1:11901/encrypt -d AXIzFDH4XZA=

这是在云配置文档中指定的,在页面上查找 TIP - http://cloud.spring.io/spring-cloud-config/spring-cloud-config.html#_encryption_and_decryption

我在密码中使用“}”时遇到问题,解决该问题的唯一方法是在密码前加上 {plain},如下所示:

export PASSWORD=$(curl -X POST --data-urlencode "{plain}adfadf%273}*+” http://username:password@localhost:8888/encrypt)

curl http://username:password@localhost:8888/decrypt -d {cipher}$PASSWORD