Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Spring Cloud Config Encryption API ignores special characters at the end

We have externalised our application config using Spring cloud config. We also use the Encryption API to encrypt the plain text passwords before they go in yaml property file.

I am struggling with encrypting password for downstream system which has special character at the end. Somehow that’s been ignored by cloud config encryption API. When you decrypt the cipher back using decryption API you get the plain text back without the special character at the end.

I am using curl to invoke the API -

curl 10.102.82.1:11901/encrypt -d AXIzFDH4XZA=  

for some reason special characters in middle of the plain text works fine, but if you have it at the end then its ignored. Probably this password is already hashed, but I am still curious to find out how to deal with this.

like image 734
Amrut Avatar asked Feb 26 '16 11:02

Amrut


1 Answers

Set an explicit Content-Type: text/plain to make sure curl encodes the data correctly when there are special characters

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

This is specified in the cloud config documentation, look for TIP on the page - http://cloud.spring.io/spring-cloud-config/spring-cloud-config.html#_encryption_and_decryption

like image 85
Amrut Avatar answered Sep 18 '22 22:09

Amrut