Example usage for com.amazonaws.services.s3.model SSEAwsKeyManagementParams SSEAwsKeyManagementParams

List of usage examples for com.amazonaws.services.s3.model SSEAwsKeyManagementParams SSEAwsKeyManagementParams

Introduction

In this page you can find the example usage for com.amazonaws.services.s3.model SSEAwsKeyManagementParams SSEAwsKeyManagementParams.

Prototype

public SSEAwsKeyManagementParams() 

Source Link

Document

Constructs a new instance of SSEAwsKeyManagementParams.

Usage

From source file:io.druid.storage.s3.KmsServerSideEncryption.java

License:Apache License

@Override
public PutObjectRequest decorate(PutObjectRequest request) {
    return request.withSSEAwsKeyManagementParams(
            keyId == null ? new SSEAwsKeyManagementParams() : new SSEAwsKeyManagementParams(keyId));
}

From source file:io.druid.storage.s3.KmsServerSideEncryption.java

License:Apache License

@Override
public CopyObjectRequest decorate(CopyObjectRequest request) {
    return request.withSSEAwsKeyManagementParams(
            keyId == null ? new SSEAwsKeyManagementParams() : new SSEAwsKeyManagementParams(keyId));
}

From source file:jetbrains.buildServer.codepipeline.CodePipelineBuildListener.java

License:Apache License

@NotNull
private static SSEAwsKeyManagementParams getSSEAwsKeyManagementParams(@Nullable EncryptionKey encryptionKey) {
    return encryptionKey == null || encryptionKey.getId() == null || encryptionKey.getType() == null
            || !EncryptionKeyType.KMS.toString().equals(encryptionKey.getType())
                    ? new SSEAwsKeyManagementParams()
                    : new SSEAwsKeyManagementParams(encryptionKey.getId());
}

From source file:org.apache.nifi.processors.aws.s3.encryption.service.StandardS3ServerSideEncryptionService.java

License:Apache License

public void encrypt(PutObjectRequest putObjectRequest) {
    if (encryptionMethod == null)
        return;//from w  w w . ja v  a 2  s  .  co m

    if (encryptionMethod.equals(METHOD_SSE_S3)) {
        getLogger().info("Encrypting single part object using SSE-S3");
        putObjectRequest.getMetadata()
                .setSSEAlgorithm(algorithm == null ? ObjectMetadata.AES_256_SERVER_SIDE_ENCRYPTION : algorithm);
    }

    if (encryptionMethod.equals(METHOD_SSE_KMS)) {
        getLogger().info("Encrypting single part object using SSE-KMS");
        putObjectRequest.setSSEAwsKeyManagementParams(
                kmsKeyId == null ? new SSEAwsKeyManagementParams() : new SSEAwsKeyManagementParams(kmsKeyId));
    }

    if (encryptionMethod.equals(METHOD_SSE_C)) {
        getLogger().info("Encrypting single part object using SSE-C");
        if (StringUtils.isNotBlank(customerKey)) {
            putObjectRequest.setSSECustomerKey(new SSECustomerKey(customerKey));
        }

        String sseCustomerAlgorithm = customerAlgorithm == null ? ObjectMetadata.AES_256_SERVER_SIDE_ENCRYPTION
                : customerAlgorithm;
        putObjectRequest.getMetadata().setSSECustomerAlgorithm(sseCustomerAlgorithm);

        if (StringUtils.isNotBlank(customerKeyMD5)) {
            putObjectRequest.getMetadata().setSSECustomerKeyMd5(customerKeyMD5);
        }
    }
}

From source file:org.apache.nifi.processors.aws.s3.encryption.service.StandardS3ServerSideEncryptionService.java

License:Apache License

public void encrypt(InitiateMultipartUploadRequest initiateMultipartUploadRequest) {
    if (encryptionMethod == null)
        return;//from w w w . j av a 2  s .c o  m

    if (encryptionMethod.equals(METHOD_SSE_S3)) {
        getLogger().info("Encrypting multipart object using SSE-S3");
        initiateMultipartUploadRequest.getObjectMetadata()
                .setSSEAlgorithm(algorithm == null ? ObjectMetadata.AES_256_SERVER_SIDE_ENCRYPTION : algorithm);
    }

    if (encryptionMethod.equals(METHOD_SSE_KMS)) {
        getLogger().info("Encrypting multipart object using SSE-KMS");
        initiateMultipartUploadRequest.setSSEAwsKeyManagementParams(
                kmsKeyId == null ? new SSEAwsKeyManagementParams() : new SSEAwsKeyManagementParams(kmsKeyId));
    }

    if (encryptionMethod.equals(METHOD_SSE_C)) {
        getLogger().info("Encrypting multipart object using SSE-C");
        if (StringUtils.isNotBlank(customerKey)) {
            initiateMultipartUploadRequest.setSSECustomerKey(new SSECustomerKey(customerKey));
        }

        String sseCustomerAlgorithm = customerAlgorithm == null ? ObjectMetadata.AES_256_SERVER_SIDE_ENCRYPTION
                : customerAlgorithm;
        initiateMultipartUploadRequest.getObjectMetadata().setSSECustomerAlgorithm(sseCustomerAlgorithm);

        if (StringUtils.isNotBlank(customerKeyMD5)) {
            initiateMultipartUploadRequest.getObjectMetadata().setSSECustomerKeyMd5(customerKeyMD5);
        }
    }
}