Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
  /*
   * Copyright 2010-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.kms.model;
 
 
Container for the parameters to the Decrypt operation.

Decrypts ciphertext. Ciphertext is plaintext that has been previously encrypted by using the Encrypt function.

 
 public class DecryptRequest extends AmazonWebServiceRequest implements SerializableCloneable {

    
Ciphertext including metadata.

Constraints:
Length: 1 - 6144

 
     private java.nio.ByteBuffer ciphertextBlob;

    
The encryption context. If this was specified in the Encrypt function, it must be specified here or the decryption operation will fail. For more information, see Encryption Context.
 
     private java.util.Map<String,StringencryptionContext;

    
A list of grant tokens that represent grants which can be used to provide long term permissions to perform decryption.

Constraints:
Length: 0 - 10

 
Ciphertext including metadata.

Constraints:
Length: 1 - 6144

Returns:
Ciphertext including metadata.
 
     public java.nio.ByteBuffer getCiphertextBlob() {
         return ;
     }
    
    
Ciphertext including metadata.

Constraints:
Length: 1 - 6144

Parameters:
ciphertextBlob Ciphertext including metadata.
 
     public void setCiphertextBlob(java.nio.ByteBuffer ciphertextBlob) {
         this. = ciphertextBlob;
     }
    
    
Ciphertext including metadata.

Returns a reference to this object so that method calls can be chained together.

Constraints:
Length: 1 - 6144

Parameters:
ciphertextBlob Ciphertext including metadata.
Returns:
A reference to this updated object so that method calls can be chained together.
 
     public DecryptRequest withCiphertextBlob(java.nio.ByteBuffer ciphertextBlob) {
         this. = ciphertextBlob;
         return this;
     }

    
The encryption context. If this was specified in the Encrypt function, it must be specified here or the decryption operation will fail. For more information, see Encryption Context.

Returns:
The encryption context. If this was specified in the Encrypt function, it must be specified here or the decryption operation will fail. For more information, see Encryption Context.
        
        if ( == null) {
             = new java.util.HashMap<String,String>();
        }
        return ;
    }
    
    
The encryption context. If this was specified in the Encrypt function, it must be specified here or the decryption operation will fail. For more information, see Encryption Context.

Parameters:
encryptionContext The encryption context. If this was specified in the Encrypt function, it must be specified here or the decryption operation will fail. For more information, see Encryption Context.
    public void setEncryptionContext(java.util.Map<String,StringencryptionContext) {
        this. = encryptionContext;
    }
    
    
The encryption context. If this was specified in the Encrypt function, it must be specified here or the decryption operation will fail. For more information, see Encryption Context.

Returns a reference to this object so that method calls can be chained together.

Parameters:
encryptionContext The encryption context. If this was specified in the Encrypt function, it must be specified here or the decryption operation will fail. For more information, see Encryption Context.
Returns:
A reference to this updated object so that method calls can be chained together.
    public DecryptRequest withEncryptionContext(java.util.Map<String,StringencryptionContext) {
        setEncryptionContext(encryptionContext);
        return this;
    }

    
The encryption context. If this was specified in the Encrypt function, it must be specified here or the decryption operation will fail. For more information, see Encryption Context.

The method adds a new key-value pair into EncryptionContext parameter, and returns a reference to this object so that method calls can be chained together.

Parameters:
key The key of the entry to be added into EncryptionContext.
value The corresponding value of the entry to be added into EncryptionContext.
    if (null == this.) {
      this. = new java.util.HashMap<String,String>();
    }
    if (this..containsKey(key))
      throw new IllegalArgumentException("Duplicated keys (" + key.toString() + ") are provided.");
    this..put(keyvalue);
    return this;
  }

  
Removes all the entries added into EncryptionContext.

Returns a reference to this object so that method calls can be chained together.

    this. = null;
    return this;
  }
  
    
A list of grant tokens that represent grants which can be used to provide long term permissions to perform decryption.

Constraints:
Length: 0 - 10

Returns:
A list of grant tokens that represent grants which can be used to provide long term permissions to perform decryption.
    public java.util.List<StringgetGrantTokens() {
        if ( == null) {
               = new com.amazonaws.internal.ListWithAutoConstructFlag<String>();
              .setAutoConstruct(true);
        }
        return ;
    }
    
    
A list of grant tokens that represent grants which can be used to provide long term permissions to perform decryption.

Constraints:
Length: 0 - 10

Parameters:
grantTokens A list of grant tokens that represent grants which can be used to provide long term permissions to perform decryption.
    public void setGrantTokens(java.util.Collection<StringgrantTokens) {
        if (grantTokens == null) {
            this. = null;
            return;
        }
        grantTokensCopy.addAll(grantTokens);
        this. = grantTokensCopy;
    }
    
    
A list of grant tokens that represent grants which can be used to provide long term permissions to perform decryption.

NOTE: This method appends the values to the existing list (if any). Use setGrantTokens(java.util.Collection) or withGrantTokens(java.util.Collection) if you want to override the existing values.

Returns a reference to this object so that method calls can be chained together.

Constraints:
Length: 0 - 10

Parameters:
grantTokens A list of grant tokens that represent grants which can be used to provide long term permissions to perform decryption.
Returns:
A reference to this updated object so that method calls can be chained together.
    public DecryptRequest withGrantTokens(String... grantTokens) {
        if (getGrantTokens() == nullsetGrantTokens(new java.util.ArrayList<String>(grantTokens.length));
        for (String value : grantTokens) {
            getGrantTokens().add(value);
        }
        return this;
    }
    
    
A list of grant tokens that represent grants which can be used to provide long term permissions to perform decryption.

Returns a reference to this object so that method calls can be chained together.

Constraints:
Length: 0 - 10

Parameters:
grantTokens A list of grant tokens that represent grants which can be used to provide long term permissions to perform decryption.
Returns:
A reference to this updated object so that method calls can be chained together.
    public DecryptRequest withGrantTokens(java.util.Collection<StringgrantTokens) {
        if (grantTokens == null) {
            this. = null;
        } else {
            com.amazonaws.internal.ListWithAutoConstructFlag<StringgrantTokensCopy = new com.amazonaws.internal.ListWithAutoConstructFlag<String>(grantTokens.size());
            grantTokensCopy.addAll(grantTokens);
            this. = grantTokensCopy;
        }
        return this;
    }

    
Returns a string representation of this object; useful for testing and debugging.

Returns:
A string representation of this object.
See also:
java.lang.Object.toString()
    @Override
    public String toString() {
        StringBuilder sb = new StringBuilder();
        sb.append("{");
        if (getCiphertextBlob() != nullsb.append("CiphertextBlob: " + getCiphertextBlob() + ",");
        if (getEncryptionContext() != nullsb.append("EncryptionContext: " + getEncryptionContext() + ",");
        if (getGrantTokens() != nullsb.append("GrantTokens: " + getGrantTokens() );
        sb.append("}");
        return sb.toString();
    }
    
    @Override
    public int hashCode() {
        final int prime = 31;
        int hashCode = 1;
        
        hashCode = prime * hashCode + ((getCiphertextBlob() == null) ? 0 : getCiphertextBlob().hashCode()); 
        hashCode = prime * hashCode + ((getEncryptionContext() == null) ? 0 : getEncryptionContext().hashCode()); 
        hashCode = prime * hashCode + ((getGrantTokens() == null) ? 0 : getGrantTokens().hashCode()); 
        return hashCode;
    }
    
    @Override
    public boolean equals(Object obj) {
        if (this == objreturn true;
        if (obj == nullreturn false;
        if (obj instanceof DecryptRequest == falsereturn false;
        DecryptRequest other = (DecryptRequest)obj;
        
        if (other.getCiphertextBlob() == null ^ this.getCiphertextBlob() == nullreturn false;
        if (other.getCiphertextBlob() != null && other.getCiphertextBlob().equals(this.getCiphertextBlob()) == falsereturn false
        if (other.getEncryptionContext() == null ^ this.getEncryptionContext() == nullreturn false;
        if (other.getEncryptionContext() != null && other.getEncryptionContext().equals(this.getEncryptionContext()) == falsereturn false
        if (other.getGrantTokens() == null ^ this.getGrantTokens() == nullreturn false;
        if (other.getGrantTokens() != null && other.getGrantTokens().equals(this.getGrantTokens()) == falsereturn false
        return true;
    }
    
    @Override
    public DecryptRequest clone() {
        
            return (DecryptRequestsuper.clone();
    }
}
    
New to GrepCode? Check out our FAQ X