Created
May 6, 2016 13:11
-
-
Save o-can/5fd7987de78a4f171eb8fd0dcb33ef4d to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
AWSKMSClient awskmsClient = new AWSKMSClient(); | |
awskmsClient.setRegion(Region.getRegion(Regions.EU_CENTRAL_1)); | |
String token = "Dummy"; | |
ByteBuffer plainText = ByteBuffer.wrap(token.getBytes()); | |
EncryptRequest encryptRequest = new EncryptRequest().withKeyId(keyId).withPlaintext(plainText); | |
EncryptResult encryptResult = awskmsClient.encrypt(encryptRequest); | |
String kmsEncryptedToken = Base64.getEncoder().encodeToString(encryptResult.getCiphertextBlob().array()); | |
System.out.println(kmsEncryptedToken); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment