com.amazonaws.services.kms.model.GetPublicKeyResult Maven / Gradle / Ivy
Show all versions of aws-java-sdk-kms Show documentation
/*
* Copyright 2019-2024 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;
import java.io.Serializable;
import javax.annotation.Generated;
/**
*
* @see AWS API
* Documentation
*/
@Generated("com.amazonaws:aws-java-sdk-code-generator")
public class GetPublicKeyResult extends com.amazonaws.AmazonWebServiceResult implements Serializable, Cloneable {
/**
*
* The Amazon Resource Name (key ARN) of the
* asymmetric KMS key from which the public key was downloaded.
*
*/
private String keyId;
/**
*
* The exported public key.
*
*
* The value is a DER-encoded X.509 public key, also known as SubjectPublicKeyInfo
(SPKI), as defined
* in RFC 5280. When you use the HTTP API or the Amazon Web
* Services CLI, the value is Base64-encoded. Otherwise, it is not Base64-encoded.
*
*
*/
private java.nio.ByteBuffer publicKey;
/**
*
* Instead, use the KeySpec
field in the GetPublicKey
response.
*
*
* The KeySpec
and CustomerMasterKeySpec
fields have the same value. We recommend that you
* use the KeySpec
field in your code. However, to avoid breaking changes, KMS supports both fields.
*
*/
@Deprecated
private String customerMasterKeySpec;
/**
*
* The type of the of the public key that was downloaded.
*
*/
private String keySpec;
/**
*
* The permitted use of the public key. Valid values for asymmetric key pairs are ENCRYPT_DECRYPT
,
* SIGN_VERIFY
, and KEY_AGREEMENT
.
*
*
* This information is critical. For example, if a public key with SIGN_VERIFY
key usage encrypts data
* outside of KMS, the ciphertext cannot be decrypted.
*
*/
private String keyUsage;
/**
*
* The encryption algorithms that KMS supports for this key.
*
*
* This information is critical. If a public key encrypts data outside of KMS by using an unsupported encryption
* algorithm, the ciphertext cannot be decrypted.
*
*
* This field appears in the response only when the KeyUsage
of the public key is
* ENCRYPT_DECRYPT
.
*
*/
private com.amazonaws.internal.SdkInternalList encryptionAlgorithms;
/**
*
* The signing algorithms that KMS supports for this key.
*
*
* This field appears in the response only when the KeyUsage
of the public key is
* SIGN_VERIFY
.
*
*/
private com.amazonaws.internal.SdkInternalList signingAlgorithms;
/**
*
* The key agreement algorithm used to derive a shared secret. This field is present only when the KMS key has a
* KeyUsage
value of KEY_AGREEMENT
.
*
*/
private com.amazonaws.internal.SdkInternalList keyAgreementAlgorithms;
/**
*
* The Amazon Resource Name (key ARN) of the
* asymmetric KMS key from which the public key was downloaded.
*
*
* @param keyId
* The Amazon Resource Name (key ARN) of
* the asymmetric KMS key from which the public key was downloaded.
*/
public void setKeyId(String keyId) {
this.keyId = keyId;
}
/**
*
* The Amazon Resource Name (key ARN) of the
* asymmetric KMS key from which the public key was downloaded.
*
*
* @return The Amazon Resource Name (key ARN) of
* the asymmetric KMS key from which the public key was downloaded.
*/
public String getKeyId() {
return this.keyId;
}
/**
*
* The Amazon Resource Name (key ARN) of the
* asymmetric KMS key from which the public key was downloaded.
*
*
* @param keyId
* The Amazon Resource Name (key ARN) of
* the asymmetric KMS key from which the public key was downloaded.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public GetPublicKeyResult withKeyId(String keyId) {
setKeyId(keyId);
return this;
}
/**
*
* The exported public key.
*
*
* The value is a DER-encoded X.509 public key, also known as SubjectPublicKeyInfo
(SPKI), as defined
* in RFC 5280. When you use the HTTP API or the Amazon Web
* Services CLI, the value is Base64-encoded. Otherwise, it is not Base64-encoded.
*
*
*
* The AWS SDK for Java performs a Base64 encoding on this field before sending this request to the AWS service.
* Users of the SDK should not perform Base64 encoding on this field.
*
*
* Warning: ByteBuffers returned by the SDK are mutable. Changes to the content or position of the byte buffer will
* be seen by all objects that have a reference to this object. It is recommended to call ByteBuffer.duplicate() or
* ByteBuffer.asReadOnlyBuffer() before using or reading from the buffer. This behavior will be changed in a future
* major version of the SDK.
*
*
* @param publicKey
* The exported public key.
*
* The value is a DER-encoded X.509 public key, also known as SubjectPublicKeyInfo
(SPKI), as
* defined in RFC 5280. When you use the HTTP API or the
* Amazon Web Services CLI, the value is Base64-encoded. Otherwise, it is not Base64-encoded.
*
*/
public void setPublicKey(java.nio.ByteBuffer publicKey) {
this.publicKey = publicKey;
}
/**
*
* The exported public key.
*
*
* The value is a DER-encoded X.509 public key, also known as SubjectPublicKeyInfo
(SPKI), as defined
* in RFC 5280. When you use the HTTP API or the Amazon Web
* Services CLI, the value is Base64-encoded. Otherwise, it is not Base64-encoded.
*
*
*
* {@code ByteBuffer}s are stateful. Calling their {@code get} methods changes their {@code position}. We recommend
* using {@link java.nio.ByteBuffer#asReadOnlyBuffer()} to create a read-only view of the buffer with an independent
* {@code position}, and calling {@code get} methods on this rather than directly on the returned {@code ByteBuffer}.
* Doing so will ensure that anyone else using the {@code ByteBuffer} will not be affected by changes to the
* {@code position}.
*
*
* @return The exported public key.
*
* The value is a DER-encoded X.509 public key, also known as SubjectPublicKeyInfo
(SPKI), as
* defined in RFC 5280. When you use the HTTP API or the
* Amazon Web Services CLI, the value is Base64-encoded. Otherwise, it is not Base64-encoded.
*
*/
public java.nio.ByteBuffer getPublicKey() {
return this.publicKey;
}
/**
*
* The exported public key.
*
*
* The value is a DER-encoded X.509 public key, also known as SubjectPublicKeyInfo
(SPKI), as defined
* in RFC 5280. When you use the HTTP API or the Amazon Web
* Services CLI, the value is Base64-encoded. Otherwise, it is not Base64-encoded.
*
*
*
* The AWS SDK for Java performs a Base64 encoding on this field before sending this request to the AWS service.
* Users of the SDK should not perform Base64 encoding on this field.
*
*
* Warning: ByteBuffers returned by the SDK are mutable. Changes to the content or position of the byte buffer will
* be seen by all objects that have a reference to this object. It is recommended to call ByteBuffer.duplicate() or
* ByteBuffer.asReadOnlyBuffer() before using or reading from the buffer. This behavior will be changed in a future
* major version of the SDK.
*
*
* @param publicKey
* The exported public key.
*
* The value is a DER-encoded X.509 public key, also known as SubjectPublicKeyInfo
(SPKI), as
* defined in RFC 5280. When you use the HTTP API or the
* Amazon Web Services CLI, the value is Base64-encoded. Otherwise, it is not Base64-encoded.
*
* @return Returns a reference to this object so that method calls can be chained together.
*/
public GetPublicKeyResult withPublicKey(java.nio.ByteBuffer publicKey) {
setPublicKey(publicKey);
return this;
}
/**
*
* Instead, use the KeySpec
field in the GetPublicKey
response.
*
*
* The KeySpec
and CustomerMasterKeySpec
fields have the same value. We recommend that you
* use the KeySpec
field in your code. However, to avoid breaking changes, KMS supports both fields.
*
*
* @param customerMasterKeySpec
* Instead, use the KeySpec
field in the GetPublicKey
response.
*
* The KeySpec
and CustomerMasterKeySpec
fields have the same value. We recommend
* that you use the KeySpec
field in your code. However, to avoid breaking changes, KMS supports
* both fields.
* @see CustomerMasterKeySpec
*/
@Deprecated
public void setCustomerMasterKeySpec(String customerMasterKeySpec) {
this.customerMasterKeySpec = customerMasterKeySpec;
}
/**
*
* Instead, use the KeySpec
field in the GetPublicKey
response.
*
*
* The KeySpec
and CustomerMasterKeySpec
fields have the same value. We recommend that you
* use the KeySpec
field in your code. However, to avoid breaking changes, KMS supports both fields.
*
*
* @return Instead, use the KeySpec
field in the GetPublicKey
response.
*
* The KeySpec
and CustomerMasterKeySpec
fields have the same value. We recommend
* that you use the KeySpec
field in your code. However, to avoid breaking changes, KMS
* supports both fields.
* @see CustomerMasterKeySpec
*/
@Deprecated
public String getCustomerMasterKeySpec() {
return this.customerMasterKeySpec;
}
/**
*
* Instead, use the KeySpec
field in the GetPublicKey
response.
*
*
* The KeySpec
and CustomerMasterKeySpec
fields have the same value. We recommend that you
* use the KeySpec
field in your code. However, to avoid breaking changes, KMS supports both fields.
*
*
* @param customerMasterKeySpec
* Instead, use the KeySpec
field in the GetPublicKey
response.
*
* The KeySpec
and CustomerMasterKeySpec
fields have the same value. We recommend
* that you use the KeySpec
field in your code. However, to avoid breaking changes, KMS supports
* both fields.
* @return Returns a reference to this object so that method calls can be chained together.
* @see CustomerMasterKeySpec
*/
@Deprecated
public GetPublicKeyResult withCustomerMasterKeySpec(String customerMasterKeySpec) {
setCustomerMasterKeySpec(customerMasterKeySpec);
return this;
}
/**
*
* Instead, use the KeySpec
field in the GetPublicKey
response.
*
*
* The KeySpec
and CustomerMasterKeySpec
fields have the same value. We recommend that you
* use the KeySpec
field in your code. However, to avoid breaking changes, KMS supports both fields.
*
*
* @param customerMasterKeySpec
* Instead, use the KeySpec
field in the GetPublicKey
response.
*
* The KeySpec
and CustomerMasterKeySpec
fields have the same value. We recommend
* that you use the KeySpec
field in your code. However, to avoid breaking changes, KMS supports
* both fields.
* @return Returns a reference to this object so that method calls can be chained together.
* @see CustomerMasterKeySpec
*/
@Deprecated
public GetPublicKeyResult withCustomerMasterKeySpec(CustomerMasterKeySpec customerMasterKeySpec) {
this.customerMasterKeySpec = customerMasterKeySpec.toString();
return this;
}
/**
*
* The type of the of the public key that was downloaded.
*
*
* @param keySpec
* The type of the of the public key that was downloaded.
* @see KeySpec
*/
public void setKeySpec(String keySpec) {
this.keySpec = keySpec;
}
/**
*
* The type of the of the public key that was downloaded.
*
*
* @return The type of the of the public key that was downloaded.
* @see KeySpec
*/
public String getKeySpec() {
return this.keySpec;
}
/**
*
* The type of the of the public key that was downloaded.
*
*
* @param keySpec
* The type of the of the public key that was downloaded.
* @return Returns a reference to this object so that method calls can be chained together.
* @see KeySpec
*/
public GetPublicKeyResult withKeySpec(String keySpec) {
setKeySpec(keySpec);
return this;
}
/**
*
* The type of the of the public key that was downloaded.
*
*
* @param keySpec
* The type of the of the public key that was downloaded.
* @return Returns a reference to this object so that method calls can be chained together.
* @see KeySpec
*/
public GetPublicKeyResult withKeySpec(KeySpec keySpec) {
this.keySpec = keySpec.toString();
return this;
}
/**
*
* The permitted use of the public key. Valid values for asymmetric key pairs are ENCRYPT_DECRYPT
,
* SIGN_VERIFY
, and KEY_AGREEMENT
.
*
*
* This information is critical. For example, if a public key with SIGN_VERIFY
key usage encrypts data
* outside of KMS, the ciphertext cannot be decrypted.
*
*
* @param keyUsage
* The permitted use of the public key. Valid values for asymmetric key pairs are
* ENCRYPT_DECRYPT
, SIGN_VERIFY
, and KEY_AGREEMENT
.
*
* This information is critical. For example, if a public key with SIGN_VERIFY
key usage
* encrypts data outside of KMS, the ciphertext cannot be decrypted.
* @see KeyUsageType
*/
public void setKeyUsage(String keyUsage) {
this.keyUsage = keyUsage;
}
/**
*
* The permitted use of the public key. Valid values for asymmetric key pairs are ENCRYPT_DECRYPT
,
* SIGN_VERIFY
, and KEY_AGREEMENT
.
*
*
* This information is critical. For example, if a public key with SIGN_VERIFY
key usage encrypts data
* outside of KMS, the ciphertext cannot be decrypted.
*
*
* @return The permitted use of the public key. Valid values for asymmetric key pairs are
* ENCRYPT_DECRYPT
, SIGN_VERIFY
, and KEY_AGREEMENT
.
*
* This information is critical. For example, if a public key with SIGN_VERIFY
key usage
* encrypts data outside of KMS, the ciphertext cannot be decrypted.
* @see KeyUsageType
*/
public String getKeyUsage() {
return this.keyUsage;
}
/**
*
* The permitted use of the public key. Valid values for asymmetric key pairs are ENCRYPT_DECRYPT
,
* SIGN_VERIFY
, and KEY_AGREEMENT
.
*
*
* This information is critical. For example, if a public key with SIGN_VERIFY
key usage encrypts data
* outside of KMS, the ciphertext cannot be decrypted.
*
*
* @param keyUsage
* The permitted use of the public key. Valid values for asymmetric key pairs are
* ENCRYPT_DECRYPT
, SIGN_VERIFY
, and KEY_AGREEMENT
.
*
* This information is critical. For example, if a public key with SIGN_VERIFY
key usage
* encrypts data outside of KMS, the ciphertext cannot be decrypted.
* @return Returns a reference to this object so that method calls can be chained together.
* @see KeyUsageType
*/
public GetPublicKeyResult withKeyUsage(String keyUsage) {
setKeyUsage(keyUsage);
return this;
}
/**
*
* The permitted use of the public key. Valid values for asymmetric key pairs are ENCRYPT_DECRYPT
,
* SIGN_VERIFY
, and KEY_AGREEMENT
.
*
*
* This information is critical. For example, if a public key with SIGN_VERIFY
key usage encrypts data
* outside of KMS, the ciphertext cannot be decrypted.
*
*
* @param keyUsage
* The permitted use of the public key. Valid values for asymmetric key pairs are
* ENCRYPT_DECRYPT
, SIGN_VERIFY
, and KEY_AGREEMENT
.
*
* This information is critical. For example, if a public key with SIGN_VERIFY
key usage
* encrypts data outside of KMS, the ciphertext cannot be decrypted.
* @return Returns a reference to this object so that method calls can be chained together.
* @see KeyUsageType
*/
public GetPublicKeyResult withKeyUsage(KeyUsageType keyUsage) {
this.keyUsage = keyUsage.toString();
return this;
}
/**
*
* The encryption algorithms that KMS supports for this key.
*
*
* This information is critical. If a public key encrypts data outside of KMS by using an unsupported encryption
* algorithm, the ciphertext cannot be decrypted.
*
*
* This field appears in the response only when the KeyUsage
of the public key is
* ENCRYPT_DECRYPT
.
*
*
* @return The encryption algorithms that KMS supports for this key.
*
* This information is critical. If a public key encrypts data outside of KMS by using an unsupported
* encryption algorithm, the ciphertext cannot be decrypted.
*
*
* This field appears in the response only when the KeyUsage
of the public key is
* ENCRYPT_DECRYPT
.
* @see EncryptionAlgorithmSpec
*/
public java.util.List getEncryptionAlgorithms() {
if (encryptionAlgorithms == null) {
encryptionAlgorithms = new com.amazonaws.internal.SdkInternalList();
}
return encryptionAlgorithms;
}
/**
*
* The encryption algorithms that KMS supports for this key.
*
*
* This information is critical. If a public key encrypts data outside of KMS by using an unsupported encryption
* algorithm, the ciphertext cannot be decrypted.
*
*
* This field appears in the response only when the KeyUsage
of the public key is
* ENCRYPT_DECRYPT
.
*
*
* @param encryptionAlgorithms
* The encryption algorithms that KMS supports for this key.
*
* This information is critical. If a public key encrypts data outside of KMS by using an unsupported
* encryption algorithm, the ciphertext cannot be decrypted.
*
*
* This field appears in the response only when the KeyUsage
of the public key is
* ENCRYPT_DECRYPT
.
* @see EncryptionAlgorithmSpec
*/
public void setEncryptionAlgorithms(java.util.Collection encryptionAlgorithms) {
if (encryptionAlgorithms == null) {
this.encryptionAlgorithms = null;
return;
}
this.encryptionAlgorithms = new com.amazonaws.internal.SdkInternalList(encryptionAlgorithms);
}
/**
*
* The encryption algorithms that KMS supports for this key.
*
*
* This information is critical. If a public key encrypts data outside of KMS by using an unsupported encryption
* algorithm, the ciphertext cannot be decrypted.
*
*
* This field appears in the response only when the KeyUsage
of the public key is
* ENCRYPT_DECRYPT
.
*
*
* NOTE: This method appends the values to the existing list (if any). Use
* {@link #setEncryptionAlgorithms(java.util.Collection)} or {@link #withEncryptionAlgorithms(java.util.Collection)}
* if you want to override the existing values.
*
*
* @param encryptionAlgorithms
* The encryption algorithms that KMS supports for this key.
*
* This information is critical. If a public key encrypts data outside of KMS by using an unsupported
* encryption algorithm, the ciphertext cannot be decrypted.
*
*
* This field appears in the response only when the KeyUsage
of the public key is
* ENCRYPT_DECRYPT
.
* @return Returns a reference to this object so that method calls can be chained together.
* @see EncryptionAlgorithmSpec
*/
public GetPublicKeyResult withEncryptionAlgorithms(String... encryptionAlgorithms) {
if (this.encryptionAlgorithms == null) {
setEncryptionAlgorithms(new com.amazonaws.internal.SdkInternalList(encryptionAlgorithms.length));
}
for (String ele : encryptionAlgorithms) {
this.encryptionAlgorithms.add(ele);
}
return this;
}
/**
*
* The encryption algorithms that KMS supports for this key.
*
*
* This information is critical. If a public key encrypts data outside of KMS by using an unsupported encryption
* algorithm, the ciphertext cannot be decrypted.
*
*
* This field appears in the response only when the KeyUsage
of the public key is
* ENCRYPT_DECRYPT
.
*
*
* @param encryptionAlgorithms
* The encryption algorithms that KMS supports for this key.
*
* This information is critical. If a public key encrypts data outside of KMS by using an unsupported
* encryption algorithm, the ciphertext cannot be decrypted.
*
*
* This field appears in the response only when the KeyUsage
of the public key is
* ENCRYPT_DECRYPT
.
* @return Returns a reference to this object so that method calls can be chained together.
* @see EncryptionAlgorithmSpec
*/
public GetPublicKeyResult withEncryptionAlgorithms(java.util.Collection encryptionAlgorithms) {
setEncryptionAlgorithms(encryptionAlgorithms);
return this;
}
/**
*
* The encryption algorithms that KMS supports for this key.
*
*
* This information is critical. If a public key encrypts data outside of KMS by using an unsupported encryption
* algorithm, the ciphertext cannot be decrypted.
*
*
* This field appears in the response only when the KeyUsage
of the public key is
* ENCRYPT_DECRYPT
.
*
*
* @param encryptionAlgorithms
* The encryption algorithms that KMS supports for this key.
*
* This information is critical. If a public key encrypts data outside of KMS by using an unsupported
* encryption algorithm, the ciphertext cannot be decrypted.
*
*
* This field appears in the response only when the KeyUsage
of the public key is
* ENCRYPT_DECRYPT
.
* @return Returns a reference to this object so that method calls can be chained together.
* @see EncryptionAlgorithmSpec
*/
public GetPublicKeyResult withEncryptionAlgorithms(EncryptionAlgorithmSpec... encryptionAlgorithms) {
com.amazonaws.internal.SdkInternalList encryptionAlgorithmsCopy = new com.amazonaws.internal.SdkInternalList(
encryptionAlgorithms.length);
for (EncryptionAlgorithmSpec value : encryptionAlgorithms) {
encryptionAlgorithmsCopy.add(value.toString());
}
if (getEncryptionAlgorithms() == null) {
setEncryptionAlgorithms(encryptionAlgorithmsCopy);
} else {
getEncryptionAlgorithms().addAll(encryptionAlgorithmsCopy);
}
return this;
}
/**
*
* The signing algorithms that KMS supports for this key.
*
*
* This field appears in the response only when the KeyUsage
of the public key is
* SIGN_VERIFY
.
*
*
* @return The signing algorithms that KMS supports for this key.
*
* This field appears in the response only when the KeyUsage
of the public key is
* SIGN_VERIFY
.
* @see SigningAlgorithmSpec
*/
public java.util.List getSigningAlgorithms() {
if (signingAlgorithms == null) {
signingAlgorithms = new com.amazonaws.internal.SdkInternalList();
}
return signingAlgorithms;
}
/**
*
* The signing algorithms that KMS supports for this key.
*
*
* This field appears in the response only when the KeyUsage
of the public key is
* SIGN_VERIFY
.
*
*
* @param signingAlgorithms
* The signing algorithms that KMS supports for this key.
*
* This field appears in the response only when the KeyUsage
of the public key is
* SIGN_VERIFY
.
* @see SigningAlgorithmSpec
*/
public void setSigningAlgorithms(java.util.Collection signingAlgorithms) {
if (signingAlgorithms == null) {
this.signingAlgorithms = null;
return;
}
this.signingAlgorithms = new com.amazonaws.internal.SdkInternalList(signingAlgorithms);
}
/**
*
* The signing algorithms that KMS supports for this key.
*
*
* This field appears in the response only when the KeyUsage
of the public key is
* SIGN_VERIFY
.
*
*
* NOTE: This method appends the values to the existing list (if any). Use
* {@link #setSigningAlgorithms(java.util.Collection)} or {@link #withSigningAlgorithms(java.util.Collection)} if
* you want to override the existing values.
*
*
* @param signingAlgorithms
* The signing algorithms that KMS supports for this key.
*
* This field appears in the response only when the KeyUsage
of the public key is
* SIGN_VERIFY
.
* @return Returns a reference to this object so that method calls can be chained together.
* @see SigningAlgorithmSpec
*/
public GetPublicKeyResult withSigningAlgorithms(String... signingAlgorithms) {
if (this.signingAlgorithms == null) {
setSigningAlgorithms(new com.amazonaws.internal.SdkInternalList(signingAlgorithms.length));
}
for (String ele : signingAlgorithms) {
this.signingAlgorithms.add(ele);
}
return this;
}
/**
*
* The signing algorithms that KMS supports for this key.
*
*
* This field appears in the response only when the KeyUsage
of the public key is
* SIGN_VERIFY
.
*
*
* @param signingAlgorithms
* The signing algorithms that KMS supports for this key.
*
* This field appears in the response only when the KeyUsage
of the public key is
* SIGN_VERIFY
.
* @return Returns a reference to this object so that method calls can be chained together.
* @see SigningAlgorithmSpec
*/
public GetPublicKeyResult withSigningAlgorithms(java.util.Collection signingAlgorithms) {
setSigningAlgorithms(signingAlgorithms);
return this;
}
/**
*
* The signing algorithms that KMS supports for this key.
*
*
* This field appears in the response only when the KeyUsage
of the public key is
* SIGN_VERIFY
.
*
*
* @param signingAlgorithms
* The signing algorithms that KMS supports for this key.
*
* This field appears in the response only when the KeyUsage
of the public key is
* SIGN_VERIFY
.
* @return Returns a reference to this object so that method calls can be chained together.
* @see SigningAlgorithmSpec
*/
public GetPublicKeyResult withSigningAlgorithms(SigningAlgorithmSpec... signingAlgorithms) {
com.amazonaws.internal.SdkInternalList signingAlgorithmsCopy = new com.amazonaws.internal.SdkInternalList(signingAlgorithms.length);
for (SigningAlgorithmSpec value : signingAlgorithms) {
signingAlgorithmsCopy.add(value.toString());
}
if (getSigningAlgorithms() == null) {
setSigningAlgorithms(signingAlgorithmsCopy);
} else {
getSigningAlgorithms().addAll(signingAlgorithmsCopy);
}
return this;
}
/**
*
* The key agreement algorithm used to derive a shared secret. This field is present only when the KMS key has a
* KeyUsage
value of KEY_AGREEMENT
.
*
*
* @return The key agreement algorithm used to derive a shared secret. This field is present only when the KMS key
* has a KeyUsage
value of KEY_AGREEMENT
.
* @see KeyAgreementAlgorithmSpec
*/
public java.util.List getKeyAgreementAlgorithms() {
if (keyAgreementAlgorithms == null) {
keyAgreementAlgorithms = new com.amazonaws.internal.SdkInternalList();
}
return keyAgreementAlgorithms;
}
/**
*
* The key agreement algorithm used to derive a shared secret. This field is present only when the KMS key has a
* KeyUsage
value of KEY_AGREEMENT
.
*
*
* @param keyAgreementAlgorithms
* The key agreement algorithm used to derive a shared secret. This field is present only when the KMS key
* has a KeyUsage
value of KEY_AGREEMENT
.
* @see KeyAgreementAlgorithmSpec
*/
public void setKeyAgreementAlgorithms(java.util.Collection keyAgreementAlgorithms) {
if (keyAgreementAlgorithms == null) {
this.keyAgreementAlgorithms = null;
return;
}
this.keyAgreementAlgorithms = new com.amazonaws.internal.SdkInternalList(keyAgreementAlgorithms);
}
/**
*
* The key agreement algorithm used to derive a shared secret. This field is present only when the KMS key has a
* KeyUsage
value of KEY_AGREEMENT
.
*
*
* NOTE: This method appends the values to the existing list (if any). Use
* {@link #setKeyAgreementAlgorithms(java.util.Collection)} or
* {@link #withKeyAgreementAlgorithms(java.util.Collection)} if you want to override the existing values.
*
*
* @param keyAgreementAlgorithms
* The key agreement algorithm used to derive a shared secret. This field is present only when the KMS key
* has a KeyUsage
value of KEY_AGREEMENT
.
* @return Returns a reference to this object so that method calls can be chained together.
* @see KeyAgreementAlgorithmSpec
*/
public GetPublicKeyResult withKeyAgreementAlgorithms(String... keyAgreementAlgorithms) {
if (this.keyAgreementAlgorithms == null) {
setKeyAgreementAlgorithms(new com.amazonaws.internal.SdkInternalList(keyAgreementAlgorithms.length));
}
for (String ele : keyAgreementAlgorithms) {
this.keyAgreementAlgorithms.add(ele);
}
return this;
}
/**
*
* The key agreement algorithm used to derive a shared secret. This field is present only when the KMS key has a
* KeyUsage
value of KEY_AGREEMENT
.
*
*
* @param keyAgreementAlgorithms
* The key agreement algorithm used to derive a shared secret. This field is present only when the KMS key
* has a KeyUsage
value of KEY_AGREEMENT
.
* @return Returns a reference to this object so that method calls can be chained together.
* @see KeyAgreementAlgorithmSpec
*/
public GetPublicKeyResult withKeyAgreementAlgorithms(java.util.Collection keyAgreementAlgorithms) {
setKeyAgreementAlgorithms(keyAgreementAlgorithms);
return this;
}
/**
*
* The key agreement algorithm used to derive a shared secret. This field is present only when the KMS key has a
* KeyUsage
value of KEY_AGREEMENT
.
*
*
* @param keyAgreementAlgorithms
* The key agreement algorithm used to derive a shared secret. This field is present only when the KMS key
* has a KeyUsage
value of KEY_AGREEMENT
.
* @return Returns a reference to this object so that method calls can be chained together.
* @see KeyAgreementAlgorithmSpec
*/
public GetPublicKeyResult withKeyAgreementAlgorithms(KeyAgreementAlgorithmSpec... keyAgreementAlgorithms) {
com.amazonaws.internal.SdkInternalList keyAgreementAlgorithmsCopy = new com.amazonaws.internal.SdkInternalList(
keyAgreementAlgorithms.length);
for (KeyAgreementAlgorithmSpec value : keyAgreementAlgorithms) {
keyAgreementAlgorithmsCopy.add(value.toString());
}
if (getKeyAgreementAlgorithms() == null) {
setKeyAgreementAlgorithms(keyAgreementAlgorithmsCopy);
} else {
getKeyAgreementAlgorithms().addAll(keyAgreementAlgorithmsCopy);
}
return this;
}
/**
* Returns a string representation of this object. This is useful for testing and debugging. Sensitive data will be
* redacted from this string using a placeholder value.
*
* @return A string representation of this object.
*
* @see java.lang.Object#toString()
*/
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("{");
if (getKeyId() != null)
sb.append("KeyId: ").append(getKeyId()).append(",");
if (getPublicKey() != null)
sb.append("PublicKey: ").append(getPublicKey()).append(",");
if (getCustomerMasterKeySpec() != null)
sb.append("CustomerMasterKeySpec: ").append(getCustomerMasterKeySpec()).append(",");
if (getKeySpec() != null)
sb.append("KeySpec: ").append(getKeySpec()).append(",");
if (getKeyUsage() != null)
sb.append("KeyUsage: ").append(getKeyUsage()).append(",");
if (getEncryptionAlgorithms() != null)
sb.append("EncryptionAlgorithms: ").append(getEncryptionAlgorithms()).append(",");
if (getSigningAlgorithms() != null)
sb.append("SigningAlgorithms: ").append(getSigningAlgorithms()).append(",");
if (getKeyAgreementAlgorithms() != null)
sb.append("KeyAgreementAlgorithms: ").append(getKeyAgreementAlgorithms());
sb.append("}");
return sb.toString();
}
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (obj instanceof GetPublicKeyResult == false)
return false;
GetPublicKeyResult other = (GetPublicKeyResult) obj;
if (other.getKeyId() == null ^ this.getKeyId() == null)
return false;
if (other.getKeyId() != null && other.getKeyId().equals(this.getKeyId()) == false)
return false;
if (other.getPublicKey() == null ^ this.getPublicKey() == null)
return false;
if (other.getPublicKey() != null && other.getPublicKey().equals(this.getPublicKey()) == false)
return false;
if (other.getCustomerMasterKeySpec() == null ^ this.getCustomerMasterKeySpec() == null)
return false;
if (other.getCustomerMasterKeySpec() != null && other.getCustomerMasterKeySpec().equals(this.getCustomerMasterKeySpec()) == false)
return false;
if (other.getKeySpec() == null ^ this.getKeySpec() == null)
return false;
if (other.getKeySpec() != null && other.getKeySpec().equals(this.getKeySpec()) == false)
return false;
if (other.getKeyUsage() == null ^ this.getKeyUsage() == null)
return false;
if (other.getKeyUsage() != null && other.getKeyUsage().equals(this.getKeyUsage()) == false)
return false;
if (other.getEncryptionAlgorithms() == null ^ this.getEncryptionAlgorithms() == null)
return false;
if (other.getEncryptionAlgorithms() != null && other.getEncryptionAlgorithms().equals(this.getEncryptionAlgorithms()) == false)
return false;
if (other.getSigningAlgorithms() == null ^ this.getSigningAlgorithms() == null)
return false;
if (other.getSigningAlgorithms() != null && other.getSigningAlgorithms().equals(this.getSigningAlgorithms()) == false)
return false;
if (other.getKeyAgreementAlgorithms() == null ^ this.getKeyAgreementAlgorithms() == null)
return false;
if (other.getKeyAgreementAlgorithms() != null && other.getKeyAgreementAlgorithms().equals(this.getKeyAgreementAlgorithms()) == false)
return false;
return true;
}
@Override
public int hashCode() {
final int prime = 31;
int hashCode = 1;
hashCode = prime * hashCode + ((getKeyId() == null) ? 0 : getKeyId().hashCode());
hashCode = prime * hashCode + ((getPublicKey() == null) ? 0 : getPublicKey().hashCode());
hashCode = prime * hashCode + ((getCustomerMasterKeySpec() == null) ? 0 : getCustomerMasterKeySpec().hashCode());
hashCode = prime * hashCode + ((getKeySpec() == null) ? 0 : getKeySpec().hashCode());
hashCode = prime * hashCode + ((getKeyUsage() == null) ? 0 : getKeyUsage().hashCode());
hashCode = prime * hashCode + ((getEncryptionAlgorithms() == null) ? 0 : getEncryptionAlgorithms().hashCode());
hashCode = prime * hashCode + ((getSigningAlgorithms() == null) ? 0 : getSigningAlgorithms().hashCode());
hashCode = prime * hashCode + ((getKeyAgreementAlgorithms() == null) ? 0 : getKeyAgreementAlgorithms().hashCode());
return hashCode;
}
@Override
public GetPublicKeyResult clone() {
try {
return (GetPublicKeyResult) super.clone();
} catch (CloneNotSupportedException e) {
throw new IllegalStateException("Got a CloneNotSupportedException from Object.clone() " + "even though we're Cloneable!", e);
}
}
}