0

I used this project from spring.io and added asymmetric encryption and decryption by having below property files.

<code>
    application properties (server side) :
       server.port=8888
       spring.cloud.config.server.git.uri=https://{uname}:{password}@{giturl}
       encrypt.key-store.location=classpath:/server.jks
       encrypt.key-store.password=letmein
       encrypt.key-store.alias=mytestkey
       encrypt.key-store.secret=changeme
       spring.cloud.config.server.encrypt.enabled=false
       security.user.name=root
       security.user.password=s3cr3t
</code>
<code>
    bootstrap.properties (client side) :
       spring.application.name=config-client
       spring.cloud.config.uri=http://root:s3cr3t@localhost:8888
       encrypt.key-store.location=classpath:/server.jks
       encrypt.key-store.password=letmein
       encrypt.key-store.alias=mytestkey
       encrypt.key-store.secret=changeme
       server.port=8089    
</code>

The property file within my git has

<code>
    message={cipher}{key:mytestkey}AQA5...    
</code>

Unfortunately, I am getting encrypted message in my RestController class which is in a Spring Boot application.

<code>
     @RefreshScope
       @RestController
       class MessageRestController {
          @Value("${message}")
          private String message;

          @RequestMapping("/message")
          String getMessage() {
              return this.message;
          }
       }    
</code>

Have I missed something to decrypt it?

zx485
  • 28,498
  • 28
  • 50
  • 59

0 Answers0