in src/main/java/Main.java [100:113]
public static void reEncrypt1() {
AWSKMS client = AWSKMSClientBuilder.standard().build();
ByteBuffer sourceCipherTextBlob = ByteBuffer.wrap(new byte[]{1, 2, 3, 4, 5, 6, 7, 8, 9, 0});
DecryptRequest req = new DecryptRequest()
.withCiphertextBlob(sourceCipherTextBlob);
ByteBuffer plainText = client.decrypt(req).getPlaintext();
EncryptRequest res = new EncryptRequest()
.withKeyId("NewKeyId")
.withPlaintext(plainText);
ByteBuffer ciphertext = client.encrypt(res).getCiphertextBlob();
System.out.println(ciphertext);
}