AmazonS3EncryptionClient
for further details.@Deprecated
public class EncryptionUtils
extends java.lang.Object
Constructor and Description |
---|
EncryptionUtils()
Deprecated.
|
Modifier and Type | Method and Description |
---|---|
static S3Object |
adjustOutputToDesiredRange(S3Object object,
long[] range)
Deprecated.
Adjusts the retrieved S3Object so that the object contents contain only
the range of bytes desired by the user.
|
static EncryptionInstruction |
buildInstructionFromInstructionFile(S3Object instructionFile,
EncryptionMaterials materials,
java.security.Provider cryptoProvider)
Deprecated.
|
static EncryptionInstruction |
buildInstructionFromInstructionFile(S3Object instructionFile,
EncryptionMaterialsProvider materialsProvider,
java.security.Provider cryptoProvider)
Deprecated.
Builds an instruction object from the contents of an instruction file.
|
static EncryptionInstruction |
buildInstructionFromObjectMetadata(S3Object object,
EncryptionMaterials materials,
java.security.Provider cryptoProvider)
Deprecated.
|
static EncryptionInstruction |
buildInstructionFromObjectMetadata(S3Object object,
EncryptionMaterialsProvider materialsProvider,
java.security.Provider cryptoProvider)
Deprecated.
Builds an instruction object from the object metadata.
|
static long |
calculateCryptoContentLength(javax.crypto.Cipher symmetricCipher,
UploadPartRequest request)
Deprecated.
Calculates the content length of the crypto.
|
static DeleteObjectRequest |
createInstructionDeleteObjectRequest(DeleteObjectRequest request)
Deprecated.
Creates a delete request to delete an instruction file in S3.
|
static GetObjectRequest |
createInstructionGetRequest(GetObjectRequest request)
Deprecated.
Creates a get request to retrieve an instruction file from S3.
|
static PutObjectRequest |
createInstructionPutRequest(PutObjectRequest request,
EncryptionInstruction instruction)
Deprecated.
Creates a put request to store the specified instruction object in S3.
|
static PutObjectRequest |
createInstructionPutRequest(java.lang.String bucketName,
java.lang.String key,
EncryptionInstruction instruction)
Deprecated.
Creates the Instruction PutObjectRequest.
|
static javax.crypto.Cipher |
createSymmetricCipher(javax.crypto.SecretKey symmetricCryptoKey,
int encryptMode,
java.security.Provider cryptoProvider,
byte[] initVector)
Deprecated.
Creates a symmetric cipher in the specified mode from the given symmetric
key and IV.
|
static S3Object |
decryptObjectUsingInstruction(S3Object object,
EncryptionInstruction instruction)
Deprecated.
Returns an updated object where the object content input stream contains
the decrypted contents.
|
static S3Object |
decryptObjectUsingMetadata(S3Object object,
EncryptionMaterials materials,
java.security.Provider cryptoProvider)
Deprecated.
use buildInstructionFromObjectMetadata and
decryptObjectUsingInstruction instead.
|
static PutObjectRequest |
encryptRequestUsingInstruction(PutObjectRequest request,
EncryptionInstruction instruction)
Deprecated.
Returns an updated request where the input stream contains the encrypted
object contents.
|
static PutObjectRequest |
encryptRequestUsingMetadata(PutObjectRequest request,
EncryptionMaterials materials,
java.security.Provider cryptoProvider)
Deprecated.
use generateInstruction, encryptRequestUsingInstruction, and
updateMetadataWithEncryptionInfo instead
|
static EncryptionInstruction |
generateInstruction(EncryptionMaterials materials,
java.security.Provider cryptoProvider)
Deprecated.
|
static EncryptionInstruction |
generateInstruction(EncryptionMaterialsProvider materialsProvider,
java.util.Map<java.lang.String,java.lang.String> materialsDescription,
java.security.Provider cryptoProvider)
Deprecated.
Constructor.
|
static EncryptionInstruction |
generateInstruction(EncryptionMaterialsProvider materialsProvider,
java.security.Provider cryptoProvider)
Deprecated.
Constructor.
|
static javax.crypto.SecretKey |
generateOneTimeUseSymmetricKey()
Deprecated.
Generates a one-time use Symmetric Key on-the-fly for use in envelope
encryption.
|
static long[] |
getAdjustedCryptoRange(long[] range)
Deprecated.
Adjusts a user specified range to retrieve all of the cipher blocks (each
of size 16 bytes) that contain the specified range.
|
static ByteRangeCapturingInputStream |
getEncryptedInputStream(UploadPartRequest request,
CipherFactory cipherFactory)
Deprecated.
Retrives the encrypted input stream.
|
static byte[] |
getEncryptedSymmetricKey(javax.crypto.SecretKey toBeEncrypted,
EncryptionMaterials materials,
java.security.Provider cryptoProvider)
Deprecated.
Encrypts a symmetric key using the provided encryption materials and
returns it in raw byte array form.
|
static boolean |
isEncryptionInfoInInstructionFile(S3Object instructionFile)
Deprecated.
Returns true if the specified S3Object is an instruction file containing
encryption info, false otherwise.
|
static boolean |
isEncryptionInfoInMetadata(S3Object retrievedObject)
Deprecated.
Returns true if the specified S3Object contains encryption info in its
metadata, false otherwise.
|
static ObjectMetadata |
updateMetadataWithEncryptionInfo(InitiateMultipartUploadRequest request,
byte[] keyBytesToStoreInMetadata,
javax.crypto.Cipher symmetricCipher,
java.util.Map<java.lang.String,java.lang.String> materialsDescription)
Deprecated.
Updates the metadata with the encryption info.
|
static void |
updateMetadataWithEncryptionInstruction(PutObjectRequest request,
EncryptionInstruction instruction)
Deprecated.
Update the request's ObjectMetadata with the necessary information for
decrypting the object
|
@Deprecated public static PutObjectRequest encryptRequestUsingMetadata(PutObjectRequest request, EncryptionMaterials materials, java.security.Provider cryptoProvider)
request
- The request whose contents are to be encrypted.materials
- The encryption materials to be used to encrypt and
decrypt data.cryptoProvider
- The crypto provider whose encryption implementation
will be used to encrypt data@Deprecated public static S3Object decryptObjectUsingMetadata(S3Object object, EncryptionMaterials materials, java.security.Provider cryptoProvider)
object
- The object whose contents are to be decrypted.materials
- The encryption materials to be used to encrypt and
decrypt data.cryptoProvider
- The crypto provider whose encryption implementation
will be used to decrypt data@Deprecated public static EncryptionInstruction generateInstruction(EncryptionMaterials materials, java.security.Provider cryptoProvider)
materials
- The encryption materials to be used to encrypt and
decrypt data.cryptoProvider
- The crypto provider whose encryption implementation
will be used to encrypt and decrypt data.public static EncryptionInstruction generateInstruction(EncryptionMaterialsProvider materialsProvider, java.security.Provider cryptoProvider)
materialsProvider
- The encryption materials provider to be used to encrypt and
decrypt data.cryptoProvider
- The crypto provider whose encryption implementation
will be used to encrypt and decrypt data.public static EncryptionInstruction generateInstruction(EncryptionMaterialsProvider materialsProvider, java.util.Map<java.lang.String,java.lang.String> materialsDescription, java.security.Provider cryptoProvider)
materialsProvider
- The encryption materials provider to be used to encrypt and
decrypt data.materialsDescription
- The map of material to description.cryptoProvider
- The crypto provider whose encryption implementation
will be used to encrypt and decrypt data.@Deprecated public static EncryptionInstruction buildInstructionFromInstructionFile(S3Object instructionFile, EncryptionMaterials materials, java.security.Provider cryptoProvider)
instructionFile
- A non-null instruction file retrieved from S3 that
contains encryption informationmaterials
- The non-null encryption materials to be used to encrypt
and decrypt data.cryptoProvider
- The crypto provider whose encryption implementation
will be used to encrypt and decrypt data. NULL is ok and uses
the preferred provider from Security.getProviders().public static EncryptionInstruction buildInstructionFromInstructionFile(S3Object instructionFile, EncryptionMaterialsProvider materialsProvider, java.security.Provider cryptoProvider)
instructionFile
- A non-null instruction file retrieved from S3 that
contains encryption informationmaterialsProvider
- The non-null encryption materials provider to be
used to encrypt and decrypt data.cryptoProvider
- The crypto provider whose encryption implementation
will be used to encrypt and decrypt data. NULL is ok and uses
the preferred provider from Security.getProviders().@Deprecated public static EncryptionInstruction buildInstructionFromObjectMetadata(S3Object object, EncryptionMaterials materials, java.security.Provider cryptoProvider)
object
- A non-null object that contains encryption information in
its headersmaterials
- The non-null encryption materials to be used to encrypt
and decrypt data.cryptoProvider
- The crypto provider whose encryption implementation
will be used to encrypt and decrypt data. NULL is ok and uses
the preferred provider from Security.getProviders().com.amazonaws.AmazonClientException
- if encryption information is missing in the
metadata, or the encryption materials used to encrypt the
object are not available via the materials Accessorpublic static EncryptionInstruction buildInstructionFromObjectMetadata(S3Object object, EncryptionMaterialsProvider materialsProvider, java.security.Provider cryptoProvider)
object
- A non-null object that contains encryption information in
its headersmaterialsProvider
- The non-null encryption materials provider to be
used to encrypt and decrypt data.cryptoProvider
- The crypto provider whose encryption implementation
will be used to encrypt and decrypt data. NULL is ok and uses
the preferred provider from Security.getProviders().com.amazonaws.AmazonClientException
- if encryption information is missing in the
metadata, or the encryption materials used to encrypt the
object are not available via the materials Accessorpublic static PutObjectRequest encryptRequestUsingInstruction(PutObjectRequest request, EncryptionInstruction instruction)
request
- The request whose contents are to be encrypted.instruction
- The instruction that will be used to encrypt the
object data.public static S3Object decryptObjectUsingInstruction(S3Object object, EncryptionInstruction instruction)
object
- The object whose contents are to be decrypted.instruction
- The instruction that will be used to decrypt the
object data.public static PutObjectRequest createInstructionPutRequest(PutObjectRequest request, EncryptionInstruction instruction)
request
- The put request for the original object to be stored in
S3.instruction
- The instruction object to be stored in S3.public static PutObjectRequest createInstructionPutRequest(java.lang.String bucketName, java.lang.String key, EncryptionInstruction instruction)
bucketName
- the name of the bucket.key
- the key.instruction
- the instruction.public static GetObjectRequest createInstructionGetRequest(GetObjectRequest request)
request
- The get request for the original object to be retrieved
from S3.public static DeleteObjectRequest createInstructionDeleteObjectRequest(DeleteObjectRequest request)
request
- The delete request for the original object to be deleted
from S3.public static boolean isEncryptionInfoInMetadata(S3Object retrievedObject)
retrievedObject
- An S3Objectpublic static boolean isEncryptionInfoInInstructionFile(S3Object instructionFile)
instructionFile
- An S3Object that may potentially be an instruction
filepublic static long[] getAdjustedCryptoRange(long[] range)
range
- A two-element array of longs corresponding to the start and
finish (inclusive) of a desired range of bytes.public static S3Object adjustOutputToDesiredRange(S3Object object, long[] range)
object
- The S3Object retrieved from S3 that could possibly contain
more bytes than desired by the user.range
- A two-element array of longs corresponding to the start and
finish (inclusive) of a desired range of bytes.public static javax.crypto.SecretKey generateOneTimeUseSymmetricKey()
public static javax.crypto.Cipher createSymmetricCipher(javax.crypto.SecretKey symmetricCryptoKey, int encryptMode, java.security.Provider cryptoProvider, byte[] initVector)
symmetricCryptoKey
- the symmetric key.encryptMode
- the encryption mode.cryptoProvider
- tbe crypto provider used to encrypt.initVector
- the IV.public static byte[] getEncryptedSymmetricKey(javax.crypto.SecretKey toBeEncrypted, EncryptionMaterials materials, java.security.Provider cryptoProvider)
toBeEncrypted
- the secret key to be encrypted.materials
- the encryption materials.cryptoProvider
- the crypto provider used to encrypt.public static ByteRangeCapturingInputStream getEncryptedInputStream(UploadPartRequest request, CipherFactory cipherFactory)
request
- the UploadPartRequest to encrypt.cipherFactory
- the CipherFactory used to encrypt.public static void updateMetadataWithEncryptionInstruction(PutObjectRequest request, EncryptionInstruction instruction)
request
- Non-null PUT request encrypted using the given instructioninstruction
- Non-null instruction used to encrypt the data in this
PUT request.public static ObjectMetadata updateMetadataWithEncryptionInfo(InitiateMultipartUploadRequest request, byte[] keyBytesToStoreInMetadata, javax.crypto.Cipher symmetricCipher, java.util.Map<java.lang.String,java.lang.String> materialsDescription)
request
- the request that contains the metadata.keyBytesToStoreInMetadata
- the key in bytes to store in the metadata.symmetricCipher
- the Cipher.materialsDescription
- the map of materials to description.public static long calculateCryptoContentLength(javax.crypto.Cipher symmetricCipher, UploadPartRequest request)
symmetricCipher
- the Cipher.request
- the UploadPartRequest.