/*
* Copyright 2018-2023 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
* The Amazon Resource Name (key ARN) of the
* asymmetric KMS key from which the public key was downloaded.
*
* The exported public key.
*
* The value is a DER-encoded X.509 public key, also known as
* Instead, use the
* The
* The type of the of the public key that was downloaded.
*
* The permitted use of the public key. Valid values are
* This information is critical. If a public key with
* 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
* The signing algorithms that KMS supports for this key.
*
* This field appears in the response only when the
* The Amazon Resource Name (key ARN) of the
* asymmetric KMS key from which the public key was downloaded.
*
* The Amazon Resource Name (key ARN) of the
* asymmetric KMS key from which the public key was downloaded.
*
* The Amazon Resource Name (key ARN) of the
* asymmetric KMS key from which the public key was downloaded.
*
* The exported public key.
*
* The value is a DER-encoded X.509 public key, also known as
* 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.
* 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.
* KeySpec
field in the GetPublicKey
response.
* 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.
* ENCRYPT_DECRYPT
or SIGN_VERIFY
.
* SIGN_VERIFY
key usage encrypts data outside of
* KMS, the ciphertext cannot be decrypted.
* KeyUsage
of the public key is
* ENCRYPT_DECRYPT
.
* KeyUsage
of the public key is
* SIGN_VERIFY
.
* 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 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 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.
*
* 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.
*
* 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.
*
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.
*
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.
*
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.
*
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 are ENCRYPT_DECRYPT
or SIGN_VERIFY
.
*
* This information is critical. If a public key with SIGN_VERIFY
key usage encrypts data outside of
* KMS, the ciphertext cannot be decrypted.
*
ENCRYPT_DECRYPT
or
* SIGN_VERIFY
.
*
* This information is critical. 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 are ENCRYPT_DECRYPT
or SIGN_VERIFY
.
*
* This information is critical. If a public key with SIGN_VERIFY
key usage encrypts data outside of
* KMS, the ciphertext cannot be decrypted.
*
ENCRYPT_DECRYPT
or
* SIGN_VERIFY
.
*
* This information is critical. 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 are ENCRYPT_DECRYPT
or SIGN_VERIFY
.
*
* This information is critical. If a public key with SIGN_VERIFY
key usage encrypts data outside of
* KMS, the ciphertext cannot be decrypted.
*
ENCRYPT_DECRYPT
or
* SIGN_VERIFY
.
*
* This information is critical. 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 are ENCRYPT_DECRYPT
or SIGN_VERIFY
.
*
* This information is critical. If a public key with SIGN_VERIFY
key usage encrypts data outside of
* KMS, the ciphertext cannot be decrypted.
*
ENCRYPT_DECRYPT
or
* SIGN_VERIFY
.
*
* This information is critical. 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
.
*
* 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
* 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.ListKeyUsage
of the public key is
* ENCRYPT_DECRYPT
.
*
* 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
* 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
* 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.
* KeyUsage
of the public key is
* ENCRYPT_DECRYPT
.
* @see EncryptionAlgorithmSpec
*/
public void setEncryptionAlgorithms(java.util.CollectionKeyUsage
of the public key is
* ENCRYPT_DECRYPT
.
*
* 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
* 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.SdkInternalListKeyUsage
of the public key is
* ENCRYPT_DECRYPT
.
*
* 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
* 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.CollectionKeyUsage
of the public key is
* ENCRYPT_DECRYPT
.
*
* 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
* The signing algorithms that KMS supports for this key.
*
* 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.SdkInternalListKeyUsage
of the public key is
* SIGN_VERIFY
.
*
* This field appears in the response only when the
* 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.ListKeyUsage
of the public key is
* SIGN_VERIFY
.
*
* This field appears in the response only when the
* The signing algorithms that KMS supports for this key.
*
* This field appears in the response only when the
* 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.
* KeyUsage
of the public key is
* SIGN_VERIFY
.
* @see SigningAlgorithmSpec
*/
public void setSigningAlgorithms(java.util.CollectionKeyUsage
of the public key is
* SIGN_VERIFY
.
*
* This field appears in the response only when the
* 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.SdkInternalListKeyUsage
of the public key is
* SIGN_VERIFY
.
*
* This field appears in the response only when the
* 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.CollectionKeyUsage
of the public key is
* SIGN_VERIFY
.
*
* 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