public static String encryptTest(KmsCryptoClient kmsCryptoClient, String keyId) { System.out.println("Encrypt Test: "); String plaintext = "I love OCI!"; EncryptDataDetails encryptDataDetails = EncryptDataDetails.builder() .keyId(keyId) .plaintext(Base64.encodeBase64String(plaintext.getBytes())) .build(); EncryptRequest encryptRequest = EncryptRequest.builder().encryptDataDetails(encryptDataDetails).build(); EncryptResponse response = kmsCryptoClient.encrypt(encryptRequest); System.out.println("Plaintext: " + plaintext); System.out.println("Cipheretext: " + response.getEncryptedData().getCiphertext()); System.out.println(); return response.getEncryptedData().getCiphertext(); }
@com.fasterxml.jackson.annotation.JsonIgnore public Builder copy(EncryptDataDetails o) { Builder copiedBuilder = associatedData(o.getAssociatedData()) .keyId(o.getKeyId()) .plaintext(o.getPlaintext()); copiedBuilder.__explicitlySet__.retainAll(o.__explicitlySet__); return copiedBuilder; } }
/** * Create a new builder. */ public static Builder builder() { return new Builder(); }