public static void decryptTest( KmsCryptoClient kmsCryptoClient, String keyId, String cipherText) { System.out.println("Decrypt Test: "); DecryptDataDetails decryptDataDetails = DecryptDataDetails.builder().ciphertext(cipherText).keyId(keyId).build(); DecryptRequest decryptRequest = DecryptRequest.builder().decryptDataDetails(decryptDataDetails).build(); DecryptResponse response = kmsCryptoClient.decrypt(decryptRequest); System.out.println("Plaintext: " + response.getDecryptedData().getPlaintext()); System.out.println(); }
/** * Build the instance of DecryptRequest as configured by this builder * * Note that this method takes calls to {@link Builder#invocationCallback(com.oracle.bmc.util.internal.Consumer)} into account, * while the method {@link Builder#buildWithoutInvocationCallback} does not. * * This is the preferred method to build an instance. * * @return instance of DecryptRequest */ public DecryptRequest build() { DecryptRequest request = buildWithoutInvocationCallback(); request.setInvocationCallback(invocationCallback); return request; } }
/** * Copy method to populate the builder with values from the given instance. * @return this builder instance */ public Builder copy(DecryptRequest o) { decryptDataDetails(o.getDecryptDataDetails()); opcRequestId(o.getOpcRequestId()); invocationCallback(o.getInvocationCallback()); return this; }