Punter Vicky
Punter Vicky

Reputation: 16982

Spring Cloud Config - Encrypt Password

I saw that spring cloud config provides an /encrypt and /decrypt endpoints. How can I use the encrypt and decrypt endpoint via Advanced REST Client in order to view the encrypted or decrypted string?

Upvotes: 2

Views: 5750

Answers (1)

Ali Dehghani
Ali Dehghani

Reputation: 48123

As Spring Cloud Config documentation states:

The server also exposes /encrypt and /decrypt endpoints (on the assumption that these will be secured and only accessed by authorized agents). If you are editing a remote config file you can use the Config Server to encrypt values by POSTing to the /encrypt endpoint.

For encryption, send a POST request to the /encrypt endpoint with the Clear Text as the request body:

$ curl localhost:8888/encrypt -d mysecret
682bc583f4641835fa2db009355293665d2647dade3375c0ee201de2a49f7bda

The inverse operation is also available via /decrypt (provided the server is configured with a symmetric key or a full key pair).

For decryption, send a POST request to the /decrypt endpoint with the Cipher Text as the request body:

$ curl localhost:8888/decrypt -d 682bc583f4641835fa2db00935529366...
mysecret

Upvotes: 4

Related Questions