com.amazonaws.services.kms.model.ReEncryptRequest Java Examples

The following examples show how to use com.amazonaws.services.kms.model.ReEncryptRequest. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: AwsKms.java    From sfs with Apache License 2.0 5 votes vote down vote up
@Override
public Observable<Encrypted> reencrypt(VertxContext<Server> vertxContext, byte[] cipherBytes) {
    SfsVertx sfsVertx = vertxContext.vertx();
    return Observable.defer(() -> RxHelper.executeBlocking(sfsVertx.getOrCreateContext(), sfsVertx.getBackgroundPool(), () -> {
        ReEncryptRequest req =
                new ReEncryptRequest()
                        .withDestinationKeyId(keyId)
                        .withCiphertextBlob(ByteBuffer.wrap(cipherBytes.clone()));
        ByteBuffer buffer = kms.reEncrypt(req).getCiphertextBlob();
        byte[] b = new byte[buffer.remaining()];
        buffer.get(b);
        return new Encrypted(b, keyId);
    }));
}
 
Example #2
Source File: ReencryptDataKey.java    From aws-doc-sdk-examples with Apache License 2.0 5 votes vote down vote up
public static void main(String[] args) {
    AWSKMS kmsClient = AWSKMSClientBuilder.standard().build();
    // Re-encrypt a data key

    ByteBuffer sourceCiphertextBlob = ByteBuffer.wrap(new byte[]{Byte.parseByte("Place your ciphertext here")});


    // Replace the following fictitious CMK ARN with a valid CMK ID or ARN
    String destinationKeyId = "1234abcd-12ab-34cd-56ef-1234567890ab";

    ReEncryptRequest req = new ReEncryptRequest();
    req.setCiphertextBlob(sourceCiphertextBlob);
    req.setDestinationKeyId(destinationKeyId);
    ByteBuffer destinationCipherTextBlob = kmsClient.reEncrypt(req).getCiphertextBlob();
}
 
Example #3
Source File: MockKMSClient.java    From aws-encryption-sdk-java with Apache License 2.0 4 votes vote down vote up
@Override
public ReEncryptResult reEncrypt(ReEncryptRequest arg0) throws AmazonServiceException, AmazonClientException {
    throw new java.lang.UnsupportedOperationException();
}