public abstract class S3CryptoModuleBase<T extends com.amazonaws.services.s3.internal.crypto.v1.MultipartUploadCryptoContext> extends S3CryptoModule<T>
Modifier and Type | Field and Description |
---|---|
protected ContentCryptoScheme |
contentCryptoScheme |
protected CryptoConfiguration |
cryptoConfig
A read-only copy of the crypto configuration.
|
protected S3CryptoScheme |
cryptoScheme |
protected static int |
DEFAULT_BUFFER_SIZE |
protected EncryptionMaterialsProvider |
kekMaterialsProvider |
protected AWSKMS |
kms |
protected org.apache.commons.logging.Log |
log |
protected Map<String,T> |
multipartUploadContexts
Map of data about in progress encrypted multipart uploads.
|
protected S3Direct |
s3 |
Modifier | Constructor and Description |
---|---|
protected |
S3CryptoModuleBase(AWSKMS kms,
S3Direct s3,
AWSCredentialsProvider credentialsProvider,
EncryptionMaterialsProvider kekMaterialsProvider,
CryptoConfiguration cryptoConfig) |
protected |
S3CryptoModuleBase(S3Direct s3,
AWSCredentialsProvider credentialsProvider,
EncryptionMaterialsProvider kekMaterialsProvider,
CryptoConfiguration cryptoConfig)
For testing purposes only.
|
getObjectSecurely, getObjectSecurely
protected static final int DEFAULT_BUFFER_SIZE
protected final EncryptionMaterialsProvider kekMaterialsProvider
protected final org.apache.commons.logging.Log log
protected final S3CryptoScheme cryptoScheme
protected final ContentCryptoScheme contentCryptoScheme
protected final CryptoConfiguration cryptoConfig
protected final Map<String,T extends com.amazonaws.services.s3.internal.crypto.v1.MultipartUploadCryptoContext> multipartUploadContexts
protected final S3Direct s3
protected final AWSKMS kms
protected S3CryptoModuleBase(AWSKMS kms, S3Direct s3, AWSCredentialsProvider credentialsProvider, EncryptionMaterialsProvider kekMaterialsProvider, CryptoConfiguration cryptoConfig)
cryptoConfig
- a read-only copy of the crypto configuration.protected S3CryptoModuleBase(S3Direct s3, AWSCredentialsProvider credentialsProvider, EncryptionMaterialsProvider kekMaterialsProvider, CryptoConfiguration cryptoConfig)
protected abstract long ciphertextLength(long plaintextLength)
plaintextLength
- a non-negative numberpublic PutObjectResult putObjectSecurely(PutObjectRequest req)
putObjectSecurely
in class S3CryptoModule<T extends com.amazonaws.services.s3.internal.crypto.v1.MultipartUploadCryptoContext>
public final void abortMultipartUploadSecurely(AbortMultipartUploadRequest req)
abortMultipartUploadSecurely
in class S3CryptoModule<T extends com.amazonaws.services.s3.internal.crypto.v1.MultipartUploadCryptoContext>
public final CopyPartResult copyPartSecurely(CopyPartRequest copyPartRequest)
copyPartSecurely
in class S3CryptoModule<T extends com.amazonaws.services.s3.internal.crypto.v1.MultipartUploadCryptoContext>
public InitiateMultipartUploadResult initiateMultipartUploadSecurely(InitiateMultipartUploadRequest req)
initiateMultipartUploadSecurely
in class S3CryptoModule<T extends com.amazonaws.services.s3.internal.crypto.v1.MultipartUploadCryptoContext>
public UploadPartResult uploadPartSecurely(UploadPartRequest req)
NOTE: Because the encryption process requires context from previous blocks, parts uploaded with the AmazonS3EncryptionClient (as opposed to the normal AmazonS3Client) must be uploaded serially, and in order. Otherwise, the previous encryption context isn't available to use when encrypting the current part.
uploadPartSecurely
in class S3CryptoModule<T extends com.amazonaws.services.s3.internal.crypto.v1.MultipartUploadCryptoContext>
protected final CipherLiteInputStream newMultipartS3CipherInputStream(UploadPartRequest req, CipherLite cipherLite)
public CompleteMultipartUploadResult completeMultipartUploadSecurely(CompleteMultipartUploadRequest req)
completeMultipartUploadSecurely
in class S3CryptoModule<T extends com.amazonaws.services.s3.internal.crypto.v1.MultipartUploadCryptoContext>
protected final ObjectMetadata updateMetadataWithContentCryptoMaterial(ObjectMetadata metadata, File file, com.amazonaws.services.s3.internal.crypto.v1.ContentCryptoMaterial instruction)
protected final com.amazonaws.services.s3.internal.crypto.v1.ContentCryptoMaterial createContentCryptoMaterial(AmazonWebServiceRequest req)
SdkClientException
- if no encryption material can be found.public final void putLocalObjectSecurely(UploadObjectRequest reqIn, String uploadId, OutputStream os) throws IOException
putLocalObjectSecurely
in class S3CryptoModule<T extends com.amazonaws.services.s3.internal.crypto.v1.MultipartUploadCryptoContext>
uploadId
- multipart upload idos
- output stream which will be closed upon method completion.IOException
protected final SecretKey generateCEK(EncryptionMaterials kekMaterials)
kekMaterials
- non-null encryption materialsprotected final <R extends AbstractPutObjectRequest> R wrapWithCipher(R request, com.amazonaws.services.s3.internal.crypto.v1.ContentCryptoMaterial cekMaterial)
PutObjectRequest
but has the content as
input stream wrapped with a cipher, and configured with some meta data
and user metadata.protected final long plaintextLength(AbstractPutObjectRequest request, ObjectMetadata metadata)
public final S3CryptoScheme getS3CryptoScheme()
protected final PutObjectRequest updateInstructionPutRequest(PutObjectRequest req, com.amazonaws.services.s3.internal.crypto.v1.ContentCryptoMaterial cekMaterial)
req
- The put-instruction-file request for the instruction file to
be stored in S3.cekMaterial
- The instruction object to be stored in S3.protected final PutObjectRequest createInstructionPutRequest(String bucketName, String key, com.amazonaws.services.s3.internal.crypto.v1.ContentCryptoMaterial cekMaterial)
protected void securityCheck(com.amazonaws.services.s3.internal.crypto.v1.ContentCryptoMaterial cekMaterial, com.amazonaws.services.s3.internal.crypto.v1.S3ObjectWrapper retrieved)
SecurityException
- if the crypto scheme used in the given content crypto
material is not allowed in this crypto module.public final PutObjectResult putInstructionFileSecurely(PutInstructionFileRequest req)
putInstructionFileSecurely
in class S3CryptoModule<T extends com.amazonaws.services.s3.internal.crypto.v1.MultipartUploadCryptoContext>
EncryptedGetObjectRequest
.Copyright © 2022. All rights reserved.