This project add support to jasypt-spring utilizing aws KMS for encrypt / decrypt
- import lib in maven
<dependency>
<groupId>com.jayxu</groupId>
<artifactId>jasypt-spring-aws-kms-starter</artifactId>
<version>{version}</version>
</dependency>
- define
aws.kms.defaultKeyId
in bootstrap config file, else the default Jasypt StringEncryptor will be used - config aws
aws_access_key_id
,aws_secret_access_key
,region
properly according to this article - you can use multiple keyIds in one project:
ENC(xxxxxxxxxx) // will use aws.kms.defaultKeyId to decrypt, same as ENC([${aws.kms.defaultKeyId}]xxxxxxxxxx)
ENC([another-key-id]xxxxxxxxxx) // will use another-key-id to decrypt
- start
nacos-demo
project as a spring boot project - open
htttp://localhost:8088/swagger-ui.html
in browser - the
default-controller
provides several tools for encrypt / decrypt by KMS (or default Jasypt StringEncryptor)