/** * Throws {@link IllegalArgumentException} if SSE customer key is in use * without https. */ private void checkHttps(AmazonWebServiceRequest req) { if (req instanceof SSECustomerKeyProvider) { SSECustomerKeyProvider p = (SSECustomerKeyProvider) req; if (p.getSSECustomerKey() != null) assertHttps(); } else if (req instanceof CopyObjectRequest) { CopyObjectRequest cor = (CopyObjectRequest) req; if (cor.getSourceSSECustomerKey() != null || cor.getDestinationSSECustomerKey() != null) { assertHttps(); } } else if (req instanceof CopyPartRequest) { CopyPartRequest cpr = (CopyPartRequest) req; if (cpr.getSourceSSECustomerKey() != null || cpr.getDestinationSSECustomerKey() != null) { assertHttps(); } } if (req instanceof SSEAwsKeyManagementParamsProvider) { SSEAwsKeyManagementParamsProvider p = (SSEAwsKeyManagementParamsProvider) req; if (p.getSSEAwsKeyManagementParams() != null) assertHttps(); } }
.withLastByte(Long.valueOf(offset + partSize - 1)) .withSourceSSECustomerKey(origReq.getSourceSSECustomerKey()) .withDestinationSSECustomerKey(origReq.getDestinationSSECustomerKey()) .withRequesterPays(origReq.isRequesterPays())
.withAccessControlList(origReq.getAccessControlList()) .withStorageClass(origReq.getStorageClass()) .withSSECustomerKey(origReq.getDestinationSSECustomerKey()) .withSSEAwsKeyManagementParams(origReq.getSSEAwsKeyManagementParams()) .withGeneralProgressListener(origReq.getGeneralProgressListener())
populateSSE_C(request, copyObjectRequest.getDestinationSSECustomerKey());
/** * Constructs a copy part requests and returns it. * * @return Returns a new copy part request */ public synchronized CopyPartRequest getNextCopyPartRequest() { long partSize = Math.min(optimalPartSize, remainingBytes); CopyPartRequest request = new CopyPartRequest() .withSourceBucketName(copyObjectRequest.getSourceBucketName()) .withSourceKey(copyObjectRequest.getSourceKey()) .withUploadId(uploadId) .withPartNumber(partNumber++) .withDestinationBucketName( copyObjectRequest.getDestinationBucketName()) .withDestinationKey(copyObjectRequest.getDestinationKey()) .withSourceVersionId(copyObjectRequest.getSourceVersionId()) .withFirstByte(new Long(offset)) .withLastByte(new Long(offset + partSize - 1)) .withSourceSSECustomerKey(copyObjectRequest.getSourceSSECustomerKey()) .withDestinationSSECustomerKey(copyObjectRequest.getDestinationSSECustomerKey()); setOtherMetadataInRequest(request); offset += partSize; remainingBytes -= partSize; return request; }
if (copyObjectRequest.getDestinationSSECustomerKey() != null) { initiateMultipartUploadRequest.setSSECustomerKey( copyObjectRequest.getDestinationSSECustomerKey());
populateSSE_C(request, copyObjectRequest.getDestinationSSECustomerKey());
/** * Constructs a copy part requests and returns it. * * @return Returns a new copy part request */ public synchronized CopyPartRequest getNextCopyPartRequest() { long partSize = Math.min(optimalPartSize, remainingBytes); CopyPartRequest request = new CopyPartRequest() .withSourceBucketName(copyObjectRequest.getSourceBucketName()) .withSourceKey(copyObjectRequest.getSourceKey()) .withUploadId(uploadId) .withPartNumber(partNumber++) .withDestinationBucketName( copyObjectRequest.getDestinationBucketName()) .withDestinationKey(copyObjectRequest.getDestinationKey()) .withSourceVersionId(copyObjectRequest.getSourceVersionId()) .withFirstByte(new Long(offset)) .withLastByte(new Long(offset + partSize - 1)) .withSourceSSECustomerKey(copyObjectRequest.getSourceSSECustomerKey()) .withDestinationSSECustomerKey(copyObjectRequest.getDestinationSSECustomerKey()); setOtherMetadataInRequest(request); offset += partSize; remainingBytes -= partSize; return request; }
/** * Throws {@link IllegalArgumentException} if SSE customer key is in use * without https. */ private void checkHttps(AmazonWebServiceRequest req) { if (req instanceof SSECustomerKeyProvider) { SSECustomerKeyProvider p = (SSECustomerKeyProvider) req; if (p.getSSECustomerKey() != null) assertHttps(); } else if (req instanceof CopyObjectRequest) { CopyObjectRequest cor = (CopyObjectRequest) req; if (cor.getSourceSSECustomerKey() != null || cor.getDestinationSSECustomerKey() != null) { assertHttps(); } } else if (req instanceof CopyPartRequest) { CopyPartRequest cpr = (CopyPartRequest) req; if (cpr.getSourceSSECustomerKey() != null || cpr.getDestinationSSECustomerKey() != null) { assertHttps(); } } if (req instanceof SSEAwsKeyManagementParamsProvider) { SSEAwsKeyManagementParamsProvider p = (SSEAwsKeyManagementParamsProvider) req; if (p.getSSEAwsKeyManagementParams() != null) assertHttps(); } }
if (copyObjectRequest.getDestinationSSECustomerKey() != null) { initiateMultipartUploadRequest.setSSECustomerKey( copyObjectRequest.getDestinationSSECustomerKey());
.withLastByte(Long.valueOf(offset + partSize - 1)) .withSourceSSECustomerKey(origReq.getSourceSSECustomerKey()) .withDestinationSSECustomerKey(origReq.getDestinationSSECustomerKey()) .withRequesterPays(origReq.isRequesterPays())
/** * Initiates a multipart upload and returns the upload id */ private String initiateMultipartUpload(CopyObjectRequest origReq) { EncryptedInitiateMultipartUploadRequest req = new EncryptedInitiateMultipartUploadRequest( origReq.getDestinationBucketName(), origReq.getDestinationKey()).withCannedACL( origReq.getCannedAccessControlList()) .withRequesterPays(origReq.isRequesterPays()) .withAccessControlList(origReq.getAccessControlList()) .withStorageClass(origReq.getStorageClass()) .withSSECustomerKey(origReq.getDestinationSSECustomerKey()) .withSSEAwsKeyManagementParams(origReq.getSSEAwsKeyManagementParams()) .withGeneralProgressListener(origReq.getGeneralProgressListener()) .withRequestMetricCollector(origReq.getRequestMetricCollector()) ; req.setCreateEncryptionMaterial(false); ObjectMetadata newObjectMetadata = origReq.getNewObjectMetadata(); if (newObjectMetadata == null){ newObjectMetadata = new ObjectMetadata(); } if (newObjectMetadata.getContentType() == null){ newObjectMetadata.setContentType(metadata.getContentType()); } req.setObjectMetadata(newObjectMetadata); populateMetadataWithEncryptionParams(metadata,newObjectMetadata); String uploadId = s3.initiateMultipartUpload(req).getUploadId(); log.debug("Initiated new multipart upload: " + uploadId); return uploadId; }
populateSSE_C(request, copyObjectRequest.getDestinationSSECustomerKey());
populateSSE_C(request, copyObjectRequest.getDestinationSSECustomerKey());