Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
  /*
   * Copyright 2014-2015 Amazon.com, Inc. or its affiliates. All Rights Reserved.
   *
   * Licensed under the Apache License, Version 2.0 (the "License").
   * You may not use this file except in compliance with the License.
   * A copy of the License is located at
   *
   *  http://aws.amazon.com/apache2.0
   *
  * or in the "license" file accompanying this file. This file is distributed
  * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
  * express or implied. See the License for the specific language governing
  * permissions and limitations under the License.
  */
 package com.amazonaws.services.s3.model;
 import static com.amazonaws.services.s3.model.ExtraMaterialsDescription.NONE;
 
 import java.util.Map;
 

An extension of GetObjectRequest to allow additional encryption material description to be specified on a per-request basis. In particular, EncryptedGetObjectRequest is only recognized by com.amazonaws.services.s3.AmazonS3EncryptionClient.

If EncryptedGetObjectRequest is used against the non-encrypting com.amazonaws.services.s3.AmazonS3Client, the additional attributes will be ignored.

The additional material description must not conflict with the existing one saved in S3 or else will cause the get request to fail fast later on.

 
 public class EncryptedGetObjectRequest extends GetObjectRequest {
    
Request specific additional material description; never null.
 
     private ExtraMaterialsDescription supplemental = ;
    
Used to retrieve the S3 encrypted object via instruction file with an explicit suffix. Applicable only if specified (which means non-null and non-blank.)
 
     private String instructionFileSuffix;
    
True if the retrieval of the encrypted object expects the CEK to have been key-wrapped; Default is false.

Note, however, that if CryptoMode.StrictAuthenticatedEncryption is in use, key wrapping is always expected for the CEK regardless.

 
     private boolean keyWrapExpected;
 
     public EncryptedGetObjectRequest(String bucketNameString key) {
         this(bucketNamekeynull);
     }
 
     public EncryptedGetObjectRequest(String bucketNameString key,
             String versionId) {
         super(bucketNamekeyversionId);
         setKey(key);
         setVersionId(versionId);
     }
 
     public EncryptedGetObjectRequest(S3ObjectId s3ObjectId) {
         super(s3ObjectId);
     }
 
     public EncryptedGetObjectRequest(String bucketNameString key,
             boolean isRequesterPays) {
         super(bucketNamekeyisRequesterPays);
     }

    
Returns the supplemental material description to be used for retrieving the encryption materials.

Returns:
the supplemental material description; never null.
 
         return ;
     }

    
Sets the supplemental materials description for the encryption materials to be used with the current request.

Parameters:
supplemental the materialsDescription to set; must not conflict with the existing one saved in S3 or else will cause the get request to fail fast later on
 
     public void setExtraMaterialDescription(
             ExtraMaterialsDescription supplemental) {
        this. = supplemental == null
            ?  : supplemental;
    }

    
Sets the supplemental materials description for the encryption materials to be used with the current request.

Parameters:
supplemental the materialsDescription to set; must not conflict with the existing one saved in S3 or else will cause the get request to fail fast later on
            ExtraMaterialsDescription supplemental) {
        setExtraMaterialDescription(supplemental);
        return this;
    }

    
Fluent API to set the supplemental materials description for the encryption materials to be used with the current request.

Parameters:
supplemental the materialsDescription to set; must not conflict with the existing one saved in S3 or else will cause the get request to fail fast later on
            Map<StringStringsupplemental) {
        setExtraMaterialDescription(supplemental == null ? null
                : new ExtraMaterialsDescription(supplemental));
        return this;
    }
    public String getInstructionFileSuffix() {
        return ;
    }

    
Explicitly sets the suffix of an instruction file to be used to retrieve the S3 encrypted object. Typically this is for more advanced use cases where multiple crypto instruction files have been created for the same S3 object. Each instruction file contains the same CEK encrypted under a different KEK, the IV, and other meta information (aka material description).

Parameters:
instructionFileSuffix suffix of the instruction file to be used.
See also:
com.amazonaws.services.s3.AmazonS3EncryptionClient.putInstructionFile(com.amazonaws.services.s3.model.PutInstructionFileRequest)
    public void setInstructionFileSuffix(String instructionFileSuffix) {
        this. = instructionFileSuffix;
    }

    
Fluent API to explicitly sets the suffix of an instruction file to be used to retrieve the S3 encrypted object. Typically this is for more advanced use cases where multiple crypto instruction files have been created for the same S3 object. Each instruction file contains the same CEK encrypted under a different KEK, the IV, and other meta information (aka material description).

Parameters:
instructionFileSuffix suffix of the instruction file to be used.
See also:
com.amazonaws.services.s3.AmazonS3EncryptionClient.putInstructionFile(com.amazonaws.services.s3.model.PutInstructionFileRequest)
            String instructionFileSuffix) {
        this. = instructionFileSuffix;
        return this;
    }

    
Returns true if key wrapping is expected; false otherwise. Note, however, that if CryptoMode.StrictAuthenticatedEncryption or KMS is in use, key wrapping is always expected for the CEK regardless.
    public boolean isKeyWrapExpected() {
        return ;
    }

    

Parameters:
keyWrapExpected true if key wrapping is expected for the CEK; false otherwse. Note, however, that if CryptoMode.StrictAuthenticatedEncryption or KMS is in use, key wrapping is always expected for the CEK regardless.

If keyWrapExpected is set to true but the CEK is found to be not key-wrapped, it would cause a com.amazonaws.services.s3.KeyWrapException to be thrown.

    public void setKeyWrapExpected(boolean keyWrapExpected) {
        this. = keyWrapExpected;
    }

    
Fluent API for setKeyWrapExpected(boolean).
    public EncryptedGetObjectRequest withKeyWrapExpected(boolean keyWrapExpected) {
        this. = keyWrapExpected;
        return this;
    }
New to GrepCode? Check out our FAQ X