...
AWS SDK for Go API Reference
We announced the upcoming end-of-support for AWS SDK for Go (v1). We recommend that you migrate to AWS SDK for Go v2. For dates, additional details, and information on how to migrate, please refer to the linked announcement.
import "github.com/aws/aws-sdk-go/service/kms"
Overview
Examples
Constants

Overview ▾

Package kms provides the client and types for making API requests to AWS Key Management Service.

Key Management Service (KMS) is an encryption and key management web service. This guide describes the KMS operations that you can call programmatically. For general information about KMS, see the Key Management Service Developer Guide (https://docs.aws.amazon.com/kms/latest/developerguide/).

KMS has replaced the term customer master key (CMK) with KMS key and KMS key. The concept has not changed. To prevent breaking changes, KMS is keeping some variations of this term.

Amazon Web Services provides SDKs that consist of libraries and sample code for various programming languages and platforms (Java, Ruby, .Net, macOS, Android, etc.). The SDKs provide a convenient way to create programmatic access to KMS and other Amazon Web Services services. For example, the SDKs take care of tasks such as signing requests (see below), managing errors, and retrying requests automatically. For more information about the Amazon Web Services SDKs, including how to download and install them, see Tools for Amazon Web Services (http://aws.amazon.com/tools/).

We recommend that you use the Amazon Web Services SDKs to make programmatic API calls to KMS.

If you need to use FIPS 140-2 validated cryptographic modules when communicating with Amazon Web Services, use the FIPS endpoint in your preferred Amazon Web Services Region. For more information about the available FIPS endpoints, see Service endpoints (https://docs.aws.amazon.com/general/latest/gr/kms.html#kms_region) in the Key Management Service topic of the Amazon Web Services General Reference.

All KMS API calls must be signed and be transmitted using Transport Layer Security (TLS). KMS recommends you always use the latest supported TLS version. Clients must also support cipher suites with Perfect Forward Secrecy (PFS) such as Ephemeral Diffie-Hellman (DHE) or Elliptic Curve Ephemeral Diffie-Hellman (ECDHE). Most modern systems such as Java 7 and later support these modes.

Signing Requests

Requests must be signed using an access key ID and a secret access key. We strongly recommend that you do not use your Amazon Web Services account root access key ID and secret access key for everyday work. You can use the access key ID and secret access key for an IAM user or you can use the Security Token Service (STS) to generate temporary security credentials and use those to sign requests.

All KMS requests must be signed with Signature Version 4 (https://docs.aws.amazon.com/general/latest/gr/signature-version-4.html).

Logging API Requests

KMS supports CloudTrail, a service that logs Amazon Web Services API calls and related events for your Amazon Web Services account and delivers them to an Amazon S3 bucket that you specify. By using the information collected by CloudTrail, you can determine what requests were made to KMS, who made the request, when it was made, and so on. To learn more about CloudTrail, including how to turn it on and find your log files, see the CloudTrail User Guide (https://docs.aws.amazon.com/awscloudtrail/latest/userguide/).

Additional Resources

For more information about credentials and request signing, see the following:

Commonly Used API Operations

Of the API operations discussed in this guide, the following will prove the most useful for most applications. You will likely perform operations other than these, such as creating keys and assigning policies, by using the console.

  • Encrypt

  • Decrypt

  • GenerateDataKey

  • GenerateDataKeyWithoutPlaintext

See https://docs.aws.amazon.com/goto/WebAPI/kms-2014-11-01 for more information on this service.

See kms package documentation for more information. https://docs.aws.amazon.com/sdk-for-go/api/service/kms/

Using the Client

To contact AWS Key Management Service with the SDK use the New function to create a new service client. With that client you can make API requests to the service. These clients are safe to use concurrently.

See the SDK's documentation for more information on how to use the SDK. https://docs.aws.amazon.com/sdk-for-go/api/

See aws.Config documentation for more information on configuring SDK clients. https://docs.aws.amazon.com/sdk-for-go/api/aws/#Config

See the AWS Key Management Service client KMS for more information on creating client for this service. https://docs.aws.amazon.com/sdk-for-go/api/service/kms/#New

The stub package, kmsiface, can be used to provide alternative implementations of service clients, such as mocking the client for testing.

Types ▾

type KMS
func New(p client.ConfigProvider, cfgs ...*aws.Config) *KMS
func (c *KMS) CancelKeyDeletion(input *CancelKeyDeletionInput) (*CancelKeyDeletionOutput, error)
func (c *KMS) CancelKeyDeletionRequest(input *CancelKeyDeletionInput) (req *request.Request, output *CancelKeyDeletionOutput)
func (c *KMS) CancelKeyDeletionWithContext(ctx aws.Context, input *CancelKeyDeletionInput, opts ...request.Option) (*CancelKeyDeletionOutput, error)
func (c *KMS) ConnectCustomKeyStore(input *ConnectCustomKeyStoreInput) (*ConnectCustomKeyStoreOutput, error)
func (c *KMS) ConnectCustomKeyStoreRequest(input *ConnectCustomKeyStoreInput) (req *request.Request, output *ConnectCustomKeyStoreOutput)
func (c *KMS) ConnectCustomKeyStoreWithContext(ctx aws.Context, input *ConnectCustomKeyStoreInput, opts ...request.Option) (*ConnectCustomKeyStoreOutput, error)
func (c *KMS) CreateAlias(input *CreateAliasInput) (*CreateAliasOutput, error)
func (c *KMS) CreateAliasRequest(input *CreateAliasInput) (req *request.Request, output *CreateAliasOutput)
func (c *KMS) CreateAliasWithContext(ctx aws.Context, input *CreateAliasInput, opts ...request.Option) (*CreateAliasOutput, error)
func (c *KMS) CreateCustomKeyStore(input *CreateCustomKeyStoreInput) (*CreateCustomKeyStoreOutput, error)
func (c *KMS) CreateCustomKeyStoreRequest(input *CreateCustomKeyStoreInput) (req *request.Request, output *CreateCustomKeyStoreOutput)
func (c *KMS) CreateCustomKeyStoreWithContext(ctx aws.Context, input *CreateCustomKeyStoreInput, opts ...request.Option) (*CreateCustomKeyStoreOutput, error)
func (c *KMS) CreateGrant(input *CreateGrantInput) (*CreateGrantOutput, error)
func (c *KMS) CreateGrantRequest(input *CreateGrantInput) (req *request.Request, output *CreateGrantOutput)
func (c *KMS) CreateGrantWithContext(ctx aws.Context, input *CreateGrantInput, opts ...request.Option) (*CreateGrantOutput, error)
func (c *KMS) CreateKey(input *CreateKeyInput) (*CreateKeyOutput, error)
func (c *KMS) CreateKeyRequest(input *CreateKeyInput) (req *request.Request, output *CreateKeyOutput)
func (c *KMS) CreateKeyWithContext(ctx aws.Context, input *CreateKeyInput, opts ...request.Option) (*CreateKeyOutput, error)
func (c *KMS) Decrypt(input *DecryptInput) (*DecryptOutput, error)
func (c *KMS) DecryptRequest(input *DecryptInput) (req *request.Request, output *DecryptOutput)
func (c *KMS) DecryptWithContext(ctx aws.Context, input *DecryptInput, opts ...request.Option) (*DecryptOutput, error)
func (c *KMS) DeleteAlias(input *DeleteAliasInput) (*DeleteAliasOutput, error)
func (c *KMS) DeleteAliasRequest(input *DeleteAliasInput) (req *request.Request, output *DeleteAliasOutput)
func (c *KMS) DeleteAliasWithContext(ctx aws.Context, input *DeleteAliasInput, opts ...request.Option) (*DeleteAliasOutput, error)
func (c *KMS) DeleteCustomKeyStore(input *DeleteCustomKeyStoreInput) (*DeleteCustomKeyStoreOutput, error)
func (c *KMS) DeleteCustomKeyStoreRequest(input *DeleteCustomKeyStoreInput) (req *request.Request, output *DeleteCustomKeyStoreOutput)
func (c *KMS) DeleteCustomKeyStoreWithContext(ctx aws.Context, input *DeleteCustomKeyStoreInput, opts ...request.Option) (*DeleteCustomKeyStoreOutput, error)
func (c *KMS) DeleteImportedKeyMaterial(input *DeleteImportedKeyMaterialInput) (*DeleteImportedKeyMaterialOutput, error)
func (c *KMS) DeleteImportedKeyMaterialRequest(input *DeleteImportedKeyMaterialInput) (req *request.Request, output *DeleteImportedKeyMaterialOutput)
func (c *KMS) DeleteImportedKeyMaterialWithContext(ctx aws.Context, input *DeleteImportedKeyMaterialInput, opts ...request.Option) (*DeleteImportedKeyMaterialOutput, error)
func (c *KMS) DeriveSharedSecret(input *DeriveSharedSecretInput) (*DeriveSharedSecretOutput, error)
func (c *KMS) DeriveSharedSecretRequest(input *DeriveSharedSecretInput) (req *request.Request, output *DeriveSharedSecretOutput)
func (c *KMS) DeriveSharedSecretWithContext(ctx aws.Context, input *DeriveSharedSecretInput, opts ...request.Option) (*DeriveSharedSecretOutput, error)
func (c *KMS) DescribeCustomKeyStores(input *DescribeCustomKeyStoresInput) (*DescribeCustomKeyStoresOutput, error)
func (c *KMS) DescribeCustomKeyStoresPages(input *DescribeCustomKeyStoresInput, fn func(*DescribeCustomKeyStoresOutput, bool) bool) error
func (c *KMS) DescribeCustomKeyStoresPagesWithContext(ctx aws.Context, input *DescribeCustomKeyStoresInput, fn func(*DescribeCustomKeyStoresOutput, bool) bool, opts ...request.Option) error
func (c *KMS) DescribeCustomKeyStoresRequest(input *DescribeCustomKeyStoresInput) (req *request.Request, output *DescribeCustomKeyStoresOutput)
func (c *KMS) DescribeCustomKeyStoresWithContext(ctx aws.Context, input *DescribeCustomKeyStoresInput, opts ...request.Option) (*DescribeCustomKeyStoresOutput, error)
func (c *KMS) DescribeKey(input *DescribeKeyInput) (*DescribeKeyOutput, error)
func (c *KMS) DescribeKeyRequest(input *DescribeKeyInput) (req *request.Request, output *DescribeKeyOutput)
func (c *KMS) DescribeKeyWithContext(ctx aws.Context, input *DescribeKeyInput, opts ...request.Option) (*DescribeKeyOutput, error)
func (c *KMS) DisableKey(input *DisableKeyInput) (*DisableKeyOutput, error)
func (c *KMS) DisableKeyRequest(input *DisableKeyInput) (req *request.Request, output *DisableKeyOutput)
func (c *KMS) DisableKeyRotation(input *DisableKeyRotationInput) (*DisableKeyRotationOutput, error)
func (c *KMS) DisableKeyRotationRequest(input *DisableKeyRotationInput) (req *request.Request, output *DisableKeyRotationOutput)
func (c *KMS) DisableKeyRotationWithContext(ctx aws.Context, input *DisableKeyRotationInput, opts ...request.Option) (*DisableKeyRotationOutput, error)
func (c *KMS) DisableKeyWithContext(ctx aws.Context, input *DisableKeyInput, opts ...request.Option) (*DisableKeyOutput, error)
func (c *KMS) DisconnectCustomKeyStore(input *DisconnectCustomKeyStoreInput) (*DisconnectCustomKeyStoreOutput, error)
func (c *KMS) DisconnectCustomKeyStoreRequest(input *DisconnectCustomKeyStoreInput) (req *request.Request, output *DisconnectCustomKeyStoreOutput)
func (c *KMS) DisconnectCustomKeyStoreWithContext(ctx aws.Context, input *DisconnectCustomKeyStoreInput, opts ...request.Option) (*DisconnectCustomKeyStoreOutput, error)
func (c *KMS) EnableKey(input *EnableKeyInput) (*EnableKeyOutput, error)
func (c *KMS) EnableKeyRequest(input *EnableKeyInput) (req *request.Request, output *EnableKeyOutput)
func (c *KMS) EnableKeyRotation(input *EnableKeyRotationInput) (*EnableKeyRotationOutput, error)
func (c *KMS) EnableKeyRotationRequest(input *EnableKeyRotationInput) (req *request.Request, output *EnableKeyRotationOutput)
func (c *KMS) EnableKeyRotationWithContext(ctx aws.Context, input *EnableKeyRotationInput, opts ...request.Option) (*EnableKeyRotationOutput, error)
func (c *KMS) EnableKeyWithContext(ctx aws.Context, input *EnableKeyInput, opts ...request.Option) (*EnableKeyOutput, error)
func (c *KMS) Encrypt(input *EncryptInput) (*EncryptOutput, error)
func (c *KMS) EncryptRequest(input *EncryptInput) (req *request.Request, output *EncryptOutput)
func (c *KMS) EncryptWithContext(ctx aws.Context, input *EncryptInput, opts ...request.Option) (*EncryptOutput, error)
func (c *KMS) GenerateDataKey(input *GenerateDataKeyInput) (*GenerateDataKeyOutput, error)
func (c *KMS) GenerateDataKeyPair(input *GenerateDataKeyPairInput) (*GenerateDataKeyPairOutput, error)
func (c *KMS) GenerateDataKeyPairRequest(input *GenerateDataKeyPairInput) (req *request.Request, output *GenerateDataKeyPairOutput)
func (c *KMS) GenerateDataKeyPairWithContext(ctx aws.Context, input *GenerateDataKeyPairInput, opts ...request.Option) (*GenerateDataKeyPairOutput, error)
func (c *KMS) GenerateDataKeyPairWithoutPlaintext(input *GenerateDataKeyPairWithoutPlaintextInput) (*GenerateDataKeyPairWithoutPlaintextOutput, error)
func (c *KMS) GenerateDataKeyPairWithoutPlaintextRequest(input *GenerateDataKeyPairWithoutPlaintextInput) (req *request.Request, output *GenerateDataKeyPairWithoutPlaintextOutput)
func (c *KMS) GenerateDataKeyPairWithoutPlaintextWithContext(ctx aws.Context, input *GenerateDataKeyPairWithoutPlaintextInput, opts ...request.Option) (*GenerateDataKeyPairWithoutPlaintextOutput, error)
func (c *KMS) GenerateDataKeyRequest(input *GenerateDataKeyInput) (req *request.Request, output *GenerateDataKeyOutput)
func (c *KMS) GenerateDataKeyWithContext(ctx aws.Context, input *GenerateDataKeyInput, opts ...request.Option) (*GenerateDataKeyOutput, error)
func (c *KMS) GenerateDataKeyWithoutPlaintext(input *GenerateDataKeyWithoutPlaintextInput) (*GenerateDataKeyWithoutPlaintextOutput, error)
func (c *KMS) GenerateDataKeyWithoutPlaintextRequest(input *GenerateDataKeyWithoutPlaintextInput) (req *request.Request, output *GenerateDataKeyWithoutPlaintextOutput)
func (c *KMS) GenerateDataKeyWithoutPlaintextWithContext(ctx aws.Context, input *GenerateDataKeyWithoutPlaintextInput, opts ...request.Option) (*GenerateDataKeyWithoutPlaintextOutput, error)
func (c *KMS) GenerateMac(input *GenerateMacInput) (*GenerateMacOutput, error)
func (c *KMS) GenerateMacRequest(input *GenerateMacInput) (req *request.Request, output *GenerateMacOutput)
func (c *KMS) GenerateMacWithContext(ctx aws.Context, input *GenerateMacInput, opts ...request.Option) (*GenerateMacOutput, error)
func (c *KMS) GenerateRandom(input *GenerateRandomInput) (*GenerateRandomOutput, error)
func (c *KMS) GenerateRandomRequest(input *GenerateRandomInput) (req *request.Request, output *GenerateRandomOutput)
func (c *KMS) GenerateRandomWithContext(ctx aws.Context, input *GenerateRandomInput, opts ...request.Option) (*GenerateRandomOutput, error)
func (c *KMS) GetKeyPolicy(input *GetKeyPolicyInput) (*GetKeyPolicyOutput, error)
func (c *KMS) GetKeyPolicyRequest(input *GetKeyPolicyInput) (req *request.Request, output *GetKeyPolicyOutput)
func (c *KMS) GetKeyPolicyWithContext(ctx aws.Context, input *GetKeyPolicyInput, opts ...request.Option) (*GetKeyPolicyOutput, error)
func (c *KMS) GetKeyRotationStatus(input *GetKeyRotationStatusInput) (*GetKeyRotationStatusOutput, error)
func (c *KMS) GetKeyRotationStatusRequest(input *GetKeyRotationStatusInput) (req *request.Request, output *GetKeyRotationStatusOutput)
func (c *KMS) GetKeyRotationStatusWithContext(ctx aws.Context, input *GetKeyRotationStatusInput, opts ...request.Option) (*GetKeyRotationStatusOutput, error)
func (c *KMS) GetParametersForImport(input *GetParametersForImportInput) (*GetParametersForImportOutput, error)
func (c *KMS) GetParametersForImportRequest(input *GetParametersForImportInput) (req *request.Request, output *GetParametersForImportOutput)
func (c *KMS) GetParametersForImportWithContext(ctx aws.Context, input *GetParametersForImportInput, opts ...request.Option) (*GetParametersForImportOutput, error)
func (c *KMS) GetPublicKey(input *GetPublicKeyInput) (*GetPublicKeyOutput, error)
func (c *KMS) GetPublicKeyRequest(input *GetPublicKeyInput) (req *request.Request, output *GetPublicKeyOutput)
func (c *KMS) GetPublicKeyWithContext(ctx aws.Context, input *GetPublicKeyInput, opts ...request.Option) (*GetPublicKeyOutput, error)
func (c *KMS) ImportKeyMaterial(input *ImportKeyMaterialInput) (*ImportKeyMaterialOutput, error)
func (c *KMS) ImportKeyMaterialRequest(input *ImportKeyMaterialInput) (req *request.Request, output *ImportKeyMaterialOutput)
func (c *KMS) ImportKeyMaterialWithContext(ctx aws.Context, input *ImportKeyMaterialInput, opts ...request.Option) (*ImportKeyMaterialOutput, error)
func (c *KMS) ListAliases(input *ListAliasesInput) (*ListAliasesOutput, error)
func (c *KMS) ListAliasesPages(input *ListAliasesInput, fn func(*ListAliasesOutput, bool) bool) error
func (c *KMS) ListAliasesPagesWithContext(ctx aws.Context, input *ListAliasesInput, fn func(*ListAliasesOutput, bool) bool, opts ...request.Option) error
func (c *KMS) ListAliasesRequest(input *ListAliasesInput) (req *request.Request, output *ListAliasesOutput)
func (c *KMS) ListAliasesWithContext(ctx aws.Context, input *ListAliasesInput, opts ...request.Option) (*ListAliasesOutput, error)
func (c *KMS) ListGrants(input *ListGrantsInput) (*ListGrantsResponse, error)
func (c *KMS) ListGrantsPages(input *ListGrantsInput, fn func(*ListGrantsResponse, bool) bool) error
func (c *KMS) ListGrantsPagesWithContext(ctx aws.Context, input *ListGrantsInput, fn func(*ListGrantsResponse, bool) bool, opts ...request.Option) error
func (c *KMS) ListGrantsRequest(input *ListGrantsInput) (req *request.Request, output *ListGrantsResponse)
func (c *KMS) ListGrantsWithContext(ctx aws.Context, input *ListGrantsInput, opts ...request.Option) (*ListGrantsResponse, error)
func (c *KMS) ListKeyPolicies(input *ListKeyPoliciesInput) (*ListKeyPoliciesOutput, error)
func (c *KMS) ListKeyPoliciesPages(input *ListKeyPoliciesInput, fn func(*ListKeyPoliciesOutput, bool) bool) error
func (c *KMS) ListKeyPoliciesPagesWithContext(ctx aws.Context, input *ListKeyPoliciesInput, fn func(*ListKeyPoliciesOutput, bool) bool, opts ...request.Option) error
func (c *KMS) ListKeyPoliciesRequest(input *ListKeyPoliciesInput) (req *request.Request, output *ListKeyPoliciesOutput)
func (c *KMS) ListKeyPoliciesWithContext(ctx aws.Context, input *ListKeyPoliciesInput, opts ...request.Option) (*ListKeyPoliciesOutput, error)
func (c *KMS) ListKeyRotations(input *ListKeyRotationsInput) (*ListKeyRotationsOutput, error)
func (c *KMS) ListKeyRotationsPages(input *ListKeyRotationsInput, fn func(*ListKeyRotationsOutput, bool) bool) error
func (c *KMS) ListKeyRotationsPagesWithContext(ctx aws.Context, input *ListKeyRotationsInput, fn func(*ListKeyRotationsOutput, bool) bool, opts ...request.Option) error
func (c *KMS) ListKeyRotationsRequest(input *ListKeyRotationsInput) (req *request.Request, output *ListKeyRotationsOutput)
func (c *KMS) ListKeyRotationsWithContext(ctx aws.Context, input *ListKeyRotationsInput, opts ...request.Option) (*ListKeyRotationsOutput, error)
func (c *KMS) ListKeys(input *ListKeysInput) (*ListKeysOutput, error)
func (c *KMS) ListKeysPages(input *ListKeysInput, fn func(*ListKeysOutput, bool) bool) error
func (c *KMS) ListKeysPagesWithContext(ctx aws.Context, input *ListKeysInput, fn func(*ListKeysOutput, bool) bool, opts ...request.Option) error
func (c *KMS) ListKeysRequest(input *ListKeysInput) (req *request.Request, output *ListKeysOutput)
func (c *KMS) ListKeysWithContext(ctx aws.Context, input *ListKeysInput, opts ...request.Option) (*ListKeysOutput, error)
func (c *KMS) ListResourceTags(input *ListResourceTagsInput) (*ListResourceTagsOutput, error)
func (c *KMS) ListResourceTagsPages(input *ListResourceTagsInput, fn func(*ListResourceTagsOutput, bool) bool) error
func (c *KMS) ListResourceTagsPagesWithContext(ctx aws.Context, input *ListResourceTagsInput, fn func(*ListResourceTagsOutput, bool) bool, opts ...request.Option) error
func (c *KMS) ListResourceTagsRequest(input *ListResourceTagsInput) (req *request.Request, output *ListResourceTagsOutput)
func (c *KMS) ListResourceTagsWithContext(ctx aws.Context, input *ListResourceTagsInput, opts ...request.Option) (*ListResourceTagsOutput, error)
func (c *KMS) ListRetirableGrants(input *ListRetirableGrantsInput) (*ListGrantsResponse, error)
func (c *KMS) ListRetirableGrantsPages(input *ListRetirableGrantsInput, fn func(*ListGrantsResponse, bool) bool) error
func (c *KMS) ListRetirableGrantsPagesWithContext(ctx aws.Context, input *ListRetirableGrantsInput, fn func(*ListGrantsResponse, bool) bool, opts ...request.Option) error
func (c *KMS) ListRetirableGrantsRequest(input *ListRetirableGrantsInput) (req *request.Request, output *ListGrantsResponse)
func (c *KMS) ListRetirableGrantsWithContext(ctx aws.Context, input *ListRetirableGrantsInput, opts ...request.Option) (*ListGrantsResponse, error)
func (c *KMS) PutKeyPolicy(input *PutKeyPolicyInput) (*PutKeyPolicyOutput, error)
func (c *KMS) PutKeyPolicyRequest(input *PutKeyPolicyInput) (req *request.Request, output *PutKeyPolicyOutput)
func (c *KMS) PutKeyPolicyWithContext(ctx aws.Context, input *PutKeyPolicyInput, opts ...request.Option) (*PutKeyPolicyOutput, error)
func (c *KMS) ReEncrypt(input *ReEncryptInput) (*ReEncryptOutput, error)
func (c *KMS) ReEncryptRequest(input *ReEncryptInput) (req *request.Request, output *ReEncryptOutput)
func (c *KMS) ReEncryptWithContext(ctx aws.Context, input *ReEncryptInput, opts ...request.Option) (*ReEncryptOutput, error)
func (c *KMS) ReplicateKey(input *ReplicateKeyInput) (*ReplicateKeyOutput, error)
func (c *KMS) ReplicateKeyRequest(input *ReplicateKeyInput) (req *request.Request, output *ReplicateKeyOutput)
func (c *KMS) ReplicateKeyWithContext(ctx aws.Context, input *ReplicateKeyInput, opts ...request.Option) (*ReplicateKeyOutput, error)
func (c *KMS) RetireGrant(input *RetireGrantInput) (*RetireGrantOutput, error)
func (c *KMS) RetireGrantRequest(input *RetireGrantInput) (req *request.Request, output *RetireGrantOutput)
func (c *KMS) RetireGrantWithContext(ctx aws.Context, input *RetireGrantInput, opts ...request.Option) (*RetireGrantOutput, error)
func (c *KMS) RevokeGrant(input *RevokeGrantInput) (*RevokeGrantOutput, error)
func (c *KMS) RevokeGrantRequest(input *RevokeGrantInput) (req *request.Request, output *RevokeGrantOutput)
func (c *KMS) RevokeGrantWithContext(ctx aws.Context, input *RevokeGrantInput, opts ...request.Option) (*RevokeGrantOutput, error)
func (c *KMS) RotateKeyOnDemand(input *RotateKeyOnDemandInput) (*RotateKeyOnDemandOutput, error)
func (c *KMS) RotateKeyOnDemandRequest(input *RotateKeyOnDemandInput) (req *request.Request, output *RotateKeyOnDemandOutput)
func (c *KMS) RotateKeyOnDemandWithContext(ctx aws.Context, input *RotateKeyOnDemandInput, opts ...request.Option) (*RotateKeyOnDemandOutput, error)
func (c *KMS) ScheduleKeyDeletion(input *ScheduleKeyDeletionInput) (*ScheduleKeyDeletionOutput, error)
func (c *KMS) ScheduleKeyDeletionRequest(input *ScheduleKeyDeletionInput) (req *request.Request, output *ScheduleKeyDeletionOutput)
func (c *KMS) ScheduleKeyDeletionWithContext(ctx aws.Context, input *ScheduleKeyDeletionInput, opts ...request.Option) (*ScheduleKeyDeletionOutput, error)
func (c *KMS) Sign(input *SignInput) (*SignOutput, error)
func (c *KMS) SignRequest(input *SignInput) (req *request.Request, output *SignOutput)
func (c *KMS) SignWithContext(ctx aws.Context, input *SignInput, opts ...request.Option) (*SignOutput, error)
func (c *KMS) TagResource(input *TagResourceInput) (*TagResourceOutput, error)
func (c *KMS) TagResourceRequest(input *TagResourceInput) (req *request.Request, output *TagResourceOutput)
func (c *KMS) TagResourceWithContext(ctx aws.Context, input *TagResourceInput, opts ...request.Option) (*TagResourceOutput, error)
func (c *KMS) UntagResource(input *UntagResourceInput) (*UntagResourceOutput, error)
func (c *KMS) UntagResourceRequest(input *UntagResourceInput) (req *request.Request, output *UntagResourceOutput)
func (c *KMS) UntagResourceWithContext(ctx aws.Context, input *UntagResourceInput, opts ...request.Option) (*UntagResourceOutput, error)
func (c *KMS) UpdateAlias(input *UpdateAliasInput) (*UpdateAliasOutput, error)
func (c *KMS) UpdateAliasRequest(input *UpdateAliasInput) (req *request.Request, output *UpdateAliasOutput)
func (c *KMS) UpdateAliasWithContext(ctx aws.Context, input *UpdateAliasInput, opts ...request.Option) (*UpdateAliasOutput, error)
func (c *KMS) UpdateCustomKeyStore(input *UpdateCustomKeyStoreInput) (*UpdateCustomKeyStoreOutput, error)
func (c *KMS) UpdateCustomKeyStoreRequest(input *UpdateCustomKeyStoreInput) (req *request.Request, output *UpdateCustomKeyStoreOutput)
func (c *KMS) UpdateCustomKeyStoreWithContext(ctx aws.Context, input *UpdateCustomKeyStoreInput, opts ...request.Option) (*UpdateCustomKeyStoreOutput, error)
func (c *KMS) UpdateKeyDescription(input *UpdateKeyDescriptionInput) (*UpdateKeyDescriptionOutput, error)
func (c *KMS) UpdateKeyDescriptionRequest(input *UpdateKeyDescriptionInput) (req *request.Request, output *UpdateKeyDescriptionOutput)
func (c *KMS) UpdateKeyDescriptionWithContext(ctx aws.Context, input *UpdateKeyDescriptionInput, opts ...request.Option) (*UpdateKeyDescriptionOutput, error)
func (c *KMS) UpdatePrimaryRegion(input *UpdatePrimaryRegionInput) (*UpdatePrimaryRegionOutput, error)
func (c *KMS) UpdatePrimaryRegionRequest(input *UpdatePrimaryRegionInput) (req *request.Request, output *UpdatePrimaryRegionOutput)
func (c *KMS) UpdatePrimaryRegionWithContext(ctx aws.Context, input *UpdatePrimaryRegionInput, opts ...request.Option) (*UpdatePrimaryRegionOutput, error)
func (c *KMS) Verify(input *VerifyInput) (*VerifyOutput, error)
func (c *KMS) VerifyMac(input *VerifyMacInput) (*VerifyMacOutput, error)
func (c *KMS) VerifyMacRequest(input *VerifyMacInput) (req *request.Request, output *VerifyMacOutput)
func (c *KMS) VerifyMacWithContext(ctx aws.Context, input *VerifyMacInput, opts ...request.Option) (*VerifyMacOutput, error)
func (c *KMS) VerifyRequest(input *VerifyInput) (req *request.Request, output *VerifyOutput)
func (c *KMS) VerifyWithContext(ctx aws.Context, input *VerifyInput, opts ...request.Option) (*VerifyOutput, error)
func AlgorithmSpec_Values() []string
func ConnectionErrorCodeType_Values() []string
func ConnectionStateType_Values() []string
func CustomKeyStoreType_Values() []string
func CustomerMasterKeySpec_Values() []string
func DataKeyPairSpec_Values() []string
func DataKeySpec_Values() []string
func EncryptionAlgorithmSpec_Values() []string
func ExpirationModelType_Values() []string
func GrantOperation_Values() []string
func KeyAgreementAlgorithmSpec_Values() []string
func KeyEncryptionMechanism_Values() []string
func KeyManagerType_Values() []string
func KeySpec_Values() []string
func KeyState_Values() []string
func KeyUsageType_Values() []string
func MacAlgorithmSpec_Values() []string
func MessageType_Values() []string
func MultiRegionKeyType_Values() []string
func OriginType_Values() []string
func RotationType_Values() []string
func SigningAlgorithmSpec_Values() []string
func WrappingKeySpec_Values() []string
func XksProxyConnectivityType_Values() []string
type AliasListEntry
type AlreadyExistsException
type CancelKeyDeletionInput
type CancelKeyDeletionOutput
type CloudHsmClusterInUseException
type CloudHsmClusterInvalidConfigurationException
type CloudHsmClusterNotActiveException
type CloudHsmClusterNotFoundException
type CloudHsmClusterNotRelatedException
type ConflictException
type ConnectCustomKeyStoreInput
type ConnectCustomKeyStoreOutput
type CreateAliasInput
type CreateAliasOutput
type CreateCustomKeyStoreInput
type CreateCustomKeyStoreOutput
type CreateGrantInput
type CreateGrantOutput
type CreateKeyInput
type CreateKeyOutput
type CustomKeyStoreHasCMKsException
type CustomKeyStoreInvalidStateException
type CustomKeyStoreNameInUseException
type CustomKeyStoreNotFoundException
type CustomKeyStoresListEntry
type DecryptInput
type DecryptOutput
type DeleteAliasInput
type DeleteAliasOutput
type DeleteCustomKeyStoreInput
type DeleteCustomKeyStoreOutput
type DeleteImportedKeyMaterialInput
type DeleteImportedKeyMaterialOutput
type DependencyTimeoutException
type DeriveSharedSecretInput
type DeriveSharedSecretOutput
type DescribeCustomKeyStoresInput
type DescribeCustomKeyStoresOutput
type DescribeKeyInput
type DescribeKeyOutput
type DisableKeyInput
type DisableKeyOutput
type DisableKeyRotationInput
type DisableKeyRotationOutput
type DisabledException
type DisconnectCustomKeyStoreInput
type DisconnectCustomKeyStoreOutput
type DryRunOperationException
type EnableKeyInput
type EnableKeyOutput
type EnableKeyRotationInput
type EnableKeyRotationOutput
type EncryptInput
type EncryptOutput
type ExpiredImportTokenException
type GenerateDataKeyInput
type GenerateDataKeyOutput
type GenerateDataKeyPairInput
type GenerateDataKeyPairOutput
type GenerateDataKeyPairWithoutPlaintextInput
type GenerateDataKeyPairWithoutPlaintextOutput
type GenerateDataKeyWithoutPlaintextInput
type GenerateDataKeyWithoutPlaintextOutput
type GenerateMacInput
type GenerateMacOutput
type GenerateRandomInput
type GenerateRandomOutput
type GetKeyPolicyInput
type GetKeyPolicyOutput
type GetKeyRotationStatusInput
type GetKeyRotationStatusOutput
type GetParametersForImportInput
type GetParametersForImportOutput
type GetPublicKeyInput
type GetPublicKeyOutput
type GrantConstraints
type GrantListEntry
type ImportKeyMaterialInput
type ImportKeyMaterialOutput
type IncorrectKeyException
type IncorrectKeyMaterialException
type IncorrectTrustAnchorException
type InternalException
type InvalidAliasNameException
type InvalidArnException
type InvalidCiphertextException
type InvalidGrantIdException
type InvalidGrantTokenException
type InvalidImportTokenException
type InvalidKeyUsageException
type InvalidMarkerException
type InvalidStateException
type KMSInvalidMacException
type KMSInvalidSignatureException
type KeyListEntry
type KeyMetadata
type KeyUnavailableException
type LimitExceededException
type ListAliasesInput
type ListAliasesOutput
type ListGrantsInput
type ListGrantsResponse
type ListKeyPoliciesInput
type ListKeyPoliciesOutput
type ListKeyRotationsInput
type ListKeyRotationsOutput
type ListKeysInput
type ListKeysOutput
type ListResourceTagsInput
type ListResourceTagsOutput
type ListRetirableGrantsInput
type MalformedPolicyDocumentException
type MultiRegionConfiguration
type MultiRegionKey
type NotFoundException
type PutKeyPolicyInput
type PutKeyPolicyOutput
type ReEncryptInput
type ReEncryptOutput
type RecipientInfo
type ReplicateKeyInput
type ReplicateKeyOutput
type RetireGrantInput
type RetireGrantOutput
type RevokeGrantInput
type RevokeGrantOutput
type RotateKeyOnDemandInput
type RotateKeyOnDemandOutput
type RotationsListEntry
type ScheduleKeyDeletionInput
type ScheduleKeyDeletionOutput
type SignInput
type SignOutput
type Tag
type TagException
type TagResourceInput
type TagResourceOutput
type UnsupportedOperationException
type UntagResourceInput
type UntagResourceOutput
type UpdateAliasInput
type UpdateAliasOutput
type UpdateCustomKeyStoreInput
type UpdateCustomKeyStoreOutput
type UpdateKeyDescriptionInput
type UpdateKeyDescriptionOutput
type UpdatePrimaryRegionInput
type UpdatePrimaryRegionOutput
type VerifyInput
type VerifyMacInput
type VerifyMacOutput
type VerifyOutput
type XksKeyAlreadyInUseException
type XksKeyConfigurationType
type XksKeyInvalidConfigurationException
type XksKeyNotFoundException
type XksProxyAuthenticationCredentialType
type XksProxyConfigurationType
type XksProxyIncorrectAuthenticationCredentialException
type XksProxyInvalidConfigurationException
type XksProxyInvalidResponseException
type XksProxyUriEndpointInUseException
type XksProxyUriInUseException
type XksProxyUriUnreachableException
type XksProxyVpcEndpointServiceInUseException
type XksProxyVpcEndpointServiceInvalidConfigurationException
type XksProxyVpcEndpointServiceNotFoundException

Examples ▾

KMS.CancelKeyDeletion (Shared00)
KMS.ConnectCustomKeyStore (Shared00)
KMS.CreateAlias (Shared00)
KMS.CreateCustomKeyStore (Shared00)
KMS.CreateCustomKeyStore (Shared01)
KMS.CreateCustomKeyStore (Shared02)
KMS.CreateGrant (Shared00)
KMS.CreateKey (Shared00)
KMS.CreateKey (Shared01)
KMS.CreateKey (Shared02)
KMS.CreateKey (Shared03)
KMS.CreateKey (Shared04)
KMS.CreateKey (Shared05)
KMS.CreateKey (Shared06)
KMS.CreateKey (Shared07)
KMS.Decrypt (Shared00)
KMS.Decrypt (Shared01)
KMS.Decrypt (Shared02)
KMS.DeleteAlias (Shared00)
KMS.DeleteCustomKeyStore (Shared00)
KMS.DeleteImportedKeyMaterial (Shared00)
KMS.DeriveSharedSecret (Shared00)
KMS.DescribeCustomKeyStores (Shared00)
KMS.DescribeCustomKeyStores (Shared01)
KMS.DescribeCustomKeyStores (Shared02)
KMS.DescribeCustomKeyStores (Shared03)
KMS.DescribeKey (Shared00)
KMS.DescribeKey (Shared01)
KMS.DescribeKey (Shared02)
KMS.DescribeKey (Shared03)
KMS.DescribeKey (Shared04)
KMS.DescribeKey (Shared05)
KMS.DisableKeyRotation (Shared00)
KMS.DisableKey (Shared00)
KMS.DisconnectCustomKeyStore (Shared00)
KMS.EnableKeyRotation (Shared00)
KMS.EnableKey (Shared00)
KMS.Encrypt (Shared00)
KMS.Encrypt (Shared01)
KMS.GenerateDataKeyPairWithoutPlaintext (Shared00)
KMS.GenerateDataKeyPair (Shared00)
KMS.GenerateDataKeyPair (Shared01)
KMS.GenerateDataKeyWithoutPlaintext (Shared00)
KMS.GenerateDataKey (Shared00)
KMS.GenerateDataKey (Shared01)
KMS.GenerateMac (Shared00)
KMS.GenerateRandom (Shared00)
KMS.GenerateRandom (Shared01)
KMS.GetKeyPolicy (Shared00)
KMS.GetKeyRotationStatus (Shared00)
KMS.GetParametersForImport (Shared00)
KMS.GetParametersForImport (Shared01)
KMS.GetParametersForImport (Shared02)
KMS.GetParametersForImport (Shared03)
KMS.GetPublicKey (Shared00)
KMS.ImportKeyMaterial (Shared00)
KMS.ImportKeyMaterial (Shared01)
KMS.ListAliases (Shared00)
KMS.ListGrants (Shared00)
KMS.ListKeyPolicies (Shared00)
KMS.ListKeyRotations (Shared00)
KMS.ListKeys (Shared00)
KMS.ListResourceTags (Shared00)
KMS.ListRetirableGrants (Shared00)
KMS.PutKeyPolicy (Shared00)
KMS.ReEncrypt (Shared00)
KMS.ReplicateKey (Shared00)
KMS.RetireGrant (Shared00)
KMS.RevokeGrant (Shared00)
KMS.RotateKeyOnDemand (Shared00)
KMS.ScheduleKeyDeletion (Shared00)
KMS.Sign (Shared00)
KMS.Sign (Shared01)
KMS.TagResource (Shared00)
KMS.UntagResource (Shared00)
KMS.UpdateAlias (Shared00)
KMS.UpdateCustomKeyStore (Shared00)
KMS.UpdateCustomKeyStore (Shared01)
KMS.UpdateCustomKeyStore (Shared02)
KMS.UpdateCustomKeyStore (Shared03)
KMS.UpdateCustomKeyStore (Shared04)
KMS.UpdateCustomKeyStore (Shared05)
KMS.UpdateKeyDescription (Shared00)
KMS.UpdatePrimaryRegion (Shared00)
KMS.VerifyMac (Shared00)
KMS.Verify (Shared00)
KMS.Verify (Shared01)

Constants ▾

const (
    // AlgorithmSpecRsaesPkcs1V15 is a AlgorithmSpec enum value
    AlgorithmSpecRsaesPkcs1V15 = "RSAES_PKCS1_V1_5"

    // AlgorithmSpecRsaesOaepSha1 is a AlgorithmSpec enum value
    AlgorithmSpecRsaesOaepSha1 = "RSAES_OAEP_SHA_1"

    // AlgorithmSpecRsaesOaepSha256 is a AlgorithmSpec enum value
    AlgorithmSpecRsaesOaepSha256 = "RSAES_OAEP_SHA_256"

    // AlgorithmSpecRsaAesKeyWrapSha1 is a AlgorithmSpec enum value
    AlgorithmSpecRsaAesKeyWrapSha1 = "RSA_AES_KEY_WRAP_SHA_1"

    // AlgorithmSpecRsaAesKeyWrapSha256 is a AlgorithmSpec enum value
    AlgorithmSpecRsaAesKeyWrapSha256 = "RSA_AES_KEY_WRAP_SHA_256"

    // AlgorithmSpecSm2pke is a AlgorithmSpec enum value
    AlgorithmSpecSm2pke = "SM2PKE"
)
const (
    // ConnectionErrorCodeTypeInvalidCredentials is a ConnectionErrorCodeType enum value
    ConnectionErrorCodeTypeInvalidCredentials = "INVALID_CREDENTIALS"

    // ConnectionErrorCodeTypeClusterNotFound is a ConnectionErrorCodeType enum value
    ConnectionErrorCodeTypeClusterNotFound = "CLUSTER_NOT_FOUND"

    // ConnectionErrorCodeTypeNetworkErrors is a ConnectionErrorCodeType enum value
    ConnectionErrorCodeTypeNetworkErrors = "NETWORK_ERRORS"

    // ConnectionErrorCodeTypeInternalError is a ConnectionErrorCodeType enum value
    ConnectionErrorCodeTypeInternalError = "INTERNAL_ERROR"

    // ConnectionErrorCodeTypeInsufficientCloudhsmHsms is a ConnectionErrorCodeType enum value
    ConnectionErrorCodeTypeInsufficientCloudhsmHsms = "INSUFFICIENT_CLOUDHSM_HSMS"

    // ConnectionErrorCodeTypeUserLockedOut is a ConnectionErrorCodeType enum value
    ConnectionErrorCodeTypeUserLockedOut = "USER_LOCKED_OUT"

    // ConnectionErrorCodeTypeUserNotFound is a ConnectionErrorCodeType enum value
    ConnectionErrorCodeTypeUserNotFound = "USER_NOT_FOUND"

    // ConnectionErrorCodeTypeUserLoggedIn is a ConnectionErrorCodeType enum value
    ConnectionErrorCodeTypeUserLoggedIn = "USER_LOGGED_IN"

    // ConnectionErrorCodeTypeSubnetNotFound is a ConnectionErrorCodeType enum value
    ConnectionErrorCodeTypeSubnetNotFound = "SUBNET_NOT_FOUND"

    // ConnectionErrorCodeTypeInsufficientFreeAddressesInSubnet is a ConnectionErrorCodeType enum value
    ConnectionErrorCodeTypeInsufficientFreeAddressesInSubnet = "INSUFFICIENT_FREE_ADDRESSES_IN_SUBNET"

    // ConnectionErrorCodeTypeXksProxyAccessDenied is a ConnectionErrorCodeType enum value
    ConnectionErrorCodeTypeXksProxyAccessDenied = "XKS_PROXY_ACCESS_DENIED"

    // ConnectionErrorCodeTypeXksProxyNotReachable is a ConnectionErrorCodeType enum value
    ConnectionErrorCodeTypeXksProxyNotReachable = "XKS_PROXY_NOT_REACHABLE"

    // ConnectionErrorCodeTypeXksVpcEndpointServiceNotFound is a ConnectionErrorCodeType enum value
    ConnectionErrorCodeTypeXksVpcEndpointServiceNotFound = "XKS_VPC_ENDPOINT_SERVICE_NOT_FOUND"

    // ConnectionErrorCodeTypeXksProxyInvalidResponse is a ConnectionErrorCodeType enum value
    ConnectionErrorCodeTypeXksProxyInvalidResponse = "XKS_PROXY_INVALID_RESPONSE"

    // ConnectionErrorCodeTypeXksProxyInvalidConfiguration is a ConnectionErrorCodeType enum value
    ConnectionErrorCodeTypeXksProxyInvalidConfiguration = "XKS_PROXY_INVALID_CONFIGURATION"

    // ConnectionErrorCodeTypeXksVpcEndpointServiceInvalidConfiguration is a ConnectionErrorCodeType enum value
    ConnectionErrorCodeTypeXksVpcEndpointServiceInvalidConfiguration = "XKS_VPC_ENDPOINT_SERVICE_INVALID_CONFIGURATION"

    // ConnectionErrorCodeTypeXksProxyTimedOut is a ConnectionErrorCodeType enum value
    ConnectionErrorCodeTypeXksProxyTimedOut = "XKS_PROXY_TIMED_OUT"

    // ConnectionErrorCodeTypeXksProxyInvalidTlsConfiguration is a ConnectionErrorCodeType enum value
    ConnectionErrorCodeTypeXksProxyInvalidTlsConfiguration = "XKS_PROXY_INVALID_TLS_CONFIGURATION"
)
const (
    // ConnectionStateTypeConnected is a ConnectionStateType enum value
    ConnectionStateTypeConnected = "CONNECTED"

    // ConnectionStateTypeConnecting is a ConnectionStateType enum value
    ConnectionStateTypeConnecting = "CONNECTING"

    // ConnectionStateTypeFailed is a ConnectionStateType enum value
    ConnectionStateTypeFailed = "FAILED"

    // ConnectionStateTypeDisconnected is a ConnectionStateType enum value
    ConnectionStateTypeDisconnected = "DISCONNECTED"

    // ConnectionStateTypeDisconnecting is a ConnectionStateType enum value
    ConnectionStateTypeDisconnecting = "DISCONNECTING"
)
const (
    // CustomKeyStoreTypeAwsCloudhsm is a CustomKeyStoreType enum value
    CustomKeyStoreTypeAwsCloudhsm = "AWS_CLOUDHSM"

    // CustomKeyStoreTypeExternalKeyStore is a CustomKeyStoreType enum value
    CustomKeyStoreTypeExternalKeyStore = "EXTERNAL_KEY_STORE"
)
const (
    // CustomerMasterKeySpecRsa2048 is a CustomerMasterKeySpec enum value
    CustomerMasterKeySpecRsa2048 = "RSA_2048"

    // CustomerMasterKeySpecRsa3072 is a CustomerMasterKeySpec enum value
    CustomerMasterKeySpecRsa3072 = "RSA_3072"

    // CustomerMasterKeySpecRsa4096 is a CustomerMasterKeySpec enum value
    CustomerMasterKeySpecRsa4096 = "RSA_4096"

    // CustomerMasterKeySpecEccNistP256 is a CustomerMasterKeySpec enum value
    CustomerMasterKeySpecEccNistP256 = "ECC_NIST_P256"

    // CustomerMasterKeySpecEccNistP384 is a CustomerMasterKeySpec enum value
    CustomerMasterKeySpecEccNistP384 = "ECC_NIST_P384"

    // CustomerMasterKeySpecEccNistP521 is a CustomerMasterKeySpec enum value
    CustomerMasterKeySpecEccNistP521 = "ECC_NIST_P521"

    // CustomerMasterKeySpecEccSecgP256k1 is a CustomerMasterKeySpec enum value
    CustomerMasterKeySpecEccSecgP256k1 = "ECC_SECG_P256K1"

    // CustomerMasterKeySpecSymmetricDefault is a CustomerMasterKeySpec enum value
    CustomerMasterKeySpecSymmetricDefault = "SYMMETRIC_DEFAULT"

    // CustomerMasterKeySpecHmac224 is a CustomerMasterKeySpec enum value
    CustomerMasterKeySpecHmac224 = "HMAC_224"

    // CustomerMasterKeySpecHmac256 is a CustomerMasterKeySpec enum value
    CustomerMasterKeySpecHmac256 = "HMAC_256"

    // CustomerMasterKeySpecHmac384 is a CustomerMasterKeySpec enum value
    CustomerMasterKeySpecHmac384 = "HMAC_384"

    // CustomerMasterKeySpecHmac512 is a CustomerMasterKeySpec enum value
    CustomerMasterKeySpecHmac512 = "HMAC_512"

    // CustomerMasterKeySpecSm2 is a CustomerMasterKeySpec enum value
    CustomerMasterKeySpecSm2 = "SM2"
)
const (
    // DataKeyPairSpecRsa2048 is a DataKeyPairSpec enum value
    DataKeyPairSpecRsa2048 = "RSA_2048"

    // DataKeyPairSpecRsa3072 is a DataKeyPairSpec enum value
    DataKeyPairSpecRsa3072 = "RSA_3072"

    // DataKeyPairSpecRsa4096 is a DataKeyPairSpec enum value
    DataKeyPairSpecRsa4096 = "RSA_4096"

    // DataKeyPairSpecEccNistP256 is a DataKeyPairSpec enum value
    DataKeyPairSpecEccNistP256 = "ECC_NIST_P256"

    // DataKeyPairSpecEccNistP384 is a DataKeyPairSpec enum value
    DataKeyPairSpecEccNistP384 = "ECC_NIST_P384"

    // DataKeyPairSpecEccNistP521 is a DataKeyPairSpec enum value
    DataKeyPairSpecEccNistP521 = "ECC_NIST_P521"

    // DataKeyPairSpecEccSecgP256k1 is a DataKeyPairSpec enum value
    DataKeyPairSpecEccSecgP256k1 = "ECC_SECG_P256K1"

    // DataKeyPairSpecSm2 is a DataKeyPairSpec enum value
    DataKeyPairSpecSm2 = "SM2"
)
const (
    // DataKeySpecAes256 is a DataKeySpec enum value
    DataKeySpecAes256 = "AES_256"

    // DataKeySpecAes128 is a DataKeySpec enum value
    DataKeySpecAes128 = "AES_128"
)
const (
    // EncryptionAlgorithmSpecSymmetricDefault is a EncryptionAlgorithmSpec enum value
    EncryptionAlgorithmSpecSymmetricDefault = "SYMMETRIC_DEFAULT"

    // EncryptionAlgorithmSpecRsaesOaepSha1 is a EncryptionAlgorithmSpec enum value
    EncryptionAlgorithmSpecRsaesOaepSha1 = "RSAES_OAEP_SHA_1"

    // EncryptionAlgorithmSpecRsaesOaepSha256 is a EncryptionAlgorithmSpec enum value
    EncryptionAlgorithmSpecRsaesOaepSha256 = "RSAES_OAEP_SHA_256"

    // EncryptionAlgorithmSpecSm2pke is a EncryptionAlgorithmSpec enum value
    EncryptionAlgorithmSpecSm2pke = "SM2PKE"
)
const (
    // ExpirationModelTypeKeyMaterialExpires is a ExpirationModelType enum value
    ExpirationModelTypeKeyMaterialExpires = "KEY_MATERIAL_EXPIRES"

    // ExpirationModelTypeKeyMaterialDoesNotExpire is a ExpirationModelType enum value
    ExpirationModelTypeKeyMaterialDoesNotExpire = "KEY_MATERIAL_DOES_NOT_EXPIRE"
)
const (
    // GrantOperationDecrypt is a GrantOperation enum value
    GrantOperationDecrypt = "Decrypt"

    // GrantOperationEncrypt is a GrantOperation enum value
    GrantOperationEncrypt = "Encrypt"

    // GrantOperationGenerateDataKey is a GrantOperation enum value
    GrantOperationGenerateDataKey = "GenerateDataKey"

    // GrantOperationGenerateDataKeyWithoutPlaintext is a GrantOperation enum value
    GrantOperationGenerateDataKeyWithoutPlaintext = "GenerateDataKeyWithoutPlaintext"

    // GrantOperationReEncryptFrom is a GrantOperation enum value
    GrantOperationReEncryptFrom = "ReEncryptFrom"

    // GrantOperationReEncryptTo is a GrantOperation enum value
    GrantOperationReEncryptTo = "ReEncryptTo"

    // GrantOperationSign is a GrantOperation enum value
    GrantOperationSign = "Sign"

    // GrantOperationVerify is a GrantOperation enum value
    GrantOperationVerify = "Verify"

    // GrantOperationGetPublicKey is a GrantOperation enum value
    GrantOperationGetPublicKey = "GetPublicKey"

    // GrantOperationCreateGrant is a GrantOperation enum value
    GrantOperationCreateGrant = "CreateGrant"

    // GrantOperationRetireGrant is a GrantOperation enum value
    GrantOperationRetireGrant = "RetireGrant"

    // GrantOperationDescribeKey is a GrantOperation enum value
    GrantOperationDescribeKey = "DescribeKey"

    // GrantOperationGenerateDataKeyPair is a GrantOperation enum value
    GrantOperationGenerateDataKeyPair = "GenerateDataKeyPair"

    // GrantOperationGenerateDataKeyPairWithoutPlaintext is a GrantOperation enum value
    GrantOperationGenerateDataKeyPairWithoutPlaintext = "GenerateDataKeyPairWithoutPlaintext"

    // GrantOperationGenerateMac is a GrantOperation enum value
    GrantOperationGenerateMac = "GenerateMac"

    // GrantOperationVerifyMac is a GrantOperation enum value
    GrantOperationVerifyMac = "VerifyMac"

    // GrantOperationDeriveSharedSecret is a GrantOperation enum value
    GrantOperationDeriveSharedSecret = "DeriveSharedSecret"
)
const (
    // KeyManagerTypeAws is a KeyManagerType enum value
    KeyManagerTypeAws = "AWS"

    // KeyManagerTypeCustomer is a KeyManagerType enum value
    KeyManagerTypeCustomer = "CUSTOMER"
)
const (
    // KeySpecRsa2048 is a KeySpec enum value
    KeySpecRsa2048 = "RSA_2048"

    // KeySpecRsa3072 is a KeySpec enum value
    KeySpecRsa3072 = "RSA_3072"

    // KeySpecRsa4096 is a KeySpec enum value
    KeySpecRsa4096 = "RSA_4096"

    // KeySpecEccNistP256 is a KeySpec enum value
    KeySpecEccNistP256 = "ECC_NIST_P256"

    // KeySpecEccNistP384 is a KeySpec enum value
    KeySpecEccNistP384 = "ECC_NIST_P384"

    // KeySpecEccNistP521 is a KeySpec enum value
    KeySpecEccNistP521 = "ECC_NIST_P521"

    // KeySpecEccSecgP256k1 is a KeySpec enum value
    KeySpecEccSecgP256k1 = "ECC_SECG_P256K1"

    // KeySpecSymmetricDefault is a KeySpec enum value
    KeySpecSymmetricDefault = "SYMMETRIC_DEFAULT"

    // KeySpecHmac224 is a KeySpec enum value
    KeySpecHmac224 = "HMAC_224"

    // KeySpecHmac256 is a KeySpec enum value
    KeySpecHmac256 = "HMAC_256"

    // KeySpecHmac384 is a KeySpec enum value
    KeySpecHmac384 = "HMAC_384"

    // KeySpecHmac512 is a KeySpec enum value
    KeySpecHmac512 = "HMAC_512"

    // KeySpecSm2 is a KeySpec enum value
    KeySpecSm2 = "SM2"
)
const (
    // KeyStateCreating is a KeyState enum value
    KeyStateCreating = "Creating"

    // KeyStateEnabled is a KeyState enum value
    KeyStateEnabled = "Enabled"

    // KeyStateDisabled is a KeyState enum value
    KeyStateDisabled = "Disabled"

    // KeyStatePendingDeletion is a KeyState enum value
    KeyStatePendingDeletion = "PendingDeletion"

    // KeyStatePendingImport is a KeyState enum value
    KeyStatePendingImport = "PendingImport"

    // KeyStatePendingReplicaDeletion is a KeyState enum value
    KeyStatePendingReplicaDeletion = "PendingReplicaDeletion"

    // KeyStateUnavailable is a KeyState enum value
    KeyStateUnavailable = "Unavailable"

    // KeyStateUpdating is a KeyState enum value
    KeyStateUpdating = "Updating"
)
const (
    // KeyUsageTypeSignVerify is a KeyUsageType enum value
    KeyUsageTypeSignVerify = "SIGN_VERIFY"

    // KeyUsageTypeEncryptDecrypt is a KeyUsageType enum value
    KeyUsageTypeEncryptDecrypt = "ENCRYPT_DECRYPT"

    // KeyUsageTypeGenerateVerifyMac is a KeyUsageType enum value
    KeyUsageTypeGenerateVerifyMac = "GENERATE_VERIFY_MAC"

    // KeyUsageTypeKeyAgreement is a KeyUsageType enum value
    KeyUsageTypeKeyAgreement = "KEY_AGREEMENT"
)
const (
    // MacAlgorithmSpecHmacSha224 is a MacAlgorithmSpec enum value
    MacAlgorithmSpecHmacSha224 = "HMAC_SHA_224"

    // MacAlgorithmSpecHmacSha256 is a MacAlgorithmSpec enum value
    MacAlgorithmSpecHmacSha256 = "HMAC_SHA_256"

    // MacAlgorithmSpecHmacSha384 is a MacAlgorithmSpec enum value
    MacAlgorithmSpecHmacSha384 = "HMAC_SHA_384"

    // MacAlgorithmSpecHmacSha512 is a MacAlgorithmSpec enum value
    MacAlgorithmSpecHmacSha512 = "HMAC_SHA_512"
)
const (
    // MessageTypeRaw is a MessageType enum value
    MessageTypeRaw = "RAW"

    // MessageTypeDigest is a MessageType enum value
    MessageTypeDigest = "DIGEST"
)
const (
    // MultiRegionKeyTypePrimary is a MultiRegionKeyType enum value
    MultiRegionKeyTypePrimary = "PRIMARY"

    // MultiRegionKeyTypeReplica is a MultiRegionKeyType enum value
    MultiRegionKeyTypeReplica = "REPLICA"
)
const (
    // OriginTypeAwsKms is a OriginType enum value
    OriginTypeAwsKms = "AWS_KMS"

    // OriginTypeExternal is a OriginType enum value
    OriginTypeExternal = "EXTERNAL"

    // OriginTypeAwsCloudhsm is a OriginType enum value
    OriginTypeAwsCloudhsm = "AWS_CLOUDHSM"

    // OriginTypeExternalKeyStore is a OriginType enum value
    OriginTypeExternalKeyStore = "EXTERNAL_KEY_STORE"
)
const (
    // RotationTypeAutomatic is a RotationType enum value
    RotationTypeAutomatic = "AUTOMATIC"

    // RotationTypeOnDemand is a RotationType enum value
    RotationTypeOnDemand = "ON_DEMAND"
)
const (
    // SigningAlgorithmSpecRsassaPssSha256 is a SigningAlgorithmSpec enum value
    SigningAlgorithmSpecRsassaPssSha256 = "RSASSA_PSS_SHA_256"

    // SigningAlgorithmSpecRsassaPssSha384 is a SigningAlgorithmSpec enum value
    SigningAlgorithmSpecRsassaPssSha384 = "RSASSA_PSS_SHA_384"

    // SigningAlgorithmSpecRsassaPssSha512 is a SigningAlgorithmSpec enum value
    SigningAlgorithmSpecRsassaPssSha512 = "RSASSA_PSS_SHA_512"

    // SigningAlgorithmSpecRsassaPkcs1V15Sha256 is a SigningAlgorithmSpec enum value
    SigningAlgorithmSpecRsassaPkcs1V15Sha256 = "RSASSA_PKCS1_V1_5_SHA_256"

    // SigningAlgorithmSpecRsassaPkcs1V15Sha384 is a SigningAlgorithmSpec enum value
    SigningAlgorithmSpecRsassaPkcs1V15Sha384 = "RSASSA_PKCS1_V1_5_SHA_384"

    // SigningAlgorithmSpecRsassaPkcs1V15Sha512 is a SigningAlgorithmSpec enum value
    SigningAlgorithmSpecRsassaPkcs1V15Sha512 = "RSASSA_PKCS1_V1_5_SHA_512"

    // SigningAlgorithmSpecEcdsaSha256 is a SigningAlgorithmSpec enum value
    SigningAlgorithmSpecEcdsaSha256 = "ECDSA_SHA_256"

    // SigningAlgorithmSpecEcdsaSha384 is a SigningAlgorithmSpec enum value
    SigningAlgorithmSpecEcdsaSha384 = "ECDSA_SHA_384"

    // SigningAlgorithmSpecEcdsaSha512 is a SigningAlgorithmSpec enum value
    SigningAlgorithmSpecEcdsaSha512 = "ECDSA_SHA_512"

    // SigningAlgorithmSpecSm2dsa is a SigningAlgorithmSpec enum value
    SigningAlgorithmSpecSm2dsa = "SM2DSA"
)
const (
    // WrappingKeySpecRsa2048 is a WrappingKeySpec enum value
    WrappingKeySpecRsa2048 = "RSA_2048"

    // WrappingKeySpecRsa3072 is a WrappingKeySpec enum value
    WrappingKeySpecRsa3072 = "RSA_3072"

    // WrappingKeySpecRsa4096 is a WrappingKeySpec enum value
    WrappingKeySpecRsa4096 = "RSA_4096"

    // WrappingKeySpecSm2 is a WrappingKeySpec enum value
    WrappingKeySpecSm2 = "SM2"
)
const (
    // XksProxyConnectivityTypePublicEndpoint is a XksProxyConnectivityType enum value
    XksProxyConnectivityTypePublicEndpoint = "PUBLIC_ENDPOINT"

    // XksProxyConnectivityTypeVpcEndpointService is a XksProxyConnectivityType enum value
    XksProxyConnectivityTypeVpcEndpointService = "VPC_ENDPOINT_SERVICE"
)
const (

    // ErrCodeAlreadyExistsException for service response error code
    // "AlreadyExistsException".
    //
    // The request was rejected because it attempted to create a resource that already
    // exists.
    ErrCodeAlreadyExistsException = "AlreadyExistsException"

    // ErrCodeCloudHsmClusterInUseException for service response error code
    // "CloudHsmClusterInUseException".
    //
    // The request was rejected because the specified CloudHSM cluster is already
    // associated with an CloudHSM key store in the account, or it shares a backup
    // history with an CloudHSM key store in the account. Each CloudHSM key store
    // in the account must be associated with a different CloudHSM cluster.
    //
    // CloudHSM clusters that share a backup history have the same cluster certificate.
    // To view the cluster certificate of an CloudHSM cluster, use the DescribeClusters
    // (https://docs.aws.amazon.com/cloudhsm/latest/APIReference/API_DescribeClusters.html)
    // operation.
    ErrCodeCloudHsmClusterInUseException = "CloudHsmClusterInUseException"

    // ErrCodeCloudHsmClusterInvalidConfigurationException for service response error code
    // "CloudHsmClusterInvalidConfigurationException".
    //
    // The request was rejected because the associated CloudHSM cluster did not
    // meet the configuration requirements for an CloudHSM key store.
    //
    //    * The CloudHSM cluster must be configured with private subnets in at least
    //    two different Availability Zones in the Region.
    //
    //    * The security group for the cluster (https://docs.aws.amazon.com/cloudhsm/latest/userguide/configure-sg.html)
    //    (cloudhsm-cluster-<cluster-id>-sg) must include inbound rules and outbound
    //    rules that allow TCP traffic on ports 2223-2225. The Source in the inbound
    //    rules and the Destination in the outbound rules must match the security
    //    group ID. These rules are set by default when you create the CloudHSM
    //    cluster. Do not delete or change them. To get information about a particular
    //    security group, use the DescribeSecurityGroups (https://docs.aws.amazon.com/AWSEC2/latest/APIReference/API_DescribeSecurityGroups.html)
    //    operation.
    //
    //    * The CloudHSM cluster must contain at least as many HSMs as the operation
    //    requires. To add HSMs, use the CloudHSM CreateHsm (https://docs.aws.amazon.com/cloudhsm/latest/APIReference/API_CreateHsm.html)
    //    operation. For the CreateCustomKeyStore, UpdateCustomKeyStore, and CreateKey
    //    operations, the CloudHSM cluster must have at least two active HSMs, each
    //    in a different Availability Zone. For the ConnectCustomKeyStore operation,
    //    the CloudHSM must contain at least one active HSM.
    //
    // For information about the requirements for an CloudHSM cluster that is associated
    // with an CloudHSM key store, see Assemble the Prerequisites (https://docs.aws.amazon.com/kms/latest/developerguide/create-keystore.html#before-keystore)
    // in the Key Management Service Developer Guide. For information about creating
    // a private subnet for an CloudHSM cluster, see Create a Private Subnet (https://docs.aws.amazon.com/cloudhsm/latest/userguide/create-subnets.html)
    // in the CloudHSM User Guide. For information about cluster security groups,
    // see Configure a Default Security Group (https://docs.aws.amazon.com/cloudhsm/latest/userguide/configure-sg.html)
    // in the CloudHSM User Guide .
    ErrCodeCloudHsmClusterInvalidConfigurationException = "CloudHsmClusterInvalidConfigurationException"

    // ErrCodeCloudHsmClusterNotActiveException for service response error code
    // "CloudHsmClusterNotActiveException".
    //
    // The request was rejected because the CloudHSM cluster associated with the
    // CloudHSM key store is not active. Initialize and activate the cluster and
    // try the command again. For detailed instructions, see Getting Started (https://docs.aws.amazon.com/cloudhsm/latest/userguide/getting-started.html)
    // in the CloudHSM User Guide.
    ErrCodeCloudHsmClusterNotActiveException = "CloudHsmClusterNotActiveException"

    // ErrCodeCloudHsmClusterNotFoundException for service response error code
    // "CloudHsmClusterNotFoundException".
    //
    // The request was rejected because KMS cannot find the CloudHSM cluster with
    // the specified cluster ID. Retry the request with a different cluster ID.
    ErrCodeCloudHsmClusterNotFoundException = "CloudHsmClusterNotFoundException"

    // ErrCodeCloudHsmClusterNotRelatedException for service response error code
    // "CloudHsmClusterNotRelatedException".
    //
    // The request was rejected because the specified CloudHSM cluster has a different
    // cluster certificate than the original cluster. You cannot use the operation
    // to specify an unrelated cluster for an CloudHSM key store.
    //
    // Specify an CloudHSM cluster that shares a backup history with the original
    // cluster. This includes clusters that were created from a backup of the current
    // cluster, and clusters that were created from the same backup that produced
    // the current cluster.
    //
    // CloudHSM clusters that share a backup history have the same cluster certificate.
    // To view the cluster certificate of an CloudHSM cluster, use the DescribeClusters
    // (https://docs.aws.amazon.com/cloudhsm/latest/APIReference/API_DescribeClusters.html)
    // operation.
    ErrCodeCloudHsmClusterNotRelatedException = "CloudHsmClusterNotRelatedException"

    // ErrCodeConflictException for service response error code
    // "ConflictException".
    //
    // The request was rejected because an automatic rotation of this key is currently
    // in progress or scheduled to begin within the next 20 minutes.
    ErrCodeConflictException = "ConflictException"

    // ErrCodeCustomKeyStoreHasCMKsException for service response error code
    // "CustomKeyStoreHasCMKsException".
    //
    // The request was rejected because the custom key store contains KMS keys.
    // After verifying that you do not need to use the KMS keys, use the ScheduleKeyDeletion
    // operation to delete the KMS keys. After they are deleted, you can delete
    // the custom key store.
    ErrCodeCustomKeyStoreHasCMKsException = "CustomKeyStoreHasCMKsException"

    // ErrCodeCustomKeyStoreInvalidStateException for service response error code
    // "CustomKeyStoreInvalidStateException".
    //
    // The request was rejected because of the ConnectionState of the custom key
    // store. To get the ConnectionState of a custom key store, use the DescribeCustomKeyStores
    // operation.
    //
    // This exception is thrown under the following conditions:
    //
    //    * You requested the ConnectCustomKeyStore operation on a custom key store
    //    with a ConnectionState of DISCONNECTING or FAILED. This operation is valid
    //    for all other ConnectionState values. To reconnect a custom key store
    //    in a FAILED state, disconnect it (DisconnectCustomKeyStore), then connect
    //    it (ConnectCustomKeyStore).
    //
    //    * You requested the CreateKey operation in a custom key store that is
    //    not connected. This operations is valid only when the custom key store
    //    ConnectionState is CONNECTED.
    //
    //    * You requested the DisconnectCustomKeyStore operation on a custom key
    //    store with a ConnectionState of DISCONNECTING or DISCONNECTED. This operation
    //    is valid for all other ConnectionState values.
    //
    //    * You requested the UpdateCustomKeyStore or DeleteCustomKeyStore operation
    //    on a custom key store that is not disconnected. This operation is valid
    //    only when the custom key store ConnectionState is DISCONNECTED.
    //
    //    * You requested the GenerateRandom operation in an CloudHSM key store
    //    that is not connected. This operation is valid only when the CloudHSM
    //    key store ConnectionState is CONNECTED.
    ErrCodeCustomKeyStoreInvalidStateException = "CustomKeyStoreInvalidStateException"

    // ErrCodeCustomKeyStoreNameInUseException for service response error code
    // "CustomKeyStoreNameInUseException".
    //
    // The request was rejected because the specified custom key store name is already
    // assigned to another custom key store in the account. Try again with a custom
    // key store name that is unique in the account.
    ErrCodeCustomKeyStoreNameInUseException = "CustomKeyStoreNameInUseException"

    // ErrCodeCustomKeyStoreNotFoundException for service response error code
    // "CustomKeyStoreNotFoundException".
    //
    // The request was rejected because KMS cannot find a custom key store with
    // the specified key store name or ID.
    ErrCodeCustomKeyStoreNotFoundException = "CustomKeyStoreNotFoundException"

    // ErrCodeDependencyTimeoutException for service response error code
    // "DependencyTimeoutException".
    //
    // The system timed out while trying to fulfill the request. You can retry the
    // request.
    ErrCodeDependencyTimeoutException = "DependencyTimeoutException"

    // ErrCodeDisabledException for service response error code
    // "DisabledException".
    //
    // The request was rejected because the specified KMS key is not enabled.
    ErrCodeDisabledException = "DisabledException"

    // ErrCodeDryRunOperationException for service response error code
    // "DryRunOperationException".
    //
    // The request was rejected because the DryRun parameter was specified.
    ErrCodeDryRunOperationException = "DryRunOperationException"

    // ErrCodeExpiredImportTokenException for service response error code
    // "ExpiredImportTokenException".
    //
    // The request was rejected because the specified import token is expired. Use
    // GetParametersForImport to get a new import token and public key, use the
    // new public key to encrypt the key material, and then try the request again.
    ErrCodeExpiredImportTokenException = "ExpiredImportTokenException"

    // ErrCodeIncorrectKeyException for service response error code
    // "IncorrectKeyException".
    //
    // The request was rejected because the specified KMS key cannot decrypt the
    // data. The KeyId in a Decrypt request and the SourceKeyId in a ReEncrypt request
    // must identify the same KMS key that was used to encrypt the ciphertext.
    ErrCodeIncorrectKeyException = "IncorrectKeyException"

    // ErrCodeIncorrectKeyMaterialException for service response error code
    // "IncorrectKeyMaterialException".
    //
    // The request was rejected because the key material in the request is, expired,
    // invalid, or is not the same key material that was previously imported into
    // this KMS key.
    ErrCodeIncorrectKeyMaterialException = "IncorrectKeyMaterialException"

    // ErrCodeIncorrectTrustAnchorException for service response error code
    // "IncorrectTrustAnchorException".
    //
    // The request was rejected because the trust anchor certificate in the request
    // to create an CloudHSM key store is not the trust anchor certificate for the
    // specified CloudHSM cluster.
    //
    // When you initialize the CloudHSM cluster (https://docs.aws.amazon.com/cloudhsm/latest/userguide/initialize-cluster.html#sign-csr),
    // you create the trust anchor certificate and save it in the customerCA.crt
    // file.
    ErrCodeIncorrectTrustAnchorException = "IncorrectTrustAnchorException"

    // ErrCodeInternalException for service response error code
    // "KMSInternalException".
    //
    // The request was rejected because an internal exception occurred. The request
    // can be retried.
    ErrCodeInternalException = "KMSInternalException"

    // ErrCodeInvalidAliasNameException for service response error code
    // "InvalidAliasNameException".
    //
    // The request was rejected because the specified alias name is not valid.
    ErrCodeInvalidAliasNameException = "InvalidAliasNameException"

    // ErrCodeInvalidArnException for service response error code
    // "InvalidArnException".
    //
    // The request was rejected because a specified ARN, or an ARN in a key policy,
    // is not valid.
    ErrCodeInvalidArnException = "InvalidArnException"

    // ErrCodeInvalidCiphertextException for service response error code
    // "InvalidCiphertextException".
    //
    // From the Decrypt or ReEncrypt operation, the request was rejected because
    // the specified ciphertext, or additional authenticated data incorporated into
    // the ciphertext, such as the encryption context, is corrupted, missing, or
    // otherwise invalid.
    //
    // From the ImportKeyMaterial operation, the request was rejected because KMS
    // could not decrypt the encrypted (wrapped) key material.
    ErrCodeInvalidCiphertextException = "InvalidCiphertextException"

    // ErrCodeInvalidGrantIdException for service response error code
    // "InvalidGrantIdException".
    //
    // The request was rejected because the specified GrantId is not valid.
    ErrCodeInvalidGrantIdException = "InvalidGrantIdException"

    // ErrCodeInvalidGrantTokenException for service response error code
    // "InvalidGrantTokenException".
    //
    // The request was rejected because the specified grant token is not valid.
    ErrCodeInvalidGrantTokenException = "InvalidGrantTokenException"

    // ErrCodeInvalidImportTokenException for service response error code
    // "InvalidImportTokenException".
    //
    // The request was rejected because the provided import token is invalid or
    // is associated with a different KMS key.
    ErrCodeInvalidImportTokenException = "InvalidImportTokenException"

    // ErrCodeInvalidKeyUsageException for service response error code
    // "InvalidKeyUsageException".
    //
    // The request was rejected for one of the following reasons:
    //
    //    * The KeyUsage value of the KMS key is incompatible with the API operation.
    //
    //    * The encryption algorithm or signing algorithm specified for the operation
    //    is incompatible with the type of key material in the KMS key (KeySpec).
    //
    // For encrypting, decrypting, re-encrypting, and generating data keys, the
    // KeyUsage must be ENCRYPT_DECRYPT. For signing and verifying messages, the
    // KeyUsage must be SIGN_VERIFY. For generating and verifying message authentication
    // codes (MACs), the KeyUsage must be GENERATE_VERIFY_MAC. For deriving key
    // agreement secrets, the KeyUsage must be KEY_AGREEMENT. To find the KeyUsage
    // of a KMS key, use the DescribeKey operation.
    //
    // To find the encryption or signing algorithms supported for a particular KMS
    // key, use the DescribeKey operation.
    ErrCodeInvalidKeyUsageException = "InvalidKeyUsageException"

    // ErrCodeInvalidMarkerException for service response error code
    // "InvalidMarkerException".
    //
    // The request was rejected because the marker that specifies where pagination
    // should next begin is not valid.
    ErrCodeInvalidMarkerException = "InvalidMarkerException"

    // ErrCodeInvalidStateException for service response error code
    // "KMSInvalidStateException".
    //
    // The request was rejected because the state of the specified resource is not
    // valid for this request.
    //
    // This exceptions means one of the following:
    //
    //    * The key state of the KMS key is not compatible with the operation. To
    //    find the key state, use the DescribeKey operation. For more information
    //    about which key states are compatible with each KMS operation, see Key
    //    states of KMS keys (https://docs.aws.amazon.com/kms/latest/developerguide/key-state.html)
    //    in the Key Management Service Developer Guide .
    //
    //    * For cryptographic operations on KMS keys in custom key stores, this
    //    exception represents a general failure with many possible causes. To identify
    //    the cause, see the error message that accompanies the exception.
    ErrCodeInvalidStateException = "KMSInvalidStateException"

    // ErrCodeKMSInvalidMacException for service response error code
    // "KMSInvalidMacException".
    //
    // The request was rejected because the HMAC verification failed. HMAC verification
    // fails when the HMAC computed by using the specified message, HMAC KMS key,
    // and MAC algorithm does not match the HMAC specified in the request.
    ErrCodeKMSInvalidMacException = "KMSInvalidMacException"

    // ErrCodeKMSInvalidSignatureException for service response error code
    // "KMSInvalidSignatureException".
    //
    // The request was rejected because the signature verification failed. Signature
    // verification fails when it cannot confirm that signature was produced by
    // signing the specified message with the specified KMS key and signing algorithm.
    ErrCodeKMSInvalidSignatureException = "KMSInvalidSignatureException"

    // ErrCodeKeyUnavailableException for service response error code
    // "KeyUnavailableException".
    //
    // The request was rejected because the specified KMS key was not available.
    // You can retry the request.
    ErrCodeKeyUnavailableException = "KeyUnavailableException"

    // ErrCodeLimitExceededException for service response error code
    // "LimitExceededException".
    //
    // The request was rejected because a quota was exceeded. For more information,
    // see Quotas (https://docs.aws.amazon.com/kms/latest/developerguide/limits.html)
    // in the Key Management Service Developer Guide.
    ErrCodeLimitExceededException = "LimitExceededException"

    // ErrCodeMalformedPolicyDocumentException for service response error code
    // "MalformedPolicyDocumentException".
    //
    // The request was rejected because the specified policy is not syntactically
    // or semantically correct.
    ErrCodeMalformedPolicyDocumentException = "MalformedPolicyDocumentException"

    // ErrCodeNotFoundException for service response error code
    // "NotFoundException".
    //
    // The request was rejected because the specified entity or resource could not
    // be found.
    ErrCodeNotFoundException = "NotFoundException"

    // ErrCodeTagException for service response error code
    // "TagException".
    //
    // The request was rejected because one or more tags are not valid.
    ErrCodeTagException = "TagException"

    // ErrCodeUnsupportedOperationException for service response error code
    // "UnsupportedOperationException".
    //
    // The request was rejected because a specified parameter is not supported or
    // a specified resource is not valid for this operation.
    ErrCodeUnsupportedOperationException = "UnsupportedOperationException"

    // ErrCodeXksKeyAlreadyInUseException for service response error code
    // "XksKeyAlreadyInUseException".
    //
    // The request was rejected because the (XksKeyId) is already associated with
    // another KMS key in this external key store. Each KMS key in an external key
    // store must be associated with a different external key.
    ErrCodeXksKeyAlreadyInUseException = "XksKeyAlreadyInUseException"

    // ErrCodeXksKeyInvalidConfigurationException for service response error code
    // "XksKeyInvalidConfigurationException".
    //
    // The request was rejected because the external key specified by the XksKeyId
    // parameter did not meet the configuration requirements for an external key
    // store.
    //
    // The external key must be an AES-256 symmetric key that is enabled and performs
    // encryption and decryption.
    ErrCodeXksKeyInvalidConfigurationException = "XksKeyInvalidConfigurationException"

    // ErrCodeXksKeyNotFoundException for service response error code
    // "XksKeyNotFoundException".
    //
    // The request was rejected because the external key store proxy could not find
    // the external key. This exception is thrown when the value of the XksKeyId
    // parameter doesn't identify a key in the external key manager associated with
    // the external key proxy.
    //
    // Verify that the XksKeyId represents an existing key in the external key manager.
    // Use the key identifier that the external key store proxy uses to identify
    // the key. For details, see the documentation provided with your external key
    // store proxy or key manager.
    ErrCodeXksKeyNotFoundException = "XksKeyNotFoundException"

    // ErrCodeXksProxyIncorrectAuthenticationCredentialException for service response error code
    // "XksProxyIncorrectAuthenticationCredentialException".
    //
    // The request was rejected because the proxy credentials failed to authenticate
    // to the specified external key store proxy. The specified external key store
    // proxy rejected a status request from KMS due to invalid credentials. This
    // can indicate an error in the credentials or in the identification of the
    // external key store proxy.
    ErrCodeXksProxyIncorrectAuthenticationCredentialException = "XksProxyIncorrectAuthenticationCredentialException"

    // ErrCodeXksProxyInvalidConfigurationException for service response error code
    // "XksProxyInvalidConfigurationException".
    //
    // The request was rejected because the external key store proxy is not configured
    // correctly. To identify the cause, see the error message that accompanies
    // the exception.
    ErrCodeXksProxyInvalidConfigurationException = "XksProxyInvalidConfigurationException"

    // ErrCodeXksProxyInvalidResponseException for service response error code
    // "XksProxyInvalidResponseException".
    //
    //
    // KMS cannot interpret the response it received from the external key store
    // proxy. The problem might be a poorly constructed response, but it could also
    // be a transient network issue. If you see this error repeatedly, report it
    // to the proxy vendor.
    ErrCodeXksProxyInvalidResponseException = "XksProxyInvalidResponseException"

    // ErrCodeXksProxyUriEndpointInUseException for service response error code
    // "XksProxyUriEndpointInUseException".
    //
    // The request was rejected because the XksProxyUriEndpoint is already associated
    // with another external key store in this Amazon Web Services Region. To identify
    // the cause, see the error message that accompanies the exception.
    ErrCodeXksProxyUriEndpointInUseException = "XksProxyUriEndpointInUseException"

    // ErrCodeXksProxyUriInUseException for service response error code
    // "XksProxyUriInUseException".
    //
    // The request was rejected because the concatenation of the XksProxyUriEndpoint
    // and XksProxyUriPath is already associated with another external key store
    // in this Amazon Web Services Region. Each external key store in a Region must
    // use a unique external key store proxy API address.
    ErrCodeXksProxyUriInUseException = "XksProxyUriInUseException"

    // ErrCodeXksProxyUriUnreachableException for service response error code
    // "XksProxyUriUnreachableException".
    //
    // KMS was unable to reach the specified XksProxyUriPath. The path must be reachable
    // before you create the external key store or update its settings.
    //
    // This exception is also thrown when the external key store proxy response
    // to a GetHealthStatus request indicates that all external key manager instances
    // are unavailable.
    ErrCodeXksProxyUriUnreachableException = "XksProxyUriUnreachableException"

    // ErrCodeXksProxyVpcEndpointServiceInUseException for service response error code
    // "XksProxyVpcEndpointServiceInUseException".
    //
    // The request was rejected because the specified Amazon VPC endpoint service
    // is already associated with another external key store in this Amazon Web
    // Services Region. Each external key store in a Region must use a different
    // Amazon VPC endpoint service.
    ErrCodeXksProxyVpcEndpointServiceInUseException = "XksProxyVpcEndpointServiceInUseException"

    // ErrCodeXksProxyVpcEndpointServiceInvalidConfigurationException for service response error code
    // "XksProxyVpcEndpointServiceInvalidConfigurationException".
    //
    // The request was rejected because the Amazon VPC endpoint service configuration
    // does not fulfill the requirements for an external key store. To identify
    // the cause, see the error message that accompanies the exception and review
    // the requirements (https://docs.aws.amazon.com/kms/latest/developerguide/vpc-connectivity.html#xks-vpc-requirements)
    // for Amazon VPC endpoint service connectivity for an external key store.
    ErrCodeXksProxyVpcEndpointServiceInvalidConfigurationException = "XksProxyVpcEndpointServiceInvalidConfigurationException"

    // ErrCodeXksProxyVpcEndpointServiceNotFoundException for service response error code
    // "XksProxyVpcEndpointServiceNotFoundException".
    //
    // The request was rejected because KMS could not find the specified VPC endpoint
    // service. Use DescribeCustomKeyStores to verify the VPC endpoint service name
    // for the external key store. Also, confirm that the Allow principals list
    // for the VPC endpoint service includes the KMS service principal for the Region,
    // such as cks.kms.us-east-1.amazonaws.com.
    ErrCodeXksProxyVpcEndpointServiceNotFoundException = "XksProxyVpcEndpointServiceNotFoundException"
)
const (
    ServiceName = "kms"       // Name of service.
    EndpointsID = ServiceName // ID to lookup a service endpoint with.
    ServiceID   = "KMS"       // ServiceID is a unique identifier of a specific service.
)

Service information constants

const (
    // KeyAgreementAlgorithmSpecEcdh is a KeyAgreementAlgorithmSpec enum value
    KeyAgreementAlgorithmSpecEcdh = "ECDH"
)
const (
    // KeyEncryptionMechanismRsaesOaepSha256 is a KeyEncryptionMechanism enum value
    KeyEncryptionMechanismRsaesOaepSha256 = "RSAES_OAEP_SHA_256"
)

func AlgorithmSpec_Values

func AlgorithmSpec_Values() []string

AlgorithmSpec_Values returns all elements of the AlgorithmSpec enum

func ConnectionErrorCodeType_Values

func ConnectionErrorCodeType_Values() []string

ConnectionErrorCodeType_Values returns all elements of the ConnectionErrorCodeType enum

func ConnectionStateType_Values

func ConnectionStateType_Values() []string

ConnectionStateType_Values returns all elements of the ConnectionStateType enum

func CustomKeyStoreType_Values

func CustomKeyStoreType_Values() []string

CustomKeyStoreType_Values returns all elements of the CustomKeyStoreType enum

func CustomerMasterKeySpec_Values

func CustomerMasterKeySpec_Values() []string

CustomerMasterKeySpec_Values returns all elements of the CustomerMasterKeySpec enum

func DataKeyPairSpec_Values

func DataKeyPairSpec_Values() []string

DataKeyPairSpec_Values returns all elements of the DataKeyPairSpec enum

func DataKeySpec_Values

func DataKeySpec_Values() []string

DataKeySpec_Values returns all elements of the DataKeySpec enum

func EncryptionAlgorithmSpec_Values

func EncryptionAlgorithmSpec_Values() []string

EncryptionAlgorithmSpec_Values returns all elements of the EncryptionAlgorithmSpec enum

func ExpirationModelType_Values

func ExpirationModelType_Values() []string

ExpirationModelType_Values returns all elements of the ExpirationModelType enum

func GrantOperation_Values

func GrantOperation_Values() []string

GrantOperation_Values returns all elements of the GrantOperation enum

func KeyAgreementAlgorithmSpec_Values

func KeyAgreementAlgorithmSpec_Values() []string

KeyAgreementAlgorithmSpec_Values returns all elements of the KeyAgreementAlgorithmSpec enum

func KeyEncryptionMechanism_Values

func KeyEncryptionMechanism_Values() []string

KeyEncryptionMechanism_Values returns all elements of the KeyEncryptionMechanism enum

func KeyManagerType_Values

func KeyManagerType_Values() []string

KeyManagerType_Values returns all elements of the KeyManagerType enum

func KeySpec_Values

func KeySpec_Values() []string

KeySpec_Values returns all elements of the KeySpec enum

func KeyState_Values

func KeyState_Values() []string

KeyState_Values returns all elements of the KeyState enum

func KeyUsageType_Values

func KeyUsageType_Values() []string

KeyUsageType_Values returns all elements of the KeyUsageType enum

func MacAlgorithmSpec_Values

func MacAlgorithmSpec_Values() []string

MacAlgorithmSpec_Values returns all elements of the MacAlgorithmSpec enum

func MessageType_Values

func MessageType_Values() []string

MessageType_Values returns all elements of the MessageType enum

func MultiRegionKeyType_Values

func MultiRegionKeyType_Values() []string

MultiRegionKeyType_Values returns all elements of the MultiRegionKeyType enum

func OriginType_Values

func OriginType_Values() []string

OriginType_Values returns all elements of the OriginType enum

func RotationType_Values

func RotationType_Values() []string

RotationType_Values returns all elements of the RotationType enum

func SigningAlgorithmSpec_Values

func SigningAlgorithmSpec_Values() []string

SigningAlgorithmSpec_Values returns all elements of the SigningAlgorithmSpec enum

func WrappingKeySpec_Values

func WrappingKeySpec_Values() []string

WrappingKeySpec_Values returns all elements of the WrappingKeySpec enum

func XksProxyConnectivityType_Values

func XksProxyConnectivityType_Values() []string

XksProxyConnectivityType_Values returns all elements of the XksProxyConnectivityType enum

type AliasListEntry

type AliasListEntry struct {

    // String that contains the key ARN.
    AliasArn *string `min:"20" type:"string"`

    // String that contains the alias. This value begins with alias/.
    AliasName *string `min:"1" type:"string"`

    // Date and time that the alias was most recently created in the account and
    // Region. Formatted as Unix time.
    CreationDate *time.Time `type:"timestamp"`

    // Date and time that the alias was most recently associated with a KMS key
    // in the account and Region. Formatted as Unix time.
    LastUpdatedDate *time.Time `type:"timestamp"`

    // String that contains the key identifier of the KMS key associated with the
    // alias.
    TargetKeyId *string `min:"1" type:"string"`
    // contains filtered or unexported fields
}

Contains information about an alias.

func (AliasListEntry) GoString

func (s AliasListEntry) GoString() string

GoString returns the string representation.

API parameter values that are decorated as "sensitive" in the API will not be included in the string output. The member name will be present, but the value will be replaced with "sensitive".

func (*AliasListEntry) SetAliasArn

func (s *AliasListEntry) SetAliasArn(v string) *AliasListEntry

SetAliasArn sets the AliasArn field's value.

func (*AliasListEntry) SetAliasName

func (s *AliasListEntry) SetAliasName(v string) *AliasListEntry

SetAliasName sets the AliasName field's value.

func (*AliasListEntry) SetCreationDate

func (s *AliasListEntry) SetCreationDate(v time.Time) *AliasListEntry

SetCreationDate sets the CreationDate field's value.

func (*AliasListEntry) SetLastUpdatedDate

func (s *AliasListEntry) SetLastUpdatedDate(v time.Time) *AliasListEntry

SetLastUpdatedDate sets the LastUpdatedDate field's value.

func (*AliasListEntry) SetTargetKeyId

func (s *AliasListEntry) SetTargetKeyId(v string) *AliasListEntry

SetTargetKeyId sets the TargetKeyId field's value.

func (AliasListEntry) String

func (s AliasListEntry) String() string

String returns the string representation.

API parameter values that are decorated as "sensitive" in the API will not be included in the string output. The member name will be present, but the value will be replaced with "sensitive".

type AlreadyExistsException

type AlreadyExistsException struct {
    RespMetadata protocol.ResponseMetadata `json:"-" xml:"-"`

    Message_ *string `locationName:"message" type:"string"`
    // contains filtered or unexported fields
}

The request was rejected because it attempted to create a resource that already exists.

func (*AlreadyExistsException) Code

func (s *AlreadyExistsException) Code() string

Code returns the exception type name.

func (*AlreadyExistsException) Error

func (s *AlreadyExistsException) Error() string

func (AlreadyExistsException) GoString

func (s AlreadyExistsException) GoString() string

GoString returns the string representation.

API parameter values that are decorated as "sensitive" in the API will not be included in the string output. The member name will be present, but the value will be replaced with "sensitive".

func (*AlreadyExistsException) Message

func (s *AlreadyExistsException) Message() string

Message returns the exception's message.

func (*AlreadyExistsException) OrigErr

func (s *AlreadyExistsException) OrigErr() error

OrigErr always returns nil, satisfies awserr.Error interface.

func (*AlreadyExistsException) RequestID

func (s *AlreadyExistsException) RequestID() string

RequestID returns the service's response RequestID for request.

func (*AlreadyExistsException) StatusCode

func (s *AlreadyExistsException) StatusCode() int

Status code returns the HTTP status code for the request's response error.

func (AlreadyExistsException) String

func (s AlreadyExistsException) String() string

String returns the string representation.

API parameter values that are decorated as "sensitive" in the API will not be included in the string output. The member name will be present, but the value will be replaced with "sensitive".

type CancelKeyDeletionInput

type CancelKeyDeletionInput struct {

    // Identifies the KMS key whose deletion is being canceled.
    //
    // Specify the key ID or key ARN of the KMS key.
    //
    // For example:
    //
    //    * Key ID: 1234abcd-12ab-34cd-56ef-1234567890ab
    //
    //    * Key ARN: arn:aws:kms:us-east-2:111122223333:key/1234abcd-12ab-34cd-56ef-1234567890ab
    //
    // To get the key ID and key ARN for a KMS key, use ListKeys or DescribeKey.
    //
    // KeyId is a required field
    KeyId *string `min:"1" type:"string" required:"true"`
    // contains filtered or unexported fields
}

func (CancelKeyDeletionInput) GoString

func (s CancelKeyDeletionInput) GoString() string

GoString returns the string representation.

API parameter values that are decorated as "sensitive" in the API will not be included in the string output. The member name will be present, but the value will be replaced with "sensitive".

func (*CancelKeyDeletionInput) SetKeyId

func (s *CancelKeyDeletionInput) SetKeyId(v string) *CancelKeyDeletionInput

SetKeyId sets the KeyId field's value.

func (CancelKeyDeletionInput) String

func (s CancelKeyDeletionInput) String() string

String returns the string representation.

API parameter values that are decorated as "sensitive" in the API will not be included in the string output. The member name will be present, but the value will be replaced with "sensitive".

func (*CancelKeyDeletionInput) Validate

func (s *CancelKeyDeletionInput) Validate() error

Validate inspects the fields of the type to determine if they are valid.

type CancelKeyDeletionOutput

type CancelKeyDeletionOutput struct {

    // The Amazon Resource Name (key ARN (https://docs.aws.amazon.com/kms/latest/developerguide/concepts.html#key-id-key-ARN))
    // of the KMS key whose deletion is canceled.
    KeyId *string `min:"1" type:"string"`
    // contains filtered or unexported fields
}

func (CancelKeyDeletionOutput) GoString

func (s CancelKeyDeletionOutput) GoString() string

GoString returns the string representation.

API parameter values that are decorated as "sensitive" in the API will not be included in the string output. The member name will be present, but the value will be replaced with "sensitive".

func (*CancelKeyDeletionOutput) SetKeyId

func (s *CancelKeyDeletionOutput) SetKeyId(v string) *CancelKeyDeletionOutput

SetKeyId sets the KeyId field's value.

func (CancelKeyDeletionOutput) String

func (s CancelKeyDeletionOutput) String() string

String returns the string representation.

API parameter values that are decorated as "sensitive" in the API will not be included in the string output. The member name will be present, but the value will be replaced with "sensitive".

type CloudHsmClusterInUseException

type CloudHsmClusterInUseException struct {
    RespMetadata protocol.ResponseMetadata `json:"-" xml:"-"`

    Message_ *string `locationName:"message" type:"string"`
    // contains filtered or unexported fields
}

The request was rejected because the specified CloudHSM cluster is already associated with an CloudHSM key store in the account, or it shares a backup history with an CloudHSM key store in the account. Each CloudHSM key store in the account must be associated with a different CloudHSM cluster.

CloudHSM clusters that share a backup history have the same cluster certificate. To view the cluster certificate of an CloudHSM cluster, use the DescribeClusters (https://docs.aws.amazon.com/cloudhsm/latest/APIReference/API_DescribeClusters.html) operation.

func (*CloudHsmClusterInUseException) Code

func (s *CloudHsmClusterInUseException) Code() string

Code returns the exception type name.

func (*CloudHsmClusterInUseException) Error

func (s *CloudHsmClusterInUseException) Error() string

func (CloudHsmClusterInUseException) GoString

func (s CloudHsmClusterInUseException) GoString() string

GoString returns the string representation.

API parameter values that are decorated as "sensitive" in the API will not be included in the string output. The member name will be present, but the value will be replaced with "sensitive".

func (*CloudHsmClusterInUseException) Message

func (s *CloudHsmClusterInUseException) Message() string

Message returns the exception's message.

func (*CloudHsmClusterInUseException) OrigErr

func (s *CloudHsmClusterInUseException) OrigErr() error

OrigErr always returns nil, satisfies awserr.Error interface.

func (*CloudHsmClusterInUseException) RequestID

func (s *CloudHsmClusterInUseException) RequestID() string

RequestID returns the service's response RequestID for request.

func (*CloudHsmClusterInUseException) StatusCode

func (s *CloudHsmClusterInUseException) StatusCode() int

Status code returns the HTTP status code for the request's response error.

func (CloudHsmClusterInUseException) String

func (s CloudHsmClusterInUseException) String() string

String returns the string representation.

API parameter values that are decorated as "sensitive" in the API will not be included in the string output. The member name will be present, but the value will be replaced with "sensitive".

type CloudHsmClusterInvalidConfigurationException

type CloudHsmClusterInvalidConfigurationException struct {
    RespMetadata protocol.ResponseMetadata `json:"-" xml:"-"`

    Message_ *string `locationName:"message" type:"string"`
    // contains filtered or unexported fields
}

The request was rejected because the associated CloudHSM cluster did not meet the configuration requirements for an CloudHSM key store.

  • The CloudHSM cluster must be configured with private subnets in at least two different Availability Zones in the Region.

  • The security group for the cluster (https://docs.aws.amazon.com/cloudhsm/latest/userguide/configure-sg.html) (cloudhsm-cluster-<cluster-id>-sg) must include inbound rules and outbound rules that allow TCP traffic on ports 2223-2225. The Source in the inbound rules and the Destination in the outbound rules must match the security group ID. These rules are set by default when you create the CloudHSM cluster. Do not delete or change them. To get information about a particular security group, use the DescribeSecurityGroups (https://docs.aws.amazon.com/AWSEC2/latest/APIReference/API_DescribeSecurityGroups.html) operation.

  • The CloudHSM cluster must contain at least as many HSMs as the operation requires. To add HSMs, use the CloudHSM CreateHsm (https://docs.aws.amazon.com/cloudhsm/latest/APIReference/API_CreateHsm.html) operation. For the CreateCustomKeyStore, UpdateCustomKeyStore, and CreateKey operations, the CloudHSM cluster must have at least two active HSMs, each in a different Availability Zone. For the ConnectCustomKeyStore operation, the CloudHSM must contain at least one active HSM.

For information about the requirements for an CloudHSM cluster that is associated with an CloudHSM key store, see Assemble the Prerequisites (https://docs.aws.amazon.com/kms/latest/developerguide/create-keystore.html#before-keystore) in the Key Management Service Developer Guide. For information about creating a private subnet for an CloudHSM cluster, see Create a Private Subnet (https://docs.aws.amazon.com/cloudhsm/latest/userguide/create-subnets.html) in the CloudHSM User Guide. For information about cluster security groups, see Configure a Default Security Group (https://docs.aws.amazon.com/cloudhsm/latest/userguide/configure-sg.html) in the CloudHSM User Guide .

func (*CloudHsmClusterInvalidConfigurationException) Code

func (s *CloudHsmClusterInvalidConfigurationException) Code() string

Code returns the exception type name.

func (*CloudHsmClusterInvalidConfigurationException) Error

func (s *CloudHsmClusterInvalidConfigurationException) Error() string

func (CloudHsmClusterInvalidConfigurationException) GoString

func (s CloudHsmClusterInvalidConfigurationException) GoString() string

GoString returns the string representation.

API parameter values that are decorated as "sensitive" in the API will not be included in the string output. The member name will be present, but the value will be replaced with "sensitive".

func (*CloudHsmClusterInvalidConfigurationException) Message

func (s *CloudHsmClusterInvalidConfigurationException) Message() string

Message returns the exception's message.

func (*CloudHsmClusterInvalidConfigurationException) OrigErr

func (s *CloudHsmClusterInvalidConfigurationException) OrigErr() error

OrigErr always returns nil, satisfies awserr.Error interface.

func (*CloudHsmClusterInvalidConfigurationException) RequestID

func (s *CloudHsmClusterInvalidConfigurationException) RequestID() string

RequestID returns the service's response RequestID for request.

func (*CloudHsmClusterInvalidConfigurationException) StatusCode

func (s *CloudHsmClusterInvalidConfigurationException) StatusCode() int

Status code returns the HTTP status code for the request's response error.

func (CloudHsmClusterInvalidConfigurationException) String

func (s CloudHsmClusterInvalidConfigurationException) String() string

String returns the string representation.

API parameter values that are decorated as "sensitive" in the API will not be included in the string output. The member name will be present, but the value will be replaced with "sensitive".

type CloudHsmClusterNotActiveException

type CloudHsmClusterNotActiveException struct {
    RespMetadata protocol.ResponseMetadata `json:"-" xml:"-"`

    Message_ *string `locationName:"message" type:"string"`
    // contains filtered or unexported fields
}

The request was rejected because the CloudHSM cluster associated with the CloudHSM key store is not active. Initialize and activate the cluster and try the command again. For detailed instructions, see Getting Started (https://docs.aws.amazon.com/cloudhsm/latest/userguide/getting-started.html) in the CloudHSM User Guide.

func (*CloudHsmClusterNotActiveException) Code

func (s *CloudHsmClusterNotActiveException) Code() string

Code returns the exception type name.

func (*CloudHsmClusterNotActiveException) Error

func (s *CloudHsmClusterNotActiveException) Error() string

func (CloudHsmClusterNotActiveException) GoString

func (s CloudHsmClusterNotActiveException) GoString() string

GoString returns the string representation.

API parameter values that are decorated as "sensitive" in the API will not be included in the string output. The member name will be present, but the value will be replaced with "sensitive".

func (*CloudHsmClusterNotActiveException) Message

func (s *CloudHsmClusterNotActiveException) Message() string

Message returns the exception's message.

func (*CloudHsmClusterNotActiveException) OrigErr

func (s *CloudHsmClusterNotActiveException) OrigErr() error

OrigErr always returns nil, satisfies awserr.Error interface.

func (*CloudHsmClusterNotActiveException) RequestID

func (s *CloudHsmClusterNotActiveException) RequestID() string

RequestID returns the service's response RequestID for request.

func (*CloudHsmClusterNotActiveException) StatusCode

func (s *CloudHsmClusterNotActiveException) StatusCode() int

Status code returns the HTTP status code for the request's response error.

func (CloudHsmClusterNotActiveException) String

func (s CloudHsmClusterNotActiveException) String() string

String returns the string representation.

API parameter values that are decorated as "sensitive" in the API will not be included in the string output. The member name will be present, but the value will be replaced with "sensitive".

type CloudHsmClusterNotFoundException

type CloudHsmClusterNotFoundException struct {
    RespMetadata protocol.ResponseMetadata `json:"-" xml:"-"`

    Message_ *string `locationName:"message" type:"string"`
    // contains filtered or unexported fields
}

The request was rejected because KMS cannot find the CloudHSM cluster with the specified cluster ID. Retry the request with a different cluster ID.

func (*CloudHsmClusterNotFoundException) Code

func (s *CloudHsmClusterNotFoundException) Code() string

Code returns the exception type name.

func (*CloudHsmClusterNotFoundException) Error

func (s *CloudHsmClusterNotFoundException) Error() string

func (CloudHsmClusterNotFoundException) GoString

func (s CloudHsmClusterNotFoundException) GoString() string

GoString returns the string representation.

API parameter values that are decorated as "sensitive" in the API will not be included in the string output. The member name will be present, but the value will be replaced with "sensitive".

func (*CloudHsmClusterNotFoundException) Message

func (s *CloudHsmClusterNotFoundException) Message() string

Message returns the exception's message.

func (*CloudHsmClusterNotFoundException) OrigErr

func (s *CloudHsmClusterNotFoundException) OrigErr() error

OrigErr always returns nil, satisfies awserr.Error interface.

func (*CloudHsmClusterNotFoundException) RequestID

func (s *CloudHsmClusterNotFoundException) RequestID() string

RequestID returns the service's response RequestID for request.

func (*CloudHsmClusterNotFoundException) StatusCode

func (s *CloudHsmClusterNotFoundException) StatusCode() int

Status code returns the HTTP status code for the request's response error.

func (CloudHsmClusterNotFoundException) String

func (s CloudHsmClusterNotFoundException) String() string

String returns the string representation.

API parameter values that are decorated as "sensitive" in the API will not be included in the string output. The member name will be present, but the value will be replaced with "sensitive".

type CloudHsmClusterNotRelatedException

type CloudHsmClusterNotRelatedException struct {
    RespMetadata protocol.ResponseMetadata `json:"-" xml:"-"`

    Message_ *string `locationName:"message" type:"string"`
    // contains filtered or unexported fields
}

The request was rejected because the specified CloudHSM cluster has a different cluster certificate than the original cluster. You cannot use the operation to specify an unrelated cluster for an CloudHSM key store.

Specify an CloudHSM cluster that shares a backup history with the original cluster. This includes clusters that were created from a backup of the current cluster, and clusters that were created from the same backup that produced the current cluster.

CloudHSM clusters that share a backup history have the same cluster certificate. To view the cluster certificate of an CloudHSM cluster, use the DescribeClusters (https://docs.aws.amazon.com/cloudhsm/latest/APIReference/API_DescribeClusters.html) operation.

func (*CloudHsmClusterNotRelatedException) Code

func (s *CloudHsmClusterNotRelatedException) Code() string

Code returns the exception type name.

func (*CloudHsmClusterNotRelatedException) Error

func (s *CloudHsmClusterNotRelatedException) Error() string

func (CloudHsmClusterNotRelatedException) GoString

func (s CloudHsmClusterNotRelatedException) GoString() string

GoString returns the string representation.

API parameter values that are decorated as "sensitive" in the API will not be included in the string output. The member name will be present, but the value will be replaced with "sensitive".

func (*CloudHsmClusterNotRelatedException) Message

func (s *CloudHsmClusterNotRelatedException) Message() string

Message returns the exception's message.

func (*CloudHsmClusterNotRelatedException) OrigErr

func (s *CloudHsmClusterNotRelatedException) OrigErr() error

OrigErr always returns nil, satisfies awserr.Error interface.

func (*CloudHsmClusterNotRelatedException) RequestID

func (s *CloudHsmClusterNotRelatedException) RequestID() string

RequestID returns the service's response RequestID for request.

func (*CloudHsmClusterNotRelatedException) StatusCode

func (s *CloudHsmClusterNotRelatedException) StatusCode() int

Status code returns the HTTP status code for the request's response error.

func (CloudHsmClusterNotRelatedException) String

func (s CloudHsmClusterNotRelatedException) String() string

String returns the string representation.

API parameter values that are decorated as "sensitive" in the API will not be included in the string output. The member name will be present, but the value will be replaced with "sensitive".

type ConflictException

type ConflictException struct {
    RespMetadata protocol.ResponseMetadata `json:"-" xml:"-"`

    Message_ *string `locationName:"message" type:"string"`
    // contains filtered or unexported fields
}

The request was rejected because an automatic rotation of this key is currently in progress or scheduled to begin within the next 20 minutes.

func (*ConflictException) Code

func (s *ConflictException) Code() string

Code returns the exception type name.

func (*ConflictException) Error

func (s *ConflictException) Error() string

func (ConflictException) GoString

func (s ConflictException) GoString() string

GoString returns the string representation.

API parameter values that are decorated as "sensitive" in the API will not be included in the string output. The member name will be present, but the value will be replaced with "sensitive".

func (*ConflictException) Message

func (s *ConflictException) Message() string

Message returns the exception's message.

func (*ConflictException) OrigErr

func (s *ConflictException) OrigErr() error

OrigErr always returns nil, satisfies awserr.Error interface.

func (*ConflictException) RequestID

func (s *ConflictException) RequestID() string

RequestID returns the service's response RequestID for request.

func (*ConflictException) StatusCode

func (s *ConflictException) StatusCode() int

Status code returns the HTTP status code for the request's response error.

func (ConflictException) String

func (s ConflictException) String() string

String returns the string representation.

API parameter values that are decorated as "sensitive" in the API will not be included in the string output. The member name will be present, but the value will be replaced with "sensitive".

type ConnectCustomKeyStoreInput

type ConnectCustomKeyStoreInput struct {

    // Enter the key store ID of the custom key store that you want to connect.
    // To find the ID of a custom key store, use the DescribeCustomKeyStores operation.
    //
    // CustomKeyStoreId is a required field
    CustomKeyStoreId *string `min:"1" type:"string" required:"true"`
    // contains filtered or unexported fields
}

func (ConnectCustomKeyStoreInput) GoString

func (s ConnectCustomKeyStoreInput) GoString() string

GoString returns the string representation.

API parameter values that are decorated as "sensitive" in the API will not be included in the string output. The member name will be present, but the value will be replaced with "sensitive".

func (*ConnectCustomKeyStoreInput) SetCustomKeyStoreId

func (s *ConnectCustomKeyStoreInput) SetCustomKeyStoreId(v string) *ConnectCustomKeyStoreInput

SetCustomKeyStoreId sets the CustomKeyStoreId field's value.

func (ConnectCustomKeyStoreInput) String

func (s ConnectCustomKeyStoreInput) String() string

String returns the string representation.

API parameter values that are decorated as "sensitive" in the API will not be included in the string output. The member name will be present, but the value will be replaced with "sensitive".

func (*ConnectCustomKeyStoreInput) Validate

func (s *ConnectCustomKeyStoreInput) Validate() error

Validate inspects the fields of the type to determine if they are valid.

type ConnectCustomKeyStoreOutput

type ConnectCustomKeyStoreOutput struct {
    // contains filtered or unexported fields
}

func (ConnectCustomKeyStoreOutput) GoString

func (s ConnectCustomKeyStoreOutput) GoString() string

GoString returns the string representation.

API parameter values that are decorated as "sensitive" in the API will not be included in the string output. The member name will be present, but the value will be replaced with "sensitive".

func (ConnectCustomKeyStoreOutput) String

func (s ConnectCustomKeyStoreOutput) String() string

String returns the string representation.

API parameter values that are decorated as "sensitive" in the API will not be included in the string output. The member name will be present, but the value will be replaced with "sensitive".

type CreateAliasInput

type CreateAliasInput struct {

    // Specifies the alias name. This value must begin with alias/ followed by a
    // name, such as alias/ExampleAlias.
    //
    // Do not include confidential or sensitive information in this field. This
    // field may be displayed in plaintext in CloudTrail logs and other output.
    //
    // The AliasName value must be string of 1-256 characters. It can contain only
    // alphanumeric characters, forward slashes (/), underscores (_), and dashes
    // (-). The alias name cannot begin with alias/aws/. The alias/aws/ prefix is
    // reserved for Amazon Web Services managed keys (https://docs.aws.amazon.com/kms/latest/developerguide/concepts.html#aws-managed-cmk).
    //
    // AliasName is a required field
    AliasName *string `min:"1" type:"string" required:"true"`

    // Associates the alias with the specified customer managed key (https://docs.aws.amazon.com/kms/latest/developerguide/concepts.html#customer-cmk).
    // The KMS key must be in the same Amazon Web Services Region.
    //
    // A valid key ID is required. If you supply a null or empty string value, this
    // operation returns an error.
    //
    // For help finding the key ID and ARN, see Finding the Key ID and ARN (https://docs.aws.amazon.com/kms/latest/developerguide/viewing-keys.html#find-cmk-id-arn)
    // in the Key Management Service Developer Guide .
    //
    // Specify the key ID or key ARN of the KMS key.
    //
    // For example:
    //
    //    * Key ID: 1234abcd-12ab-34cd-56ef-1234567890ab
    //
    //    * Key ARN: arn:aws:kms:us-east-2:111122223333:key/1234abcd-12ab-34cd-56ef-1234567890ab
    //
    // To get the key ID and key ARN for a KMS key, use ListKeys or DescribeKey.
    //
    // TargetKeyId is a required field
    TargetKeyId *string `min:"1" type:"string" required:"true"`
    // contains filtered or unexported fields
}

func (CreateAliasInput) GoString

func (s CreateAliasInput) GoString() string

GoString returns the string representation.

API parameter values that are decorated as "sensitive" in the API will not be included in the string output. The member name will be present, but the value will be replaced with "sensitive".

func (*CreateAliasInput) SetAliasName

func (s *CreateAliasInput) SetAliasName(v string) *CreateAliasInput

SetAliasName sets the AliasName field's value.

func (*CreateAliasInput) SetTargetKeyId

func (s *CreateAliasInput) SetTargetKeyId(v string) *CreateAliasInput

SetTargetKeyId sets the TargetKeyId field's value.

func (CreateAliasInput) String

func (s CreateAliasInput) String() string

String returns the string representation.

API parameter values that are decorated as "sensitive" in the API will not be included in the string output. The member name will be present, but the value will be replaced with "sensitive".

func (*CreateAliasInput) Validate

func (s *CreateAliasInput) Validate() error

Validate inspects the fields of the type to determine if they are valid.

type CreateAliasOutput

type CreateAliasOutput struct {
    // contains filtered or unexported fields
}

func (CreateAliasOutput) GoString

func (s CreateAliasOutput) GoString() string

GoString returns the string representation.

API parameter values that are decorated as "sensitive" in the API will not be included in the string output. The member name will be present, but the value will be replaced with "sensitive".

func (CreateAliasOutput) String

func (s CreateAliasOutput) String() string

String returns the string representation.

API parameter values that are decorated as "sensitive" in the API will not be included in the string output. The member name will be present, but the value will be replaced with "sensitive".

type CreateCustomKeyStoreInput

type CreateCustomKeyStoreInput struct {

    // Identifies the CloudHSM cluster for an CloudHSM key store. This parameter
    // is required for custom key stores with CustomKeyStoreType of AWS_CLOUDHSM.
    //
    // Enter the cluster ID of any active CloudHSM cluster that is not already associated
    // with a custom key store. To find the cluster ID, use the DescribeClusters
    // (https://docs.aws.amazon.com/cloudhsm/latest/APIReference/API_DescribeClusters.html)
    // operation.
    CloudHsmClusterId *string `min:"19" type:"string"`

    // Specifies a friendly name for the custom key store. The name must be unique
    // in your Amazon Web Services account and Region. This parameter is required
    // for all custom key stores.
    //
    // Do not include confidential or sensitive information in this field. This
    // field may be displayed in plaintext in CloudTrail logs and other output.
    //
    // CustomKeyStoreName is a required field
    CustomKeyStoreName *string `min:"1" type:"string" required:"true"`

    // Specifies the type of custom key store. The default value is AWS_CLOUDHSM.
    //
    // For a custom key store backed by an CloudHSM cluster, omit the parameter
    // or enter AWS_CLOUDHSM. For a custom key store backed by an external key manager
    // outside of Amazon Web Services, enter EXTERNAL_KEY_STORE. You cannot change
    // this property after the key store is created.
    CustomKeyStoreType *string `type:"string" enum:"CustomKeyStoreType"`

    // Specifies the kmsuser password for an CloudHSM key store. This parameter
    // is required for custom key stores with a CustomKeyStoreType of AWS_CLOUDHSM.
    //
    // Enter the password of the kmsuser crypto user (CU) account (https://docs.aws.amazon.com/kms/latest/developerguide/key-store-concepts.html#concept-kmsuser)
    // in the specified CloudHSM cluster. KMS logs into the cluster as this user
    // to manage key material on your behalf.
    //
    // The password must be a string of 7 to 32 characters. Its value is case sensitive.
    //
    // This parameter tells KMS the kmsuser account password; it does not change
    // the password in the CloudHSM cluster.
    //
    // KeyStorePassword is a sensitive parameter and its value will be
    // replaced with "sensitive" in string returned by CreateCustomKeyStoreInput's
    // String and GoString methods.
    KeyStorePassword *string `min:"7" type:"string" sensitive:"true"`

    // Specifies the certificate for an CloudHSM key store. This parameter is required
    // for custom key stores with a CustomKeyStoreType of AWS_CLOUDHSM.
    //
    // Enter the content of the trust anchor certificate for the CloudHSM cluster.
    // This is the content of the customerCA.crt file that you created when you
    // initialized the cluster (https://docs.aws.amazon.com/cloudhsm/latest/userguide/initialize-cluster.html).
    TrustAnchorCertificate *string `min:"1" type:"string"`

    // Specifies an authentication credential for the external key store proxy (XKS
    // proxy). This parameter is required for all custom key stores with a CustomKeyStoreType
    // of EXTERNAL_KEY_STORE.
    //
    // The XksProxyAuthenticationCredential has two required elements: RawSecretAccessKey,
    // a secret key, and AccessKeyId, a unique identifier for the RawSecretAccessKey.
    // For character requirements, see XksProxyAuthenticationCredentialType (kms/latest/APIReference/API_XksProxyAuthenticationCredentialType.html).
    //
    // KMS uses this authentication credential to sign requests to the external
    // key store proxy on your behalf. This credential is unrelated to Identity
    // and Access Management (IAM) and Amazon Web Services credentials.
    //
    // This parameter doesn't set or change the authentication credentials on the
    // XKS proxy. It just tells KMS the credential that you established on your
    // external key store proxy. If you rotate your proxy authentication credential,
    // use the UpdateCustomKeyStore operation to provide the new credential to KMS.
    XksProxyAuthenticationCredential *XksProxyAuthenticationCredentialType `type:"structure"`

    // Indicates how KMS communicates with the external key store proxy. This parameter
    // is required for custom key stores with a CustomKeyStoreType of EXTERNAL_KEY_STORE.
    //
    // If the external key store proxy uses a public endpoint, specify PUBLIC_ENDPOINT.
    // If the external key store proxy uses a Amazon VPC endpoint service for communication
    // with KMS, specify VPC_ENDPOINT_SERVICE. For help making this choice, see
    // Choosing a connectivity option (https://docs.aws.amazon.com/kms/latest/developerguide/plan-xks-keystore.html#choose-xks-connectivity)
    // in the Key Management Service Developer Guide.
    //
    // An Amazon VPC endpoint service keeps your communication with KMS in a private
    // address space entirely within Amazon Web Services, but it requires more configuration,
    // including establishing a Amazon VPC with multiple subnets, a VPC endpoint
    // service, a network load balancer, and a verified private DNS name. A public
    // endpoint is simpler to set up, but it might be slower and might not fulfill
    // your security requirements. You might consider testing with a public endpoint,
    // and then establishing a VPC endpoint service for production tasks. Note that
    // this choice does not determine the location of the external key store proxy.
    // Even if you choose a VPC endpoint service, the proxy can be hosted within
    // the VPC or outside of Amazon Web Services such as in your corporate data
    // center.
    XksProxyConnectivity *string `type:"string" enum:"XksProxyConnectivityType"`

    // Specifies the endpoint that KMS uses to send requests to the external key
    // store proxy (XKS proxy). This parameter is required for custom key stores
    // with a CustomKeyStoreType of EXTERNAL_KEY_STORE.
    //
    // The protocol must be HTTPS. KMS communicates on port 443. Do not specify
    // the port in the XksProxyUriEndpoint value.
    //
    // For external key stores with XksProxyConnectivity value of VPC_ENDPOINT_SERVICE,
    // specify https:// followed by the private DNS name of the VPC endpoint service.
    //
    // For external key stores with PUBLIC_ENDPOINT connectivity, this endpoint
    // must be reachable before you create the custom key store. KMS connects to
    // the external key store proxy while creating the custom key store. For external
    // key stores with VPC_ENDPOINT_SERVICE connectivity, KMS connects when you
    // call the ConnectCustomKeyStore operation.
    //
    // The value of this parameter must begin with https://. The remainder can contain
    // upper and lower case letters (A-Z and a-z), numbers (0-9), dots (.), and
    // hyphens (-). Additional slashes (/ and \) are not permitted.
    //
    // Uniqueness requirements:
    //
    //    * The combined XksProxyUriEndpoint and XksProxyUriPath values must be
    //    unique in the Amazon Web Services account and Region.
    //
    //    * An external key store with PUBLIC_ENDPOINT connectivity cannot use the
    //    same XksProxyUriEndpoint value as an external key store with VPC_ENDPOINT_SERVICE
    //    connectivity in this Amazon Web Services Region.
    //
    //    * Each external key store with VPC_ENDPOINT_SERVICE connectivity must
    //    have its own private DNS name. The XksProxyUriEndpoint value for external
    //    key stores with VPC_ENDPOINT_SERVICE connectivity (private DNS name) must
    //    be unique in the Amazon Web Services account and Region.
    XksProxyUriEndpoint *string `min:"10" type:"string"`

    // Specifies the base path to the proxy APIs for this external key store. To
    // find this value, see the documentation for your external key store proxy.
    // This parameter is required for all custom key stores with a CustomKeyStoreType
    // of EXTERNAL_KEY_STORE.
    //
    // The value must start with / and must end with /kms/xks/v1 where v1 represents
    // the version of the KMS external key store proxy API. This path can include
    // an optional prefix between the required elements such as /prefix/kms/xks/v1.
    //
    // Uniqueness requirements:
    //
    //    * The combined XksProxyUriEndpoint and XksProxyUriPath values must be
    //    unique in the Amazon Web Services account and Region.
    XksProxyUriPath *string `min:"10" type:"string"`

    // Specifies the name of the Amazon VPC endpoint service for interface endpoints
    // that is used to communicate with your external key store proxy (XKS proxy).
    // This parameter is required when the value of CustomKeyStoreType is EXTERNAL_KEY_STORE
    // and the value of XksProxyConnectivity is VPC_ENDPOINT_SERVICE.
    //
    // The Amazon VPC endpoint service must fulfill all requirements (https://docs.aws.amazon.com/kms/latest/developerguide/create-xks-keystore.html#xks-requirements)
    // for use with an external key store.
    //
    // Uniqueness requirements:
    //
    //    * External key stores with VPC_ENDPOINT_SERVICE connectivity can share
    //    an Amazon VPC, but each external key store must have its own VPC endpoint
    //    service and private DNS name.
    XksProxyVpcEndpointServiceName *string `min:"20" type:"string"`
    // contains filtered or unexported fields
}

func (CreateCustomKeyStoreInput) GoString

func (s CreateCustomKeyStoreInput) GoString() string

GoString returns the string representation.

API parameter values that are decorated as "sensitive" in the API will not be included in the string output. The member name will be present, but the value will be replaced with "sensitive".

func (*CreateCustomKeyStoreInput) SetCloudHsmClusterId

func (s *CreateCustomKeyStoreInput) SetCloudHsmClusterId(v string) *CreateCustomKeyStoreInput

SetCloudHsmClusterId sets the CloudHsmClusterId field's value.

func (*CreateCustomKeyStoreInput) SetCustomKeyStoreName

func (s *CreateCustomKeyStoreInput) SetCustomKeyStoreName(v string) *CreateCustomKeyStoreInput

SetCustomKeyStoreName sets the CustomKeyStoreName field's value.

func (*CreateCustomKeyStoreInput) SetCustomKeyStoreType

func (s *CreateCustomKeyStoreInput) SetCustomKeyStoreType(v string) *CreateCustomKeyStoreInput

SetCustomKeyStoreType sets the CustomKeyStoreType field's value.

func (*CreateCustomKeyStoreInput) SetKeyStorePassword

func (s *CreateCustomKeyStoreInput) SetKeyStorePassword(v string) *CreateCustomKeyStoreInput

SetKeyStorePassword sets the KeyStorePassword field's value.

func (*CreateCustomKeyStoreInput) SetTrustAnchorCertificate

func (s *CreateCustomKeyStoreInput) SetTrustAnchorCertificate(v string) *CreateCustomKeyStoreInput

SetTrustAnchorCertificate sets the TrustAnchorCertificate field's value.

func (*CreateCustomKeyStoreInput) SetXksProxyAuthenticationCredential

func (s *CreateCustomKeyStoreInput) SetXksProxyAuthenticationCredential(v *XksProxyAuthenticationCredentialType) *CreateCustomKeyStoreInput

SetXksProxyAuthenticationCredential sets the XksProxyAuthenticationCredential field's value.

func (*CreateCustomKeyStoreInput) SetXksProxyConnectivity

func (s *CreateCustomKeyStoreInput) SetXksProxyConnectivity(v string) *CreateCustomKeyStoreInput

SetXksProxyConnectivity sets the XksProxyConnectivity field's value.

func (*CreateCustomKeyStoreInput) SetXksProxyUriEndpoint

func (s *CreateCustomKeyStoreInput) SetXksProxyUriEndpoint(v string) *CreateCustomKeyStoreInput

SetXksProxyUriEndpoint sets the XksProxyUriEndpoint field's value.

func (*CreateCustomKeyStoreInput) SetXksProxyUriPath

func (s *CreateCustomKeyStoreInput) SetXksProxyUriPath(v string) *CreateCustomKeyStoreInput

SetXksProxyUriPath sets the XksProxyUriPath field's value.

func (*CreateCustomKeyStoreInput) SetXksProxyVpcEndpointServiceName

func (s *CreateCustomKeyStoreInput) SetXksProxyVpcEndpointServiceName(v string) *CreateCustomKeyStoreInput

SetXksProxyVpcEndpointServiceName sets the XksProxyVpcEndpointServiceName field's value.

func (CreateCustomKeyStoreInput) String

func (s CreateCustomKeyStoreInput) String() string

String returns the string representation.

API parameter values that are decorated as "sensitive" in the API will not be included in the string output. The member name will be present, but the value will be replaced with "sensitive".

func (*CreateCustomKeyStoreInput) Validate

func (s *CreateCustomKeyStoreInput) Validate() error

Validate inspects the fields of the type to determine if they are valid.

type CreateCustomKeyStoreOutput

type CreateCustomKeyStoreOutput struct {

    // A unique identifier for the new custom key store.
    CustomKeyStoreId *string `min:"1" type:"string"`
    // contains filtered or unexported fields
}

func (CreateCustomKeyStoreOutput) GoString

func (s CreateCustomKeyStoreOutput) GoString() string

GoString returns the string representation.

API parameter values that are decorated as "sensitive" in the API will not be included in the string output. The member name will be present, but the value will be replaced with "sensitive".

func (*CreateCustomKeyStoreOutput) SetCustomKeyStoreId

func (s *CreateCustomKeyStoreOutput) SetCustomKeyStoreId(v string) *CreateCustomKeyStoreOutput

SetCustomKeyStoreId sets the CustomKeyStoreId field's value.

func (CreateCustomKeyStoreOutput) String

func (s CreateCustomKeyStoreOutput) String() string

String returns the string representation.

API parameter values that are decorated as "sensitive" in the API will not be included in the string output. The member name will be present, but the value will be replaced with "sensitive".

type CreateGrantInput

type CreateGrantInput struct {

    // Specifies a grant constraint.
    //
    // Do not include confidential or sensitive information in this field. This
    // field may be displayed in plaintext in CloudTrail logs and other output.
    //
    // KMS supports the EncryptionContextEquals and EncryptionContextSubset grant
    // constraints, which allow the permissions in the grant only when the encryption
    // context in the request matches (EncryptionContextEquals) or includes (EncryptionContextSubset)
    // the encryption context specified in the constraint.
    //
    // The encryption context grant constraints are supported only on grant operations
    // (https://docs.aws.amazon.com/kms/latest/developerguide/grants.html#terms-grant-operations)
    // that include an EncryptionContext parameter, such as cryptographic operations
    // on symmetric encryption KMS keys. Grants with grant constraints can include
    // the DescribeKey and RetireGrant operations, but the constraint doesn't apply
    // to these operations. If a grant with a grant constraint includes the CreateGrant
    // operation, the constraint requires that any grants created with the CreateGrant
    // permission have an equally strict or stricter encryption context constraint.
    //
    // You cannot use an encryption context grant constraint for cryptographic operations
    // with asymmetric KMS keys or HMAC KMS keys. Operations with these keys don't
    // support an encryption context.
    //
    // Each constraint value can include up to 8 encryption context pairs. The encryption
    // context value in each constraint cannot exceed 384 characters. For information
    // about grant constraints, see Using grant constraints (https://docs.aws.amazon.com/kms/latest/developerguide/create-grant-overview.html#grant-constraints)
    // in the Key Management Service Developer Guide. For more information about
    // encryption context, see Encryption context (https://docs.aws.amazon.com/kms/latest/developerguide/concepts.html#encrypt_context)
    // in the Key Management Service Developer Guide .
    Constraints *GrantConstraints `type:"structure"`

    // Checks if your request will succeed. DryRun is an optional parameter.
    //
    // To learn more about how to use this parameter, see Testing your KMS API calls
    // (https://docs.aws.amazon.com/kms/latest/developerguide/programming-dryrun.html)
    // in the Key Management Service Developer Guide.
    DryRun *bool `type:"boolean"`

    // A list of grant tokens.
    //
    // Use a grant token when your permission to call this operation comes from
    // a new grant that has not yet achieved eventual consistency. For more information,
    // see Grant token (https://docs.aws.amazon.com/kms/latest/developerguide/grants.html#grant_token)
    // and Using a grant token (https://docs.aws.amazon.com/kms/latest/developerguide/grant-manage.html#using-grant-token)
    // in the Key Management Service Developer Guide.
    GrantTokens []*string `type:"list"`

    // The identity that gets the permissions specified in the grant.
    //
    // To specify the grantee principal, use the Amazon Resource Name (ARN) of an
    // Amazon Web Services principal. Valid principals include Amazon Web Services
    // accounts, IAM users, IAM roles, federated users, and assumed role users.
    // For help with the ARN syntax for a principal, see IAM ARNs (https://docs.aws.amazon.com/IAM/latest/UserGuide/reference_identifiers.html#identifiers-arns)
    // in the Identity and Access Management User Guide .
    //
    // GranteePrincipal is a required field
    GranteePrincipal *string `min:"1" type:"string" required:"true"`

    // Identifies the KMS key for the grant. The grant gives principals permission
    // to use this KMS key.
    //
    // Specify the key ID or key ARN of the KMS key. To specify a KMS key in a different
    // Amazon Web Services account, you must use the key ARN.
    //
    // For example:
    //
    //    * Key ID: 1234abcd-12ab-34cd-56ef-1234567890ab
    //
    //    * Key ARN: arn:aws:kms:us-east-2:111122223333:key/1234abcd-12ab-34cd-56ef-1234567890ab
    //
    // To get the key ID and key ARN for a KMS key, use ListKeys or DescribeKey.
    //
    // KeyId is a required field
    KeyId *string `min:"1" type:"string" required:"true"`

    // A friendly name for the grant. Use this value to prevent the unintended creation
    // of duplicate grants when retrying this request.
    //
    // Do not include confidential or sensitive information in this field. This
    // field may be displayed in plaintext in CloudTrail logs and other output.
    //
    // When this value is absent, all CreateGrant requests result in a new grant
    // with a unique GrantId even if all the supplied parameters are identical.
    // This can result in unintended duplicates when you retry the CreateGrant request.
    //
    // When this value is present, you can retry a CreateGrant request with identical
    // parameters; if the grant already exists, the original GrantId is returned
    // without creating a new grant. Note that the returned grant token is unique
    // with every CreateGrant request, even when a duplicate GrantId is returned.
    // All grant tokens for the same grant ID can be used interchangeably.
    Name *string `min:"1" type:"string"`

    // A list of operations that the grant permits.
    //
    // This list must include only operations that are permitted in a grant. Also,
    // the operation must be supported on the KMS key. For example, you cannot create
    // a grant for a symmetric encryption KMS key that allows the Sign operation,
    // or a grant for an asymmetric KMS key that allows the GenerateDataKey operation.
    // If you try, KMS returns a ValidationError exception. For details, see Grant
    // operations (https://docs.aws.amazon.com/kms/latest/developerguide/grants.html#terms-grant-operations)
    // in the Key Management Service Developer Guide.
    //
    // Operations is a required field
    Operations []*string `type:"list" required:"true" enum:"GrantOperation"`

    // The principal that has permission to use the RetireGrant operation to retire
    // the grant.
    //
    // To specify the principal, use the Amazon Resource Name (ARN) (https://docs.aws.amazon.com/general/latest/gr/aws-arns-and-namespaces.html)
    // of an Amazon Web Services principal. Valid principals include Amazon Web
    // Services accounts, IAM users, IAM roles, federated users, and assumed role
    // users. For help with the ARN syntax for a principal, see IAM ARNs (https://docs.aws.amazon.com/IAM/latest/UserGuide/reference_identifiers.html#identifiers-arns)
    // in the Identity and Access Management User Guide .
    //
    // The grant determines the retiring principal. Other principals might have
    // permission to retire the grant or revoke the grant. For details, see RevokeGrant
    // and Retiring and revoking grants (https://docs.aws.amazon.com/kms/latest/developerguide/grant-manage.html#grant-delete)
    // in the Key Management Service Developer Guide.
    RetiringPrincipal *string `min:"1" type:"string"`
    // contains filtered or unexported fields
}

func (CreateGrantInput) GoString

func (s CreateGrantInput) GoString() string

GoString returns the string representation.

API parameter values that are decorated as "sensitive" in the API will not be included in the string output. The member name will be present, but the value will be replaced with "sensitive".

func (*CreateGrantInput) SetConstraints

func (s *CreateGrantInput) SetConstraints(v *GrantConstraints) *CreateGrantInput

SetConstraints sets the Constraints field's value.

func (*CreateGrantInput) SetDryRun

func (s *CreateGrantInput) SetDryRun(v bool) *CreateGrantInput

SetDryRun sets the DryRun field's value.

func (*CreateGrantInput) SetGrantTokens

func (s *CreateGrantInput) SetGrantTokens(v []*string) *CreateGrantInput

SetGrantTokens sets the GrantTokens field's value.

func (*CreateGrantInput) SetGranteePrincipal

func (s *CreateGrantInput) SetGranteePrincipal(v string) *CreateGrantInput

SetGranteePrincipal sets the GranteePrincipal field's value.

func (*CreateGrantInput) SetKeyId

func (s *CreateGrantInput) SetKeyId(v string) *CreateGrantInput

SetKeyId sets the KeyId field's value.

func (*CreateGrantInput) SetName

func (s *CreateGrantInput) SetName(v string) *CreateGrantInput

SetName sets the Name field's value.

func (*CreateGrantInput) SetOperations

func (s *CreateGrantInput) SetOperations(v []*string) *CreateGrantInput

SetOperations sets the Operations field's value.

func (*CreateGrantInput) SetRetiringPrincipal

func (s *CreateGrantInput) SetRetiringPrincipal(v string) *CreateGrantInput

SetRetiringPrincipal sets the RetiringPrincipal field's value.

func (CreateGrantInput) String

func (s CreateGrantInput) String() string

String returns the string representation.

API parameter values that are decorated as "sensitive" in the API will not be included in the string output. The member name will be present, but the value will be replaced with "sensitive".

func (*CreateGrantInput) Validate

func (s *CreateGrantInput) Validate() error

Validate inspects the fields of the type to determine if they are valid.

type CreateGrantOutput

type CreateGrantOutput struct {

    // The unique identifier for the grant.
    //
    // You can use the GrantId in a ListGrants, RetireGrant, or RevokeGrant operation.
    GrantId *string `min:"1" type:"string"`

    // The grant token.
    //
    // Use a grant token when your permission to call this operation comes from
    // a new grant that has not yet achieved eventual consistency. For more information,
    // see Grant token (https://docs.aws.amazon.com/kms/latest/developerguide/grants.html#grant_token)
    // and Using a grant token (https://docs.aws.amazon.com/kms/latest/developerguide/grant-manage.html#using-grant-token)
    // in the Key Management Service Developer Guide.
    GrantToken *string `min:"1" type:"string"`
    // contains filtered or unexported fields
}

func (CreateGrantOutput) GoString

func (s CreateGrantOutput) GoString() string

GoString returns the string representation.

API parameter values that are decorated as "sensitive" in the API will not be included in the string output. The member name will be present, but the value will be replaced with "sensitive".

func (*CreateGrantOutput) SetGrantId

func (s *CreateGrantOutput) SetGrantId(v string) *CreateGrantOutput

SetGrantId sets the GrantId field's value.

func (*CreateGrantOutput) SetGrantToken

func (s *CreateGrantOutput) SetGrantToken(v string) *CreateGrantOutput

SetGrantToken sets the GrantToken field's value.

func (CreateGrantOutput) String

func (s CreateGrantOutput) String() string

String returns the string representation.

API parameter values that are decorated as "sensitive" in the API will not be included in the string output. The member name will be present, but the value will be replaced with "sensitive".

type CreateKeyInput

type CreateKeyInput struct {

    // Skips ("bypasses") the key policy lockout safety check. The default value
    // is false.
    //
    // Setting this value to true increases the risk that the KMS key becomes unmanageable.
    // Do not set this value to true indiscriminately.
    //
    // For more information, see Default key policy (https://docs.aws.amazon.com/kms/latest/developerguide/key-policy-default.html#prevent-unmanageable-key)
    // in the Key Management Service Developer Guide.
    //
    // Use this parameter only when you intend to prevent the principal that is
    // making the request from making a subsequent PutKeyPolicy (https://docs.aws.amazon.com/kms/latest/APIReference/API_PutKeyPolicy.html)
    // request on the KMS key.
    BypassPolicyLockoutSafetyCheck *bool `type:"boolean"`

    // Creates the KMS key in the specified custom key store (https://docs.aws.amazon.com/kms/latest/developerguide/custom-key-store-overview.html).
    // The ConnectionState of the custom key store must be CONNECTED. To find the
    // CustomKeyStoreID and ConnectionState use the DescribeCustomKeyStores operation.
    //
    // This parameter is valid only for symmetric encryption KMS keys in a single
    // Region. You cannot create any other type of KMS key in a custom key store.
    //
    // When you create a KMS key in an CloudHSM key store, KMS generates a non-exportable
    // 256-bit symmetric key in its associated CloudHSM cluster and associates it
    // with the KMS key. When you create a KMS key in an external key store, you
    // must use the XksKeyId parameter to specify an external key that serves as
    // key material for the KMS key.
    CustomKeyStoreId *string `min:"1" type:"string"`

    // Instead, use the KeySpec parameter.
    //
    // The KeySpec and CustomerMasterKeySpec parameters work the same way. Only
    // the names differ. We recommend that you use KeySpec parameter in your code.
    // However, to avoid breaking changes, KMS supports both parameters.
    //
    // Deprecated: This parameter has been deprecated. Instead, use the KeySpec parameter.
    CustomerMasterKeySpec *string `deprecated:"true" type:"string" enum:"CustomerMasterKeySpec"`

    // A description of the KMS key. Use a description that helps you decide whether
    // the KMS key is appropriate for a task. The default value is an empty string
    // (no description).
    //
    // Do not include confidential or sensitive information in this field. This
    // field may be displayed in plaintext in CloudTrail logs and other output.
    //
    // To set or change the description after the key is created, use UpdateKeyDescription.
    Description *string `type:"string"`

    // Specifies the type of KMS key to create. The default value, SYMMETRIC_DEFAULT,
    // creates a KMS key with a 256-bit AES-GCM key that is used for encryption
    // and decryption, except in China Regions, where it creates a 128-bit symmetric
    // key that uses SM4 encryption. For help choosing a key spec for your KMS key,
    // see Choosing a KMS key type (https://docs.aws.amazon.com/kms/latest/developerguide/key-types.html#symm-asymm-choose)
    // in the Key Management Service Developer Guide .
    //
    // The KeySpec determines whether the KMS key contains a symmetric key or an
    // asymmetric key pair. It also determines the algorithms that the KMS key supports.
    // You can't change the KeySpec after the KMS key is created. To further restrict
    // the algorithms that can be used with the KMS key, use a condition key in
    // its key policy or IAM policy. For more information, see kms:EncryptionAlgorithm
    // (https://docs.aws.amazon.com/kms/latest/developerguide/policy-conditions.html#conditions-kms-encryption-algorithm),
    // kms:MacAlgorithm (https://docs.aws.amazon.com/kms/latest/developerguide/policy-conditions.html#conditions-kms-mac-algorithm)
    // or kms:Signing Algorithm (https://docs.aws.amazon.com/kms/latest/developerguide/policy-conditions.html#conditions-kms-signing-algorithm)
    // in the Key Management Service Developer Guide .
    //
    // Amazon Web Services services that are integrated with KMS (http://aws.amazon.com/kms/features/#AWS_Service_Integration)
    // use symmetric encryption KMS keys to protect your data. These services do
    // not support asymmetric KMS keys or HMAC KMS keys.
    //
    // KMS supports the following key specs for KMS keys:
    //
    //    * Symmetric encryption key (default) SYMMETRIC_DEFAULT
    //
    //    * HMAC keys (symmetric) HMAC_224 HMAC_256 HMAC_384 HMAC_512
    //
    //    * Asymmetric RSA key pairs (encryption and decryption -or- signing and
    //    verification) RSA_2048 RSA_3072 RSA_4096
    //
    //    * Asymmetric NIST-recommended elliptic curve key pairs (signing and verification
    //    -or- deriving shared secrets) ECC_NIST_P256 (secp256r1) ECC_NIST_P384
    //    (secp384r1) ECC_NIST_P521 (secp521r1)
    //
    //    * Other asymmetric elliptic curve key pairs (signing and verification)
    //    ECC_SECG_P256K1 (secp256k1), commonly used for cryptocurrencies.
    //
    //    * SM2 key pairs (encryption and decryption -or- signing and verification
    //    -or- deriving shared secrets) SM2 (China Regions only)
    KeySpec *string `type:"string" enum:"KeySpec"`

    // Determines the cryptographic operations (https://docs.aws.amazon.com/kms/latest/developerguide/concepts.html#cryptographic-operations)
    // for which you can use the KMS key. The default value is ENCRYPT_DECRYPT.
    // This parameter is optional when you are creating a symmetric encryption KMS
    // key; otherwise, it is required. You can't change the KeyUsage value after
    // the KMS key is created.
    //
    // Select only one valid value.
    //
    //    * For symmetric encryption KMS keys, omit the parameter or specify ENCRYPT_DECRYPT.
    //
    //    * For HMAC KMS keys (symmetric), specify GENERATE_VERIFY_MAC.
    //
    //    * For asymmetric KMS keys with RSA key pairs, specify ENCRYPT_DECRYPT
    //    or SIGN_VERIFY.
    //
    //    * For asymmetric KMS keys with NIST-recommended elliptic curve key pairs,
    //    specify SIGN_VERIFY or KEY_AGREEMENT.
    //
    //    * For asymmetric KMS keys with ECC_SECG_P256K1 key pairs specify SIGN_VERIFY.
    //
    //    * For asymmetric KMS keys with SM2 key pairs (China Regions only), specify
    //    ENCRYPT_DECRYPT, SIGN_VERIFY, or KEY_AGREEMENT.
    KeyUsage *string `type:"string" enum:"KeyUsageType"`

    // Creates a multi-Region primary key that you can replicate into other Amazon
    // Web Services Regions. You cannot change this value after you create the KMS
    // key.
    //
    // For a multi-Region key, set this parameter to True. For a single-Region KMS
    // key, omit this parameter or set it to False. The default value is False.
    //
    // This operation supports multi-Region keys, an KMS feature that lets you create
    // multiple interoperable KMS keys in different Amazon Web Services Regions.
    // Because these KMS keys have the same key ID, key material, and other metadata,
    // you can use them interchangeably to encrypt data in one Amazon Web Services
    // Region and decrypt it in a different Amazon Web Services Region without re-encrypting
    // the data or making a cross-Region call. For more information about multi-Region
    // keys, see Multi-Region keys in KMS (https://docs.aws.amazon.com/kms/latest/developerguide/multi-region-keys-overview.html)
    // in the Key Management Service Developer Guide.
    //
    // This value creates a primary key, not a replica. To create a replica key,
    // use the ReplicateKey operation.
    //
    // You can create a symmetric or asymmetric multi-Region key, and you can create
    // a multi-Region key with imported key material. However, you cannot create
    // a multi-Region key in a custom key store.
    MultiRegion *bool `type:"boolean"`

    // The source of the key material for the KMS key. You cannot change the origin
    // after you create the KMS key. The default is AWS_KMS, which means that KMS
    // creates the key material.
    //
    // To create a KMS key with no key material (https://docs.aws.amazon.com/kms/latest/developerguide/importing-keys-create-cmk.html)
    // (for imported key material), set this value to EXTERNAL. For more information
    // about importing key material into KMS, see Importing Key Material (https://docs.aws.amazon.com/kms/latest/developerguide/importing-keys.html)
    // in the Key Management Service Developer Guide. The EXTERNAL origin value
    // is valid only for symmetric KMS keys.
    //
    // To create a KMS key in an CloudHSM key store (https://docs.aws.amazon.com/kms/latest/developerguide/create-cmk-keystore.html)
    // and create its key material in the associated CloudHSM cluster, set this
    // value to AWS_CLOUDHSM. You must also use the CustomKeyStoreId parameter to
    // identify the CloudHSM key store. The KeySpec value must be SYMMETRIC_DEFAULT.
    //
    // To create a KMS key in an external key store (https://docs.aws.amazon.com/kms/latest/developerguide/create-xks-keys.html),
    // set this value to EXTERNAL_KEY_STORE. You must also use the CustomKeyStoreId
    // parameter to identify the external key store and the XksKeyId parameter to
    // identify the associated external key. The KeySpec value must be SYMMETRIC_DEFAULT.
    Origin *string `type:"string" enum:"OriginType"`

    // The key policy to attach to the KMS key.
    //
    // If you provide a key policy, it must meet the following criteria:
    //
    //    * The key policy must allow the calling principal to make a subsequent
    //    PutKeyPolicy request on the KMS key. This reduces the risk that the KMS
    //    key becomes unmanageable. For more information, see Default key policy
    //    (https://docs.aws.amazon.com/kms/latest/developerguide/key-policy-default.html#prevent-unmanageable-key)
    //    in the Key Management Service Developer Guide. (To omit this condition,
    //    set BypassPolicyLockoutSafetyCheck to true.)
    //
    //    * Each statement in the key policy must contain one or more principals.
    //    The principals in the key policy must exist and be visible to KMS. When
    //    you create a new Amazon Web Services principal, you might need to enforce
    //    a delay before including the new principal in a key policy because the
    //    new principal might not be immediately visible to KMS. For more information,
    //    see Changes that I make are not always immediately visible (https://docs.aws.amazon.com/IAM/latest/UserGuide/troubleshoot_general.html#troubleshoot_general_eventual-consistency)
    //    in the Amazon Web Services Identity and Access Management User Guide.
    //
    // If you do not provide a key policy, KMS attaches a default key policy to
    // the KMS key. For more information, see Default key policy (https://docs.aws.amazon.com/kms/latest/developerguide/key-policies.html#key-policy-default)
    // in the Key Management Service Developer Guide.
    //
    // The key policy size quota is 32 kilobytes (32768 bytes).
    //
    // For help writing and formatting a JSON policy document, see the IAM JSON
    // Policy Reference (https://docs.aws.amazon.com/IAM/latest/UserGuide/reference_policies.html)
    // in the Identity and Access Management User Guide .
    Policy *string `min:"1" type:"string"`

    // Assigns one or more tags to the KMS key. Use this parameter to tag the KMS
    // key when it is created. To tag an existing KMS key, use the TagResource operation.
    //
    // Do not include confidential or sensitive information in this field. This
    // field may be displayed in plaintext in CloudTrail logs and other output.
    //
    // Tagging or untagging a KMS key can allow or deny permission to the KMS key.
    // For details, see ABAC for KMS (https://docs.aws.amazon.com/kms/latest/developerguide/abac.html)
    // in the Key Management Service Developer Guide.
    //
    // To use this parameter, you must have kms:TagResource (https://docs.aws.amazon.com/kms/latest/developerguide/kms-api-permissions-reference.html)
    // permission in an IAM policy.
    //
    // Each tag consists of a tag key and a tag value. Both the tag key and the
    // tag value are required, but the tag value can be an empty (null) string.
    // You cannot have more than one tag on a KMS key with the same tag key. If
    // you specify an existing tag key with a different tag value, KMS replaces
    // the current tag value with the specified one.
    //
    // When you add tags to an Amazon Web Services resource, Amazon Web Services
    // generates a cost allocation report with usage and costs aggregated by tags.
    // Tags can also be used to control access to a KMS key. For details, see Tagging
    // Keys (https://docs.aws.amazon.com/kms/latest/developerguide/tagging-keys.html).
    Tags []*Tag `type:"list"`

    // Identifies the external key (https://docs.aws.amazon.com/kms/latest/developerguide/keystore-external.html#concept-external-key)
    // that serves as key material for the KMS key in an external key store (https://docs.aws.amazon.com/kms/latest/developerguide/keystore-external.html).
    // Specify the ID that the external key store proxy (https://docs.aws.amazon.com/kms/latest/developerguide/keystore-external.html#concept-xks-proxy)
    // uses to refer to the external key. For help, see the documentation for your
    // external key store proxy.
    //
    // This parameter is required for a KMS key with an Origin value of EXTERNAL_KEY_STORE.
    // It is not valid for KMS keys with any other Origin value.
    //
    // The external key must be an existing 256-bit AES symmetric encryption key
    // hosted outside of Amazon Web Services in an external key manager associated
    // with the external key store specified by the CustomKeyStoreId parameter.
    // This key must be enabled and configured to perform encryption and decryption.
    // Each KMS key in an external key store must use a different external key.
    // For details, see Requirements for a KMS key in an external key store (https://docs.aws.amazon.com/create-xks-keys.html#xks-key-requirements)
    // in the Key Management Service Developer Guide.
    //
    // Each KMS key in an external key store is associated two backing keys. One
    // is key material that KMS generates. The other is the external key specified
    // by this parameter. When you use the KMS key in an external key store to encrypt
    // data, the encryption operation is performed first by KMS using the KMS key
    // material, and then by the external key manager using the specified external
    // key, a process known as double encryption. For details, see Double encryption
    // (https://docs.aws.amazon.com/kms/latest/developerguide/keystore-external.html#concept-double-encryption)
    // in the Key Management Service Developer Guide.
    XksKeyId *string `min:"1" type:"string"`
    // contains filtered or unexported fields
}

func (CreateKeyInput) GoString

func (s CreateKeyInput) GoString() string

GoString returns the string representation.

API parameter values that are decorated as "sensitive" in the API will not be included in the string output. The member name will be present, but the value will be replaced with "sensitive".

func (*CreateKeyInput) SetBypassPolicyLockoutSafetyCheck

func (s *CreateKeyInput) SetBypassPolicyLockoutSafetyCheck(v bool) *CreateKeyInput

SetBypassPolicyLockoutSafetyCheck sets the BypassPolicyLockoutSafetyCheck field's value.

func (*CreateKeyInput) SetCustomKeyStoreId

func (s *CreateKeyInput) SetCustomKeyStoreId(v string) *CreateKeyInput

SetCustomKeyStoreId sets the CustomKeyStoreId field's value.

func (*CreateKeyInput) SetCustomerMasterKeySpec

func (s *CreateKeyInput) SetCustomerMasterKeySpec(v string) *CreateKeyInput

SetCustomerMasterKeySpec sets the CustomerMasterKeySpec field's value.

func (*CreateKeyInput) SetDescription

func (s *CreateKeyInput) SetDescription(v string) *CreateKeyInput

SetDescription sets the Description field's value.

func (*CreateKeyInput) SetKeySpec

func (s *CreateKeyInput) SetKeySpec(v string) *CreateKeyInput

SetKeySpec sets the KeySpec field's value.

func (*CreateKeyInput) SetKeyUsage

func (s *CreateKeyInput) SetKeyUsage(v string) *CreateKeyInput

SetKeyUsage sets the KeyUsage field's value.

func (*CreateKeyInput) SetMultiRegion

func (s *CreateKeyInput) SetMultiRegion(v bool) *CreateKeyInput

SetMultiRegion sets the MultiRegion field's value.

func (*CreateKeyInput) SetOrigin

func (s *CreateKeyInput) SetOrigin(v string) *CreateKeyInput

SetOrigin sets the Origin field's value.

func (*CreateKeyInput) SetPolicy

func (s *CreateKeyInput) SetPolicy(v string) *CreateKeyInput

SetPolicy sets the Policy field's value.

func (*CreateKeyInput) SetTags

func (s *CreateKeyInput) SetTags(v []*Tag) *CreateKeyInput

SetTags sets the Tags field's value.

func (*CreateKeyInput) SetXksKeyId

func (s *CreateKeyInput) SetXksKeyId(v string) *CreateKeyInput

SetXksKeyId sets the XksKeyId field's value.

func (CreateKeyInput) String

func (s CreateKeyInput) String() string

String returns the string representation.

API parameter values that are decorated as "sensitive" in the API will not be included in the string output. The member name will be present, but the value will be replaced with "sensitive".

func (*CreateKeyInput) Validate

func (s *CreateKeyInput) Validate() error

Validate inspects the fields of the type to determine if they are valid.

type CreateKeyOutput

type CreateKeyOutput struct {

    // Metadata associated with the KMS key.
    KeyMetadata *KeyMetadata `type:"structure"`
    // contains filtered or unexported fields
}

func (CreateKeyOutput) GoString

func (s CreateKeyOutput) GoString() string

GoString returns the string representation.

API parameter values that are decorated as "sensitive" in the API will not be included in the string output. The member name will be present, but the value will be replaced with "sensitive".

func (*CreateKeyOutput) SetKeyMetadata

func (s *CreateKeyOutput) SetKeyMetadata(v *KeyMetadata) *CreateKeyOutput

SetKeyMetadata sets the KeyMetadata field's value.

func (CreateKeyOutput) String

func (s CreateKeyOutput) String() string

String returns the string representation.

API parameter values that are decorated as "sensitive" in the API will not be included in the string output. The member name will be present, but the value will be replaced with "sensitive".

type CustomKeyStoreHasCMKsException

type CustomKeyStoreHasCMKsException struct {
    RespMetadata protocol.ResponseMetadata `json:"-" xml:"-"`

    Message_ *string `locationName:"message" type:"string"`
    // contains filtered or unexported fields
}

The request was rejected because the custom key store contains KMS keys. After verifying that you do not need to use the KMS keys, use the ScheduleKeyDeletion operation to delete the KMS keys. After they are deleted, you can delete the custom key store.

func (*CustomKeyStoreHasCMKsException) Code

func (s *CustomKeyStoreHasCMKsException) Code() string

Code returns the exception type name.

func (*CustomKeyStoreHasCMKsException) Error

func (s *CustomKeyStoreHasCMKsException) Error() string

func (CustomKeyStoreHasCMKsException) GoString

func (s CustomKeyStoreHasCMKsException) GoString() string

GoString returns the string representation.

API parameter values that are decorated as "sensitive" in the API will not be included in the string output. The member name will be present, but the value will be replaced with "sensitive".

func (*CustomKeyStoreHasCMKsException) Message

func (s *CustomKeyStoreHasCMKsException) Message() string

Message returns the exception's message.

func (*CustomKeyStoreHasCMKsException) OrigErr

func (s *CustomKeyStoreHasCMKsException) OrigErr() error

OrigErr always returns nil, satisfies awserr.Error interface.

func (*CustomKeyStoreHasCMKsException) RequestID

func (s *CustomKeyStoreHasCMKsException) RequestID() string

RequestID returns the service's response RequestID for request.

func (*CustomKeyStoreHasCMKsException) StatusCode

func (s *CustomKeyStoreHasCMKsException) StatusCode() int

Status code returns the HTTP status code for the request's response error.

func (CustomKeyStoreHasCMKsException) String

func (s CustomKeyStoreHasCMKsException) String() string

String returns the string representation.

API parameter values that are decorated as "sensitive" in the API will not be included in the string output. The member name will be present, but the value will be replaced with "sensitive".

type CustomKeyStoreInvalidStateException

type CustomKeyStoreInvalidStateException struct {
    RespMetadata protocol.ResponseMetadata `json:"-" xml:"-"`

    Message_ *string `locationName:"message" type:"string"`
    // contains filtered or unexported fields
}

The request was rejected because of the ConnectionState of the custom key store. To get the ConnectionState of a custom key store, use the DescribeCustomKeyStores operation.

This exception is thrown under the following conditions:

  • You requested the ConnectCustomKeyStore operation on a custom key store with a ConnectionState of DISCONNECTING or FAILED. This operation is valid for all other ConnectionState values. To reconnect a custom key store in a FAILED state, disconnect it (DisconnectCustomKeyStore), then connect it (ConnectCustomKeyStore).

  • You requested the CreateKey operation in a custom key store that is not connected. This operations is valid only when the custom key store ConnectionState is CONNECTED.

  • You requested the DisconnectCustomKeyStore operation on a custom key store with a ConnectionState of DISCONNECTING or DISCONNECTED. This operation is valid for all other ConnectionState values.

  • You requested the UpdateCustomKeyStore or DeleteCustomKeyStore operation on a custom key store that is not disconnected. This operation is valid only when the custom key store ConnectionState is DISCONNECTED.

  • You requested the GenerateRandom operation in an CloudHSM key store that is not connected. This operation is valid only when the CloudHSM key store ConnectionState is CONNECTED.

func (*CustomKeyStoreInvalidStateException) Code

func (s *CustomKeyStoreInvalidStateException) Code() string

Code returns the exception type name.

func (*CustomKeyStoreInvalidStateException) Error

func (s *CustomKeyStoreInvalidStateException) Error() string

func (CustomKeyStoreInvalidStateException) GoString

func (s CustomKeyStoreInvalidStateException) GoString() string

GoString returns the string representation.

API parameter values that are decorated as "sensitive" in the API will not be included in the string output. The member name will be present, but the value will be replaced with "sensitive".

func (*CustomKeyStoreInvalidStateException) Message

func (s *CustomKeyStoreInvalidStateException) Message() string

Message returns the exception's message.

func (*CustomKeyStoreInvalidStateException) OrigErr

func (s *CustomKeyStoreInvalidStateException) OrigErr() error

OrigErr always returns nil, satisfies awserr.Error interface.

func (*CustomKeyStoreInvalidStateException) RequestID

func (s *CustomKeyStoreInvalidStateException) RequestID() string

RequestID returns the service's response RequestID for request.

func (*CustomKeyStoreInvalidStateException) StatusCode

func (s *CustomKeyStoreInvalidStateException) StatusCode() int

Status code returns the HTTP status code for the request's response error.

func (CustomKeyStoreInvalidStateException) String

func (s CustomKeyStoreInvalidStateException) String() string

String returns the string representation.

API parameter values that are decorated as "sensitive" in the API will not be included in the string output. The member name will be present, but the value will be replaced with "sensitive".

type CustomKeyStoreNameInUseException

type CustomKeyStoreNameInUseException struct {
    RespMetadata protocol.ResponseMetadata `json:"-" xml:"-"`

    Message_ *string `locationName:"message" type:"string"`
    // contains filtered or unexported fields
}

The request was rejected because the specified custom key store name is already assigned to another custom key store in the account. Try again with a custom key store name that is unique in the account.

func (*CustomKeyStoreNameInUseException) Code

func (s *CustomKeyStoreNameInUseException) Code() string

Code returns the exception type name.

func (*CustomKeyStoreNameInUseException) Error

func (s *CustomKeyStoreNameInUseException) Error() string

func (CustomKeyStoreNameInUseException) GoString

func (s CustomKeyStoreNameInUseException) GoString() string

GoString returns the string representation.

API parameter values that are decorated as "sensitive" in the API will not be included in the string output. The member name will be present, but the value will be replaced with "sensitive".

func (*CustomKeyStoreNameInUseException) Message

func (s *CustomKeyStoreNameInUseException) Message() string

Message returns the exception's message.

func (*CustomKeyStoreNameInUseException) OrigErr

func (s *CustomKeyStoreNameInUseException) OrigErr() error

OrigErr always returns nil, satisfies awserr.Error interface.

func (*CustomKeyStoreNameInUseException) RequestID

func (s *CustomKeyStoreNameInUseException) RequestID() string

RequestID returns the service's response RequestID for request.

func (*CustomKeyStoreNameInUseException) StatusCode

func (s *CustomKeyStoreNameInUseException) StatusCode() int

Status code returns the HTTP status code for the request's response error.

func (CustomKeyStoreNameInUseException) String

func (s CustomKeyStoreNameInUseException) String() string

String returns the string representation.

API parameter values that are decorated as "sensitive" in the API will not be included in the string output. The member name will be present, but the value will be replaced with "sensitive".

type CustomKeyStoreNotFoundException

type CustomKeyStoreNotFoundException struct {
    RespMetadata protocol.ResponseMetadata `json:"-" xml:"-"`

    Message_ *string `locationName:"message" type:"string"`
    // contains filtered or unexported fields
}

The request was rejected because KMS cannot find a custom key store with the specified key store name or ID.

func (*CustomKeyStoreNotFoundException) Code

func (s *CustomKeyStoreNotFoundException) Code() string

Code returns the exception type name.

func (*CustomKeyStoreNotFoundException) Error

func (s *CustomKeyStoreNotFoundException) Error() string

func (CustomKeyStoreNotFoundException) GoString

func (s CustomKeyStoreNotFoundException) GoString() string

GoString returns the string representation.

API parameter values that are decorated as "sensitive" in the API will not be included in the string output. The member name will be present, but the value will be replaced with "sensitive".

func (*CustomKeyStoreNotFoundException) Message

func (s *CustomKeyStoreNotFoundException) Message() string

Message returns the exception's message.

func (*CustomKeyStoreNotFoundException) OrigErr

func (s *CustomKeyStoreNotFoundException) OrigErr() error

OrigErr always returns nil, satisfies awserr.Error interface.

func (*CustomKeyStoreNotFoundException) RequestID

func (s *CustomKeyStoreNotFoundException) RequestID() string

RequestID returns the service's response RequestID for request.

func (*CustomKeyStoreNotFoundException) StatusCode

func (s *CustomKeyStoreNotFoundException) StatusCode() int

Status code returns the HTTP status code for the request's response error.

func (CustomKeyStoreNotFoundException) String

func (s CustomKeyStoreNotFoundException) String() string

String returns the string representation.

API parameter values that are decorated as "sensitive" in the API will not be included in the string output. The member name will be present, but the value will be replaced with "sensitive".

type CustomKeyStoresListEntry

type CustomKeyStoresListEntry struct {

    // A unique identifier for the CloudHSM cluster that is associated with an CloudHSM
    // key store. This field appears only when the CustomKeyStoreType is AWS_CLOUDHSM.
    CloudHsmClusterId *string `min:"19" type:"string"`

    // Describes the connection error. This field appears in the response only when
    // the ConnectionState is FAILED.
    //
    // Many failures can be resolved by updating the properties of the custom key
    // store. To update a custom key store, disconnect it (DisconnectCustomKeyStore),
    // correct the errors (UpdateCustomKeyStore), and try to connect again (ConnectCustomKeyStore).
    // For additional help resolving these errors, see How to Fix a Connection Failure
    // (https://docs.aws.amazon.com/kms/latest/developerguide/fix-keystore.html#fix-keystore-failed)
    // in Key Management Service Developer Guide.
    //
    // All custom key stores:
    //
    //    * INTERNAL_ERROR — KMS could not complete the request due to an internal
    //    error. Retry the request. For ConnectCustomKeyStore requests, disconnect
    //    the custom key store before trying to connect again.
    //
    //    * NETWORK_ERRORS — Network errors are preventing KMS from connecting
    //    the custom key store to its backing key store.
    //
    // CloudHSM key stores:
    //
    //    * CLUSTER_NOT_FOUND — KMS cannot find the CloudHSM cluster with the
    //    specified cluster ID.
    //
    //    * INSUFFICIENT_CLOUDHSM_HSMS — The associated CloudHSM cluster does
    //    not contain any active HSMs. To connect a custom key store to its CloudHSM
    //    cluster, the cluster must contain at least one active HSM.
    //
    //    * INSUFFICIENT_FREE_ADDRESSES_IN_SUBNET — At least one private subnet
    //    associated with the CloudHSM cluster doesn't have any available IP addresses.
    //    A CloudHSM key store connection requires one free IP address in each of
    //    the associated private subnets, although two are preferable. For details,
    //    see How to Fix a Connection Failure (https://docs.aws.amazon.com/kms/latest/developerguide/fix-keystore.html#fix-keystore-failed)
    //    in the Key Management Service Developer Guide.
    //
    //    * INVALID_CREDENTIALS — The KeyStorePassword for the custom key store
    //    doesn't match the current password of the kmsuser crypto user in the CloudHSM
    //    cluster. Before you can connect your custom key store to its CloudHSM
    //    cluster, you must change the kmsuser account password and update the KeyStorePassword
    //    value for the custom key store.
    //
    //    * SUBNET_NOT_FOUND — A subnet in the CloudHSM cluster configuration
    //    was deleted. If KMS cannot find all of the subnets in the cluster configuration,
    //    attempts to connect the custom key store to the CloudHSM cluster fail.
    //    To fix this error, create a cluster from a recent backup and associate
    //    it with your custom key store. (This process creates a new cluster configuration
    //    with a VPC and private subnets.) For details, see How to Fix a Connection
    //    Failure (https://docs.aws.amazon.com/kms/latest/developerguide/fix-keystore.html#fix-keystore-failed)
    //    in the Key Management Service Developer Guide.
    //
    //    * USER_LOCKED_OUT — The kmsuser CU account is locked out of the associated
    //    CloudHSM cluster due to too many failed password attempts. Before you
    //    can connect your custom key store to its CloudHSM cluster, you must change
    //    the kmsuser account password and update the key store password value for
    //    the custom key store.
    //
    //    * USER_LOGGED_IN — The kmsuser CU account is logged into the associated
    //    CloudHSM cluster. This prevents KMS from rotating the kmsuser account
    //    password and logging into the cluster. Before you can connect your custom
    //    key store to its CloudHSM cluster, you must log the kmsuser CU out of
    //    the cluster. If you changed the kmsuser password to log into the cluster,
    //    you must also and update the key store password value for the custom key
    //    store. For help, see How to Log Out and Reconnect (https://docs.aws.amazon.com/kms/latest/developerguide/fix-keystore.html#login-kmsuser-2)
    //    in the Key Management Service Developer Guide.
    //
    //    * USER_NOT_FOUND — KMS cannot find a kmsuser CU account in the associated
    //    CloudHSM cluster. Before you can connect your custom key store to its
    //    CloudHSM cluster, you must create a kmsuser CU account in the cluster,
    //    and then update the key store password value for the custom key store.
    //
    // External key stores:
    //
    //    * INVALID_CREDENTIALS — One or both of the XksProxyAuthenticationCredential
    //    values is not valid on the specified external key store proxy.
    //
    //    * XKS_PROXY_ACCESS_DENIED — KMS requests are denied access to the external
    //    key store proxy. If the external key store proxy has authorization rules,
    //    verify that they permit KMS to communicate with the proxy on your behalf.
    //
    //    * XKS_PROXY_INVALID_CONFIGURATION — A configuration error is preventing
    //    the external key store from connecting to its proxy. Verify the value
    //    of the XksProxyUriPath.
    //
    //    * XKS_PROXY_INVALID_RESPONSE — KMS cannot interpret the response from
    //    the external key store proxy. If you see this connection error code repeatedly,
    //    notify your external key store proxy vendor.
    //
    //    * XKS_PROXY_INVALID_TLS_CONFIGURATION — KMS cannot connect to the external
    //    key store proxy because the TLS configuration is invalid. Verify that
    //    the XKS proxy supports TLS 1.2 or 1.3. Also, verify that the TLS certificate
    //    is not expired, and that it matches the hostname in the XksProxyUriEndpoint
    //    value, and that it is signed by a certificate authority included in the
    //    Trusted Certificate Authorities (https://github.com/aws/aws-kms-xksproxy-api-spec/blob/main/TrustedCertificateAuthorities)
    //    list.
    //
    //    * XKS_PROXY_NOT_REACHABLE — KMS can't communicate with your external
    //    key store proxy. Verify that the XksProxyUriEndpoint and XksProxyUriPath
    //    are correct. Use the tools for your external key store proxy to verify
    //    that the proxy is active and available on its network. Also, verify that
    //    your external key manager instances are operating properly. Connection
    //    attempts fail with this connection error code if the proxy reports that
    //    all external key manager instances are unavailable.
    //
    //    * XKS_PROXY_TIMED_OUT — KMS can connect to the external key store proxy,
    //    but the proxy does not respond to KMS in the time allotted. If you see
    //    this connection error code repeatedly, notify your external key store
    //    proxy vendor.
    //
    //    * XKS_VPC_ENDPOINT_SERVICE_INVALID_CONFIGURATION — The Amazon VPC endpoint
    //    service configuration doesn't conform to the requirements for an KMS external
    //    key store. The VPC endpoint service must be an endpoint service for interface
    //    endpoints in the caller's Amazon Web Services account. It must have a
    //    network load balancer (NLB) connected to at least two subnets, each in
    //    a different Availability Zone. The Allow principals list must include
    //    the KMS service principal for the Region, cks.kms.<region>.amazonaws.com,
    //    such as cks.kms.us-east-1.amazonaws.com. It must not require acceptance
    //    (https://docs.aws.amazon.com/vpc/latest/privatelink/create-endpoint-service.html)
    //    of connection requests. It must have a private DNS name. The private DNS
    //    name for an external key store with VPC_ENDPOINT_SERVICE connectivity
    //    must be unique in its Amazon Web Services Region. The domain of the private
    //    DNS name must have a verification status (https://docs.aws.amazon.com/vpc/latest/privatelink/verify-domains.html)
    //    of verified. The TLS certificate (https://docs.aws.amazon.com/elasticloadbalancing/latest/network/create-tls-listener.html)
    //    specifies the private DNS hostname at which the endpoint is reachable.
    //
    //    * XKS_VPC_ENDPOINT_SERVICE_NOT_FOUND — KMS can't find the VPC endpoint
    //    service that it uses to communicate with the external key store proxy.
    //    Verify that the XksProxyVpcEndpointServiceName is correct and the KMS
    //    service principal has service consumer permissions on the Amazon VPC endpoint
    //    service.
    ConnectionErrorCode *string `type:"string" enum:"ConnectionErrorCodeType"`

    // Indicates whether the custom key store is connected to its backing key store.
    // For an CloudHSM key store, the ConnectionState indicates whether it is connected
    // to its CloudHSM cluster. For an external key store, the ConnectionState indicates
    // whether it is connected to the external key store proxy that communicates
    // with your external key manager.
    //
    // You can create and use KMS keys in your custom key stores only when its ConnectionState
    // is CONNECTED.
    //
    // The ConnectionState value is DISCONNECTED only if the key store has never
    // been connected or you use the DisconnectCustomKeyStore operation to disconnect
    // it. If the value is CONNECTED but you are having trouble using the custom
    // key store, make sure that the backing key store is reachable and active.
    // For an CloudHSM key store, verify that its associated CloudHSM cluster is
    // active and contains at least one active HSM. For an external key store, verify
    // that the external key store proxy and external key manager are connected
    // and enabled.
    //
    // A value of FAILED indicates that an attempt to connect was unsuccessful.
    // The ConnectionErrorCode field in the response indicates the cause of the
    // failure. For help resolving a connection failure, see Troubleshooting a custom
    // key store (https://docs.aws.amazon.com/kms/latest/developerguide/fix-keystore.html)
    // in the Key Management Service Developer Guide.
    ConnectionState *string `type:"string" enum:"ConnectionStateType"`

    // The date and time when the custom key store was created.
    CreationDate *time.Time `type:"timestamp"`

    // A unique identifier for the custom key store.
    CustomKeyStoreId *string `min:"1" type:"string"`

    // The user-specified friendly name for the custom key store.
    CustomKeyStoreName *string `min:"1" type:"string"`

    // Indicates the type of the custom key store. AWS_CLOUDHSM indicates a custom
    // key store backed by an CloudHSM cluster. EXTERNAL_KEY_STORE indicates a custom
    // key store backed by an external key store proxy and external key manager
    // outside of Amazon Web Services.
    CustomKeyStoreType *string `type:"string" enum:"CustomKeyStoreType"`

    // The trust anchor certificate of the CloudHSM cluster associated with an CloudHSM
    // key store. When you initialize the cluster (https://docs.aws.amazon.com/cloudhsm/latest/userguide/initialize-cluster.html#sign-csr),
    // you create this certificate and save it in the customerCA.crt file.
    //
    // This field appears only when the CustomKeyStoreType is AWS_CLOUDHSM.
    TrustAnchorCertificate *string `min:"1" type:"string"`

    // Configuration settings for the external key store proxy (XKS proxy). The
    // external key store proxy translates KMS requests into a format that your
    // external key manager can understand. The proxy configuration includes connection
    // information that KMS requires.
    //
    // This field appears only when the CustomKeyStoreType is EXTERNAL_KEY_STORE.
    XksProxyConfiguration *XksProxyConfigurationType `type:"structure"`
    // contains filtered or unexported fields
}

Contains information about each custom key store in the custom key store list.

func (CustomKeyStoresListEntry) GoString

func (s CustomKeyStoresListEntry) GoString() string

GoString returns the string representation.

API parameter values that are decorated as "sensitive" in the API will not be included in the string output. The member name will be present, but the value will be replaced with "sensitive".

func (*CustomKeyStoresListEntry) SetCloudHsmClusterId

func (s *CustomKeyStoresListEntry) SetCloudHsmClusterId(v string) *CustomKeyStoresListEntry

SetCloudHsmClusterId sets the CloudHsmClusterId field's value.

func (*CustomKeyStoresListEntry) SetConnectionErrorCode

func (s *CustomKeyStoresListEntry) SetConnectionErrorCode(v string) *CustomKeyStoresListEntry

SetConnectionErrorCode sets the ConnectionErrorCode field's value.

func (*CustomKeyStoresListEntry) SetConnectionState

func (s *CustomKeyStoresListEntry) SetConnectionState(v string) *CustomKeyStoresListEntry

SetConnectionState sets the ConnectionState field's value.

func (*CustomKeyStoresListEntry) SetCreationDate

func (s *CustomKeyStoresListEntry) SetCreationDate(v time.Time) *CustomKeyStoresListEntry

SetCreationDate sets the CreationDate field's value.

func (*CustomKeyStoresListEntry) SetCustomKeyStoreId

func (s *CustomKeyStoresListEntry) SetCustomKeyStoreId(v string) *CustomKeyStoresListEntry

SetCustomKeyStoreId sets the CustomKeyStoreId field's value.

func (*CustomKeyStoresListEntry) SetCustomKeyStoreName

func (s *CustomKeyStoresListEntry) SetCustomKeyStoreName(v string) *CustomKeyStoresListEntry

SetCustomKeyStoreName sets the CustomKeyStoreName field's value.

func (*CustomKeyStoresListEntry) SetCustomKeyStoreType

func (s *CustomKeyStoresListEntry) SetCustomKeyStoreType(v string) *CustomKeyStoresListEntry

SetCustomKeyStoreType sets the CustomKeyStoreType field's value.

func (*CustomKeyStoresListEntry) SetTrustAnchorCertificate

func (s *CustomKeyStoresListEntry) SetTrustAnchorCertificate(v string) *CustomKeyStoresListEntry

SetTrustAnchorCertificate sets the TrustAnchorCertificate field's value.

func (*CustomKeyStoresListEntry) SetXksProxyConfiguration

func (s *CustomKeyStoresListEntry) SetXksProxyConfiguration(v *XksProxyConfigurationType) *CustomKeyStoresListEntry

SetXksProxyConfiguration sets the XksProxyConfiguration field's value.

func (CustomKeyStoresListEntry) String

func (s CustomKeyStoresListEntry) String() string

String returns the string representation.

API parameter values that are decorated as "sensitive" in the API will not be included in the string output. The member name will be present, but the value will be replaced with "sensitive".

type DecryptInput

type DecryptInput struct {

    // Ciphertext to be decrypted. The blob includes metadata.
    // CiphertextBlob is automatically base64 encoded/decoded by the SDK.
    //
    // CiphertextBlob is a required field
    CiphertextBlob []byte `min:"1" type:"blob" required:"true"`

    // Checks if your request will succeed. DryRun is an optional parameter.
    //
    // To learn more about how to use this parameter, see Testing your KMS API calls
    // (https://docs.aws.amazon.com/kms/latest/developerguide/programming-dryrun.html)
    // in the Key Management Service Developer Guide.
    DryRun *bool `type:"boolean"`

    // Specifies the encryption algorithm that will be used to decrypt the ciphertext.
    // Specify the same algorithm that was used to encrypt the data. If you specify
    // a different algorithm, the Decrypt operation fails.
    //
    // This parameter is required only when the ciphertext was encrypted under an
    // asymmetric KMS key. The default value, SYMMETRIC_DEFAULT, represents the
    // only supported algorithm that is valid for symmetric encryption KMS keys.
    EncryptionAlgorithm *string `type:"string" enum:"EncryptionAlgorithmSpec"`

    // Specifies the encryption context to use when decrypting the data. An encryption
    // context is valid only for cryptographic operations (https://docs.aws.amazon.com/kms/latest/developerguide/concepts.html#cryptographic-operations)
    // with a symmetric encryption KMS key. The standard asymmetric encryption algorithms
    // and HMAC algorithms that KMS uses do not support an encryption context.
    //
    // An encryption context is a collection of non-secret key-value pairs that
    // represent additional authenticated data. When you use an encryption context
    // to encrypt data, you must specify the same (an exact case-sensitive match)
    // encryption context to decrypt the data. An encryption context is supported
    // only on operations with symmetric encryption KMS keys. On operations with
    // symmetric encryption KMS keys, an encryption context is optional, but it
    // is strongly recommended.
    //
    // For more information, see Encryption context (https://docs.aws.amazon.com/kms/latest/developerguide/concepts.html#encrypt_context)
    // in the Key Management Service Developer Guide.
    EncryptionContext map[string]*string `type:"map"`

    // A list of grant tokens.
    //
    // Use a grant token when your permission to call this operation comes from
    // a new grant that has not yet achieved eventual consistency. For more information,
    // see Grant token (https://docs.aws.amazon.com/kms/latest/developerguide/grants.html#grant_token)
    // and Using a grant token (https://docs.aws.amazon.com/kms/latest/developerguide/grant-manage.html#using-grant-token)
    // in the Key Management Service Developer Guide.
    GrantTokens []*string `type:"list"`

    // Specifies the KMS key that KMS uses to decrypt the ciphertext.
    //
    // Enter a key ID of the KMS key that was used to encrypt the ciphertext. If
    // you identify a different KMS key, the Decrypt operation throws an IncorrectKeyException.
    //
    // This parameter is required only when the ciphertext was encrypted under an
    // asymmetric KMS key. If you used a symmetric encryption KMS key, KMS can get
    // the KMS key from metadata that it adds to the symmetric ciphertext blob.
    // However, it is always recommended as a best practice. This practice ensures
    // that you use the KMS key that you intend.
    //
    // To specify a KMS key, use its key ID, key ARN, alias name, or alias ARN.
    // When using an alias name, prefix it with "alias/". To specify a KMS key in
    // a different Amazon Web Services account, you must use the key ARN or alias
    // ARN.
    //
    // For example:
    //
    //    * Key ID: 1234abcd-12ab-34cd-56ef-1234567890ab
    //
    //    * Key ARN: arn:aws:kms:us-east-2:111122223333:key/1234abcd-12ab-34cd-56ef-1234567890ab
    //
    //    * Alias name: alias/ExampleAlias
    //
    //    * Alias ARN: arn:aws:kms:us-east-2:111122223333:alias/ExampleAlias
    //
    // To get the key ID and key ARN for a KMS key, use ListKeys or DescribeKey.
    // To get the alias name and alias ARN, use ListAliases.
    KeyId *string `min:"1" type:"string"`

    // A signed attestation document (https://docs.aws.amazon.com/enclaves/latest/user/nitro-enclave-concepts.html#term-attestdoc)
    // from an Amazon Web Services Nitro enclave and the encryption algorithm to
    // use with the enclave's public key. The only valid encryption algorithm is
    // RSAES_OAEP_SHA_256.
    //
    // This parameter only supports attestation documents for Amazon Web Services
    // Nitro Enclaves. To include this parameter, use the Amazon Web Services Nitro
    // Enclaves SDK (https://docs.aws.amazon.com/enclaves/latest/user/developing-applications.html#sdk)
    // or any Amazon Web Services SDK.
    //
    // When you use this parameter, instead of returning the plaintext data, KMS
    // encrypts the plaintext data with the public key in the attestation document,
    // and returns the resulting ciphertext in the CiphertextForRecipient field
    // in the response. This ciphertext can be decrypted only with the private key
    // in the enclave. The Plaintext field in the response is null or empty.
    //
    // For information about the interaction between KMS and Amazon Web Services
    // Nitro Enclaves, see How Amazon Web Services Nitro Enclaves uses KMS (https://docs.aws.amazon.com/kms/latest/developerguide/services-nitro-enclaves.html)
    // in the Key Management Service Developer Guide.
    Recipient *RecipientInfo `type:"structure"`
    // contains filtered or unexported fields
}

func (DecryptInput) GoString

func (s DecryptInput) GoString() string

GoString returns the string representation.

API parameter values that are decorated as "sensitive" in the API will not be included in the string output. The member name will be present, but the value will be replaced with "sensitive".

func (*DecryptInput) SetCiphertextBlob

func (s *DecryptInput) SetCiphertextBlob(v []byte) *DecryptInput

SetCiphertextBlob sets the CiphertextBlob field's value.

func (*DecryptInput) SetDryRun

func (s *DecryptInput) SetDryRun(v bool) *DecryptInput

SetDryRun sets the DryRun field's value.

func (*DecryptInput) SetEncryptionAlgorithm

func (s *DecryptInput) SetEncryptionAlgorithm(v string) *DecryptInput

SetEncryptionAlgorithm sets the EncryptionAlgorithm field's value.

func (*DecryptInput) SetEncryptionContext

func (s *DecryptInput) SetEncryptionContext(v map[string]*string) *DecryptInput

SetEncryptionContext sets the EncryptionContext field's value.

func (*DecryptInput) SetGrantTokens

func (s *DecryptInput) SetGrantTokens(v []*string) *DecryptInput

SetGrantTokens sets the GrantTokens field's value.

func (*DecryptInput) SetKeyId

func (s *DecryptInput) SetKeyId(v string) *DecryptInput

SetKeyId sets the KeyId field's value.

func (*DecryptInput) SetRecipient

func (s *DecryptInput) SetRecipient(v *RecipientInfo) *DecryptInput

SetRecipient sets the Recipient field's value.

func (DecryptInput) String

func (s DecryptInput) String() string

String returns the string representation.

API parameter values that are decorated as "sensitive" in the API will not be included in the string output. The member name will be present, but the value will be replaced with "sensitive".

func (*DecryptInput) Validate

func (s *DecryptInput) Validate() error

Validate inspects the fields of the type to determine if they are valid.

type DecryptOutput

type DecryptOutput struct {

    // The plaintext data encrypted with the public key in the attestation document.
    //
    // This field is included in the response only when the Recipient parameter
    // in the request includes a valid attestation document from an Amazon Web Services
    // Nitro enclave. For information about the interaction between KMS and Amazon
    // Web Services Nitro Enclaves, see How Amazon Web Services Nitro Enclaves uses
    // KMS (https://docs.aws.amazon.com/kms/latest/developerguide/services-nitro-enclaves.html)
    // in the Key Management Service Developer Guide.
    // CiphertextForRecipient is automatically base64 encoded/decoded by the SDK.
    CiphertextForRecipient []byte `min:"1" type:"blob"`

    // The encryption algorithm that was used to decrypt the ciphertext.
    EncryptionAlgorithm *string `type:"string" enum:"EncryptionAlgorithmSpec"`

    // The Amazon Resource Name (key ARN (https://docs.aws.amazon.com/kms/latest/developerguide/concepts.html#key-id-key-ARN))
    // of the KMS key that was used to decrypt the ciphertext.
    KeyId *string `min:"1" type:"string"`

    // Decrypted plaintext data. When you use the HTTP API or the Amazon Web Services
    // CLI, the value is Base64-encoded. Otherwise, it is not Base64-encoded.
    //
    // If the response includes the CiphertextForRecipient field, the Plaintext
    // field is null or empty.
    //
    // Plaintext is a sensitive parameter and its value will be
    // replaced with "sensitive" in string returned by DecryptOutput's
    // String and GoString methods.
    //
    // Plaintext is automatically base64 encoded/decoded by the SDK.
    Plaintext []byte `min:"1" type:"blob" sensitive:"true"`
    // contains filtered or unexported fields
}

func (DecryptOutput) GoString

func (s DecryptOutput) GoString() string

GoString returns the string representation.

API parameter values that are decorated as "sensitive" in the API will not be included in the string output. The member name will be present, but the value will be replaced with "sensitive".

func (*DecryptOutput) SetCiphertextForRecipient

func (s *DecryptOutput) SetCiphertextForRecipient(v []byte) *DecryptOutput

SetCiphertextForRecipient sets the CiphertextForRecipient field's value.

func (*DecryptOutput) SetEncryptionAlgorithm

func (s *DecryptOutput) SetEncryptionAlgorithm(v string) *DecryptOutput

SetEncryptionAlgorithm sets the EncryptionAlgorithm field's value.

func (*DecryptOutput) SetKeyId

func (s *DecryptOutput) SetKeyId(v string) *DecryptOutput

SetKeyId sets the KeyId field's value.

func (*DecryptOutput) SetPlaintext

func (s *DecryptOutput) SetPlaintext(v []byte) *DecryptOutput

SetPlaintext sets the Plaintext field's value.

func (DecryptOutput) String

func (s DecryptOutput) String() string

String returns the string representation.

API parameter values that are decorated as "sensitive" in the API will not be included in the string output. The member name will be present, but the value will be replaced with "sensitive".

type DeleteAliasInput

type DeleteAliasInput struct {

    // The alias to be deleted. The alias name must begin with alias/ followed by
    // the alias name, such as alias/ExampleAlias.
    //
    // AliasName is a required field
    AliasName *string `min:"1" type:"string" required:"true"`
    // contains filtered or unexported fields
}

func (DeleteAliasInput) GoString

func (s DeleteAliasInput) GoString() string

GoString returns the string representation.

API parameter values that are decorated as "sensitive" in the API will not be included in the string output. The member name will be present, but the value will be replaced with "sensitive".

func (*DeleteAliasInput) SetAliasName

func (s *DeleteAliasInput) SetAliasName(v string) *DeleteAliasInput

SetAliasName sets the AliasName field's value.

func (DeleteAliasInput) String

func (s DeleteAliasInput) String() string

String returns the string representation.

API parameter values that are decorated as "sensitive" in the API will not be included in the string output. The member name will be present, but the value will be replaced with "sensitive".

func (*DeleteAliasInput) Validate

func (s *DeleteAliasInput) Validate() error

Validate inspects the fields of the type to determine if they are valid.

type DeleteAliasOutput

type DeleteAliasOutput struct {
    // contains filtered or unexported fields
}

func (DeleteAliasOutput) GoString

func (s DeleteAliasOutput) GoString() string

GoString returns the string representation.

API parameter values that are decorated as "sensitive" in the API will not be included in the string output. The member name will be present, but the value will be replaced with "sensitive".

func (DeleteAliasOutput) String

func (s DeleteAliasOutput) String() string

String returns the string representation.

API parameter values that are decorated as "sensitive" in the API will not be included in the string output. The member name will be present, but the value will be replaced with "sensitive".

type DeleteCustomKeyStoreInput

type DeleteCustomKeyStoreInput struct {

    // Enter the ID of the custom key store you want to delete. To find the ID of
    // a custom key store, use the DescribeCustomKeyStores operation.
    //
    // CustomKeyStoreId is a required field
    CustomKeyStoreId *string `min:"1" type:"string" required:"true"`
    // contains filtered or unexported fields
}

func (DeleteCustomKeyStoreInput) GoString

func (s DeleteCustomKeyStoreInput) GoString() string

GoString returns the string representation.

API parameter values that are decorated as "sensitive" in the API will not be included in the string output. The member name will be present, but the value will be replaced with "sensitive".

func (*DeleteCustomKeyStoreInput) SetCustomKeyStoreId

func (s *DeleteCustomKeyStoreInput) SetCustomKeyStoreId(v string) *DeleteCustomKeyStoreInput

SetCustomKeyStoreId sets the CustomKeyStoreId field's value.

func (DeleteCustomKeyStoreInput) String

func (s DeleteCustomKeyStoreInput) String() string

String returns the string representation.

API parameter values that are decorated as "sensitive" in the API will not be included in the string output. The member name will be present, but the value will be replaced with "sensitive".

func (*DeleteCustomKeyStoreInput) Validate

func (s *DeleteCustomKeyStoreInput) Validate() error

Validate inspects the fields of the type to determine if they are valid.

type DeleteCustomKeyStoreOutput

type DeleteCustomKeyStoreOutput struct {
    // contains filtered or unexported fields
}

func (DeleteCustomKeyStoreOutput) GoString

func (s DeleteCustomKeyStoreOutput) GoString() string

GoString returns the string representation.

API parameter values that are decorated as "sensitive" in the API will not be included in the string output. The member name will be present, but the value will be replaced with "sensitive".

func (DeleteCustomKeyStoreOutput) String

func (s DeleteCustomKeyStoreOutput) String() string

String returns the string representation.

API parameter values that are decorated as "sensitive" in the API will not be included in the string output. The member name will be present, but the value will be replaced with "sensitive".

type DeleteImportedKeyMaterialInput

type DeleteImportedKeyMaterialInput struct {

    // Identifies the KMS key from which you are deleting imported key material.
    // The Origin of the KMS key must be EXTERNAL.
    //
    // Specify the key ID or key ARN of the KMS key.
    //
    // For example:
    //
    //    * Key ID: 1234abcd-12ab-34cd-56ef-1234567890ab
    //
    //    * Key ARN: arn:aws:kms:us-east-2:111122223333:key/1234abcd-12ab-34cd-56ef-1234567890ab
    //
    // To get the key ID and key ARN for a KMS key, use ListKeys or DescribeKey.
    //
    // KeyId is a required field
    KeyId *string `min:"1" type:"string" required:"true"`
    // contains filtered or unexported fields
}

func (DeleteImportedKeyMaterialInput) GoString

func (s DeleteImportedKeyMaterialInput) GoString() string

GoString returns the string representation.

API parameter values that are decorated as "sensitive" in the API will not be included in the string output. The member name will be present, but the value will be replaced with "sensitive".

func (*DeleteImportedKeyMaterialInput) SetKeyId

func (s *DeleteImportedKeyMaterialInput) SetKeyId(v string) *DeleteImportedKeyMaterialInput

SetKeyId sets the KeyId field's value.

func (DeleteImportedKeyMaterialInput) String

func (s DeleteImportedKeyMaterialInput) String() string

String returns the string representation.

API parameter values that are decorated as "sensitive" in the API will not be included in the string output. The member name will be present, but the value will be replaced with "sensitive".

func (*DeleteImportedKeyMaterialInput) Validate

func (s *DeleteImportedKeyMaterialInput) Validate() error

Validate inspects the fields of the type to determine if they are valid.

type DeleteImportedKeyMaterialOutput

type DeleteImportedKeyMaterialOutput struct {
    // contains filtered or unexported fields
}

func (DeleteImportedKeyMaterialOutput) GoString

func (s DeleteImportedKeyMaterialOutput) GoString() string

GoString returns the string representation.

API parameter values that are decorated as "sensitive" in the API will not be included in the string output. The member name will be present, but the value will be replaced with "sensitive".

func (DeleteImportedKeyMaterialOutput) String

func (s DeleteImportedKeyMaterialOutput) String() string

String returns the string representation.

API parameter values that are decorated as "sensitive" in the API will not be included in the string output. The member name will be present, but the value will be replaced with "sensitive".

type DependencyTimeoutException

type DependencyTimeoutException struct {
    RespMetadata protocol.ResponseMetadata `json:"-" xml:"-"`

    Message_ *string `locationName:"message" type:"string"`
    // contains filtered or unexported fields
}

The system timed out while trying to fulfill the request. You can retry the request.

func (*DependencyTimeoutException) Code

func (s *DependencyTimeoutException) Code() string

Code returns the exception type name.

func (*DependencyTimeoutException) Error

func (s *DependencyTimeoutException) Error() string

func (DependencyTimeoutException) GoString

func (s DependencyTimeoutException) GoString() string

GoString returns the string representation.

API parameter values that are decorated as "sensitive" in the API will not be included in the string output. The member name will be present, but the value will be replaced with "sensitive".

func (*DependencyTimeoutException) Message

func (s *DependencyTimeoutException) Message() string

Message returns the exception's message.

func (*DependencyTimeoutException) OrigErr

func (s *DependencyTimeoutException) OrigErr() error

OrigErr always returns nil, satisfies awserr.Error interface.

func (*DependencyTimeoutException) RequestID

func (s *DependencyTimeoutException) RequestID() string

RequestID returns the service's response RequestID for request.

func (*DependencyTimeoutException) StatusCode

func (s *DependencyTimeoutException) StatusCode() int

Status code returns the HTTP status code for the request's response error.

func (DependencyTimeoutException) String

func (s DependencyTimeoutException) String() string

String returns the string representation.

API parameter values that are decorated as "sensitive" in the API will not be included in the string output. The member name will be present, but the value will be replaced with "sensitive".

type DeriveSharedSecretInput

type DeriveSharedSecretInput struct {

    // Checks if your request will succeed. DryRun is an optional parameter.
    //
    // To learn more about how to use this parameter, see Testing your KMS API calls
    // (https://docs.aws.amazon.com/kms/latest/developerguide/programming-dryrun.html)
    // in the Key Management Service Developer Guide.
    DryRun *bool `type:"boolean"`

    // A list of grant tokens.
    //
    // Use a grant token when your permission to call this operation comes from
    // a new grant that has not yet achieved eventual consistency. For more information,
    // see Grant token (https://docs.aws.amazon.com/kms/latest/developerguide/grants.html#grant_token)
    // and Using a grant token (https://docs.aws.amazon.com/kms/latest/developerguide/grant-manage.html#using-grant-token)
    // in the Key Management Service Developer Guide.
    GrantTokens []*string `type:"list"`

    // Specifies the key agreement algorithm used to derive the shared secret. The
    // only valid value is ECDH.
    //
    // KeyAgreementAlgorithm is a required field
    KeyAgreementAlgorithm *string `type:"string" required:"true" enum:"KeyAgreementAlgorithmSpec"`

    // Identifies an asymmetric NIST-recommended ECC or SM2 (China Regions only)
    // KMS key. KMS uses the private key in the specified key pair to derive the
    // shared secret. The key usage of the KMS key must be KEY_AGREEMENT. To find
    // the KeyUsage of a KMS key, use the DescribeKey operation.
    //
    // To specify a KMS key, use its key ID, key ARN, alias name, or alias ARN.
    // When using an alias name, prefix it with "alias/". To specify a KMS key in
    // a different Amazon Web Services account, you must use the key ARN or alias
    // ARN.
    //
    // For example:
    //
    //    * Key ID: 1234abcd-12ab-34cd-56ef-1234567890ab
    //
    //    * Key ARN: arn:aws:kms:us-east-2:111122223333:key/1234abcd-12ab-34cd-56ef-1234567890ab
    //
    //    * Alias name: alias/ExampleAlias
    //
    //    * Alias ARN: arn:aws:kms:us-east-2:111122223333:alias/ExampleAlias
    //
    // To get the key ID and key ARN for a KMS key, use ListKeys or DescribeKey.
    // To get the alias name and alias ARN, use ListAliases.
    //
    // KeyId is a required field
    KeyId *string `min:"1" type:"string" required:"true"`

    // Specifies the public key in your peer's NIST-recommended elliptic curve (ECC)
    // or SM2 (China Regions only) key pair.
    //
    // The public key must be a DER-encoded X.509 public key, also known as SubjectPublicKeyInfo
    // (SPKI), as defined in RFC 5280 (https://tools.ietf.org/html/rfc5280).
    //
    // GetPublicKey returns the public key of an asymmetric KMS key pair in the
    // required DER-encoded format.
    //
    // If you use Amazon Web Services CLI version 1 (https://docs.aws.amazon.com/cli/v1/userguide/cli-chap-welcome.html),
    // you must provide the DER-encoded X.509 public key in a file. Otherwise, the
    // Amazon Web Services CLI Base64-encodes the public key a second time, resulting
    // in a ValidationException.
    //
    // You can specify the public key as binary data in a file using fileb (fileb://<path-to-file>)
    // or in-line using a Base64 encoded string.
    // PublicKey is automatically base64 encoded/decoded by the SDK.
    //
    // PublicKey is a required field
    PublicKey []byte `min:"1" type:"blob" required:"true"`

    // A signed attestation document (https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/nitro-enclave-how.html#term-attestdoc)
    // from an Amazon Web Services Nitro enclave and the encryption algorithm to
    // use with the enclave's public key. The only valid encryption algorithm is
    // RSAES_OAEP_SHA_256.
    //
    // This parameter only supports attestation documents for Amazon Web Services
    // Nitro Enclaves. To call DeriveSharedSecret for an Amazon Web Services Nitro
    // Enclaves, use the Amazon Web Services Nitro Enclaves SDK (https://docs.aws.amazon.com/enclaves/latest/user/developing-applications.html#sdk)
    // to generate the attestation document and then use the Recipient parameter
    // from any Amazon Web Services SDK to provide the attestation document for
    // the enclave.
    //
    // When you use this parameter, instead of returning a plaintext copy of the
    // shared secret, KMS encrypts the plaintext shared secret under the public
    // key in the attestation document, and returns the resulting ciphertext in
    // the CiphertextForRecipient field in the response. This ciphertext can be
    // decrypted only with the private key in the enclave. The CiphertextBlob field
    // in the response contains the encrypted shared secret derived from the KMS
    // key specified by the KeyId parameter and public key specified by the PublicKey
    // parameter. The SharedSecret field in the response is null or empty.
    //
    // For information about the interaction between KMS and Amazon Web Services
    // Nitro Enclaves, see How Amazon Web Services Nitro Enclaves uses KMS (https://docs.aws.amazon.com/kms/latest/developerguide/services-nitro-enclaves.html)
    // in the Key Management Service Developer Guide.
    Recipient *RecipientInfo `type:"structure"`
    // contains filtered or unexported fields
}

func (DeriveSharedSecretInput) GoString

func (s DeriveSharedSecretInput) GoString() string

GoString returns the string representation.

API parameter values that are decorated as "sensitive" in the API will not be included in the string output. The member name will be present, but the value will be replaced with "sensitive".

func (*DeriveSharedSecretInput) SetDryRun

func (s *DeriveSharedSecretInput) SetDryRun(v bool) *DeriveSharedSecretInput

SetDryRun sets the DryRun field's value.

func (*DeriveSharedSecretInput) SetGrantTokens

func (s *DeriveSharedSecretInput) SetGrantTokens(v []*string) *DeriveSharedSecretInput

SetGrantTokens sets the GrantTokens field's value.

func (*DeriveSharedSecretInput) SetKeyAgreementAlgorithm

func (s *DeriveSharedSecretInput) SetKeyAgreementAlgorithm(v string) *DeriveSharedSecretInput

SetKeyAgreementAlgorithm sets the KeyAgreementAlgorithm field's value.

func (*DeriveSharedSecretInput) SetKeyId

func (s *DeriveSharedSecretInput) SetKeyId(v string) *DeriveSharedSecretInput

SetKeyId sets the KeyId field's value.

func (*DeriveSharedSecretInput) SetPublicKey

func (s *DeriveSharedSecretInput) SetPublicKey(v []byte) *DeriveSharedSecretInput

SetPublicKey sets the PublicKey field's value.

func (*DeriveSharedSecretInput) SetRecipient

func (s *DeriveSharedSecretInput) SetRecipient(v *RecipientInfo) *DeriveSharedSecretInput

SetRecipient sets the Recipient field's value.

func (DeriveSharedSecretInput) String

func (s DeriveSharedSecretInput) String() string

String returns the string representation.

API parameter values that are decorated as "sensitive" in the API will not be included in the string output. The member name will be present, but the value will be replaced with "sensitive".

func (*DeriveSharedSecretInput) Validate

func (s *DeriveSharedSecretInput) Validate() error

Validate inspects the fields of the type to determine if they are valid.

type DeriveSharedSecretOutput

type DeriveSharedSecretOutput struct {

    // The plaintext shared secret encrypted with the public key in the attestation
    // document.
    //
    // This field is included in the response only when the Recipient parameter
    // in the request includes a valid attestation document from an Amazon Web Services
    // Nitro enclave. For information about the interaction between KMS and Amazon
    // Web Services Nitro Enclaves, see How Amazon Web Services Nitro Enclaves uses
    // KMS (https://docs.aws.amazon.com/kms/latest/developerguide/services-nitro-enclaves.html)
    // in the Key Management Service Developer Guide.
    // CiphertextForRecipient is automatically base64 encoded/decoded by the SDK.
    CiphertextForRecipient []byte `min:"1" type:"blob"`

    // Identifies the key agreement algorithm used to derive the shared secret.
    KeyAgreementAlgorithm *string `type:"string" enum:"KeyAgreementAlgorithmSpec"`

    // Identifies the KMS key used to derive the shared secret.
    KeyId *string `min:"1" type:"string"`

    // The source of the key material for the specified KMS key.
    //
    // When this value is AWS_KMS, KMS created the key material. When this value
    // is EXTERNAL, the key material was imported or the KMS key doesn't have any
    // key material.
    //
    // The only valid values for DeriveSharedSecret are AWS_KMS and EXTERNAL. DeriveSharedSecret
    // does not support KMS keys with a KeyOrigin value of AWS_CLOUDHSM or EXTERNAL_KEY_STORE.
    KeyOrigin *string `type:"string" enum:"OriginType"`

    // The raw secret derived from the specified key agreement algorithm, private
    // key in the asymmetric KMS key, and your peer's public key.
    //
    // If the response includes the CiphertextForRecipient field, the SharedSecret
    // field is null or empty.
    //
    // SharedSecret is a sensitive parameter and its value will be
    // replaced with "sensitive" in string returned by DeriveSharedSecretOutput's
    // String and GoString methods.
    //
    // SharedSecret is automatically base64 encoded/decoded by the SDK.
    SharedSecret []byte `min:"1" type:"blob" sensitive:"true"`
    // contains filtered or unexported fields
}

func (DeriveSharedSecretOutput) GoString

func (s DeriveSharedSecretOutput) GoString() string

GoString returns the string representation.

API parameter values that are decorated as "sensitive" in the API will not be included in the string output. The member name will be present, but the value will be replaced with "sensitive".

func (*DeriveSharedSecretOutput) SetCiphertextForRecipient

func (s *DeriveSharedSecretOutput) SetCiphertextForRecipient(v []byte) *DeriveSharedSecretOutput

SetCiphertextForRecipient sets the CiphertextForRecipient field's value.

func (*DeriveSharedSecretOutput) SetKeyAgreementAlgorithm

func (s *DeriveSharedSecretOutput) SetKeyAgreementAlgorithm(v string) *DeriveSharedSecretOutput

SetKeyAgreementAlgorithm sets the KeyAgreementAlgorithm field's value.

func (*DeriveSharedSecretOutput) SetKeyId

func (s *DeriveSharedSecretOutput) SetKeyId(v string) *DeriveSharedSecretOutput

SetKeyId sets the KeyId field's value.

func (*DeriveSharedSecretOutput) SetKeyOrigin

func (s *DeriveSharedSecretOutput) SetKeyOrigin(v string) *DeriveSharedSecretOutput

SetKeyOrigin sets the KeyOrigin field's value.

func (*DeriveSharedSecretOutput) SetSharedSecret

func (s *DeriveSharedSecretOutput) SetSharedSecret(v []byte) *DeriveSharedSecretOutput

SetSharedSecret sets the SharedSecret field's value.

func (DeriveSharedSecretOutput) String

func (s DeriveSharedSecretOutput) String() string

String returns the string representation.

API parameter values that are decorated as "sensitive" in the API will not be included in the string output. The member name will be present, but the value will be replaced with "sensitive".

type DescribeCustomKeyStoresInput

type DescribeCustomKeyStoresInput struct {

    // Gets only information about the specified custom key store. Enter the key
    // store ID.
    //
    // By default, this operation gets information about all custom key stores in
    // the account and Region. To limit the output to a particular custom key store,
    // provide either the CustomKeyStoreId or CustomKeyStoreName parameter, but
    // not both.
    CustomKeyStoreId *string `min:"1" type:"string"`

    // Gets only information about the specified custom key store. Enter the friendly
    // name of the custom key store.
    //
    // By default, this operation gets information about all custom key stores in
    // the account and Region. To limit the output to a particular custom key store,
    // provide either the CustomKeyStoreId or CustomKeyStoreName parameter, but
    // not both.
    CustomKeyStoreName *string `min:"1" type:"string"`

    // Use this parameter to specify the maximum number of items to return. When
    // this value is present, KMS does not return more than the specified number
    // of items, but it might return fewer.
    Limit *int64 `min:"1" type:"integer"`

    // Use this parameter in a subsequent request after you receive a response with
    // truncated results. Set it to the value of NextMarker from the truncated response
    // you just received.
    Marker *string `min:"1" type:"string"`
    // contains filtered or unexported fields
}

func (DescribeCustomKeyStoresInput) GoString

func (s DescribeCustomKeyStoresInput) GoString() string

GoString returns the string representation.

API parameter values that are decorated as "sensitive" in the API will not be included in the string output. The member name will be present, but the value will be replaced with "sensitive".

func (*DescribeCustomKeyStoresInput) SetCustomKeyStoreId

func (s *DescribeCustomKeyStoresInput) SetCustomKeyStoreId(v string) *DescribeCustomKeyStoresInput

SetCustomKeyStoreId sets the CustomKeyStoreId field's value.

func (*DescribeCustomKeyStoresInput) SetCustomKeyStoreName

func (s *DescribeCustomKeyStoresInput) SetCustomKeyStoreName(v string) *DescribeCustomKeyStoresInput

SetCustomKeyStoreName sets the CustomKeyStoreName field's value.

func (*DescribeCustomKeyStoresInput) SetLimit

func (s *DescribeCustomKeyStoresInput) SetLimit(v int64) *DescribeCustomKeyStoresInput

SetLimit sets the Limit field's value.

func (*DescribeCustomKeyStoresInput) SetMarker

func (s *DescribeCustomKeyStoresInput) SetMarker(v string) *DescribeCustomKeyStoresInput

SetMarker sets the Marker field's value.

func (DescribeCustomKeyStoresInput) String

func (s DescribeCustomKeyStoresInput) String() string

String returns the string representation.

API parameter values that are decorated as "sensitive" in the API will not be included in the string output. The member name will be present, but the value will be replaced with "sensitive".

func (*DescribeCustomKeyStoresInput) Validate

func (s *DescribeCustomKeyStoresInput) Validate() error

Validate inspects the fields of the type to determine if they are valid.

type DescribeCustomKeyStoresOutput

type DescribeCustomKeyStoresOutput struct {

    // Contains metadata about each custom key store.
    CustomKeyStores []*CustomKeyStoresListEntry `type:"list"`

    // When Truncated is true, this element is present and contains the value to
    // use for the Marker parameter in a subsequent request.
    NextMarker *string `min:"1" type:"string"`

    // A flag that indicates whether there are more items in the list. When this
    // value is true, the list in this response is truncated. To get more items,
    // pass the value of the NextMarker element in this response to the Marker parameter
    // in a subsequent request.
    Truncated *bool `type:"boolean"`
    // contains filtered or unexported fields
}

func (DescribeCustomKeyStoresOutput) GoString

func (s DescribeCustomKeyStoresOutput) GoString() string

GoString returns the string representation.

API parameter values that are decorated as "sensitive" in the API will not be included in the string output. The member name will be present, but the value will be replaced with "sensitive".

func (*DescribeCustomKeyStoresOutput) SetCustomKeyStores

func (s *DescribeCustomKeyStoresOutput) SetCustomKeyStores(v []*CustomKeyStoresListEntry) *DescribeCustomKeyStoresOutput

SetCustomKeyStores sets the CustomKeyStores field's value.

func (*DescribeCustomKeyStoresOutput) SetNextMarker

func (s *DescribeCustomKeyStoresOutput) SetNextMarker(v string) *DescribeCustomKeyStoresOutput

SetNextMarker sets the NextMarker field's value.

func (*DescribeCustomKeyStoresOutput) SetTruncated

func (s *DescribeCustomKeyStoresOutput) SetTruncated(v bool) *DescribeCustomKeyStoresOutput

SetTruncated sets the Truncated field's value.

func (DescribeCustomKeyStoresOutput) String

func (s DescribeCustomKeyStoresOutput) String() string

String returns the string representation.

API parameter values that are decorated as "sensitive" in the API will not be included in the string output. The member name will be present, but the value will be replaced with "sensitive".

type DescribeKeyInput

type DescribeKeyInput struct {

    // A list of grant tokens.
    //
    // Use a grant token when your permission to call this operation comes from
    // a new grant that has not yet achieved eventual consistency. For more information,
    // see Grant token (https://docs.aws.amazon.com/kms/latest/developerguide/grants.html#grant_token)
    // and Using a grant token (https://docs.aws.amazon.com/kms/latest/developerguide/grant-manage.html#using-grant-token)
    // in the Key Management Service Developer Guide.
    GrantTokens []*string `type:"list"`

    // Describes the specified KMS key.
    //
    // If you specify a predefined Amazon Web Services alias (an Amazon Web Services
    // alias with no key ID), KMS associates the alias with an Amazon Web Services
    // managed key (https://docs.aws.amazon.com/kms/latest/developerguide/concepts.html##aws-managed-cmk)
    // and returns its KeyId and Arn in the response.
    //
    // To specify a KMS key, use its key ID, key ARN, alias name, or alias ARN.
    // When using an alias name, prefix it with "alias/". To specify a KMS key in
    // a different Amazon Web Services account, you must use the key ARN or alias
    // ARN.
    //
    // For example:
    //
    //    * Key ID: 1234abcd-12ab-34cd-56ef-1234567890ab
    //
    //    * Key ARN: arn:aws:kms:us-east-2:111122223333:key/1234abcd-12ab-34cd-56ef-1234567890ab
    //
    //    * Alias name: alias/ExampleAlias
    //
    //    * Alias ARN: arn:aws:kms:us-east-2:111122223333:alias/ExampleAlias
    //
    // To get the key ID and key ARN for a KMS key, use ListKeys or DescribeKey.
    // To get the alias name and alias ARN, use ListAliases.
    //
    // KeyId is a required field
    KeyId *string `min:"1" type:"string" required:"true"`
    // contains filtered or unexported fields
}

func (DescribeKeyInput) GoString

func (s DescribeKeyInput) GoString() string

GoString returns the string representation.

API parameter values that are decorated as "sensitive" in the API will not be included in the string output. The member name will be present, but the value will be replaced with "sensitive".

func (*DescribeKeyInput) SetGrantTokens

func (s *DescribeKeyInput) SetGrantTokens(v []*string) *DescribeKeyInput

SetGrantTokens sets the GrantTokens field's value.

func (*DescribeKeyInput) SetKeyId

func (s *DescribeKeyInput) SetKeyId(v string) *DescribeKeyInput

SetKeyId sets the KeyId field's value.

func (DescribeKeyInput) String

func (s DescribeKeyInput) String() string

String returns the string representation.

API parameter values that are decorated as "sensitive" in the API will not be included in the string output. The member name will be present, but the value will be replaced with "sensitive".

func (*DescribeKeyInput) Validate

func (s *DescribeKeyInput) Validate() error

Validate inspects the fields of the type to determine if they are valid.

type DescribeKeyOutput

type DescribeKeyOutput struct {

    // Metadata associated with the key.
    KeyMetadata *KeyMetadata `type:"structure"`
    // contains filtered or unexported fields
}

func (DescribeKeyOutput) GoString

func (s DescribeKeyOutput) GoString() string

GoString returns the string representation.

API parameter values that are decorated as "sensitive" in the API will not be included in the string output. The member name will be present, but the value will be replaced with "sensitive".

func (*DescribeKeyOutput) SetKeyMetadata

func (s *DescribeKeyOutput) SetKeyMetadata(v *KeyMetadata) *DescribeKeyOutput

SetKeyMetadata sets the KeyMetadata field's value.

func (DescribeKeyOutput) String

func (s DescribeKeyOutput) String() string

String returns the string representation.

API parameter values that are decorated as "sensitive" in the API will not be included in the string output. The member name will be present, but the value will be replaced with "sensitive".

type DisableKeyInput

type DisableKeyInput struct {

    // Identifies the KMS key to disable.
    //
    // Specify the key ID or key ARN of the KMS key.
    //
    // For example:
    //
    //    * Key ID: 1234abcd-12ab-34cd-56ef-1234567890ab
    //
    //    * Key ARN: arn:aws:kms:us-east-2:111122223333:key/1234abcd-12ab-34cd-56ef-1234567890ab
    //
    // To get the key ID and key ARN for a KMS key, use ListKeys or DescribeKey.
    //
    // KeyId is a required field
    KeyId *string `min:"1" type:"string" required:"true"`
    // contains filtered or unexported fields
}

func (DisableKeyInput) GoString

func (s DisableKeyInput) GoString() string

GoString returns the string representation.

API parameter values that are decorated as "sensitive" in the API will not be included in the string output. The member name will be present, but the value will be replaced with "sensitive".

func (*DisableKeyInput) SetKeyId

func (s *DisableKeyInput) SetKeyId(v string) *DisableKeyInput

SetKeyId sets the KeyId field's value.

func (DisableKeyInput) String

func (s DisableKeyInput) String() string

String returns the string representation.

API parameter values that are decorated as "sensitive" in the API will not be included in the string output. The member name will be present, but the value will be replaced with "sensitive".

func (*DisableKeyInput) Validate

func (s *DisableKeyInput) Validate() error

Validate inspects the fields of the type to determine if they are valid.

type DisableKeyOutput

type DisableKeyOutput struct {
    // contains filtered or unexported fields
}

func (DisableKeyOutput) GoString

func (s DisableKeyOutput) GoString() string

GoString returns the string representation.

API parameter values that are decorated as "sensitive" in the API will not be included in the string output. The member name will be present, but the value will be replaced with "sensitive".

func (DisableKeyOutput) String

func (s DisableKeyOutput) String() string

String returns the string representation.

API parameter values that are decorated as "sensitive" in the API will not be included in the string output. The member name will be present, but the value will be replaced with "sensitive".

type DisableKeyRotationInput

type DisableKeyRotationInput struct {

    // Identifies a symmetric encryption KMS key. You cannot enable or disable automatic
    // rotation of asymmetric KMS keys (https://docs.aws.amazon.com/kms/latest/developerguide/symmetric-asymmetric.html#asymmetric-cmks),
    // HMAC KMS keys (https://docs.aws.amazon.com/kms/latest/developerguide/hmac.html),
    // KMS keys with imported key material (https://docs.aws.amazon.com/kms/latest/developerguide/importing-keys.html),
    // or KMS keys in a custom key store (https://docs.aws.amazon.com/kms/latest/developerguide/custom-key-store-overview.html).
    //
    // Specify the key ID or key ARN of the KMS key.
    //
    // For example:
    //
    //    * Key ID: 1234abcd-12ab-34cd-56ef-1234567890ab
    //
    //    * Key ARN: arn:aws:kms:us-east-2:111122223333:key/1234abcd-12ab-34cd-56ef-1234567890ab
    //
    // To get the key ID and key ARN for a KMS key, use ListKeys or DescribeKey.
    //
    // KeyId is a required field
    KeyId *string `min:"1" type:"string" required:"true"`
    // contains filtered or unexported fields
}

func (DisableKeyRotationInput) GoString

func (s DisableKeyRotationInput) GoString() string

GoString returns the string representation.

API parameter values that are decorated as "sensitive" in the API will not be included in the string output. The member name will be present, but the value will be replaced with "sensitive".

func (*DisableKeyRotationInput) SetKeyId

func (s *DisableKeyRotationInput) SetKeyId(v string) *DisableKeyRotationInput

SetKeyId sets the KeyId field's value.

func (DisableKeyRotationInput) String

func (s DisableKeyRotationInput) String() string

String returns the string representation.

API parameter values that are decorated as "sensitive" in the API will not be included in the string output. The member name will be present, but the value will be replaced with "sensitive".

func (*DisableKeyRotationInput) Validate

func (s *DisableKeyRotationInput) Validate() error

Validate inspects the fields of the type to determine if they are valid.

type DisableKeyRotationOutput

type DisableKeyRotationOutput struct {
    // contains filtered or unexported fields
}

func (DisableKeyRotationOutput) GoString

func (s DisableKeyRotationOutput) GoString() string

GoString returns the string representation.

API parameter values that are decorated as "sensitive" in the API will not be included in the string output. The member name will be present, but the value will be replaced with "sensitive".

func (DisableKeyRotationOutput) String

func (s DisableKeyRotationOutput) String() string

String returns the string representation.

API parameter values that are decorated as "sensitive" in the API will not be included in the string output. The member name will be present, but the value will be replaced with "sensitive".

type DisabledException

type DisabledException struct {
    RespMetadata protocol.ResponseMetadata `json:"-" xml:"-"`

    Message_ *string `locationName:"message" type:"string"`
    // contains filtered or unexported fields
}

The request was rejected because the specified KMS key is not enabled.

func (*DisabledException) Code

func (s *DisabledException) Code() string

Code returns the exception type name.

func (*DisabledException) Error

func (s *DisabledException) Error() string

func (DisabledException) GoString

func (s DisabledException) GoString() string

GoString returns the string representation.

API parameter values that are decorated as "sensitive" in the API will not be included in the string output. The member name will be present, but the value will be replaced with "sensitive".

func (*DisabledException) Message

func (s *DisabledException) Message() string

Message returns the exception's message.

func (*DisabledException) OrigErr

func (s *DisabledException) OrigErr() error

OrigErr always returns nil, satisfies awserr.Error interface.

func (*DisabledException) RequestID

func (s *DisabledException) RequestID() string

RequestID returns the service's response RequestID for request.

func (*DisabledException) StatusCode

func (s *DisabledException) StatusCode() int

Status code returns the HTTP status code for the request's response error.

func (DisabledException) String

func (s DisabledException) String() string

String returns the string representation.

API parameter values that are decorated as "sensitive" in the API will not be included in the string output. The member name will be present, but the value will be replaced with "sensitive".

type DisconnectCustomKeyStoreInput

type DisconnectCustomKeyStoreInput struct {

    // Enter the ID of the custom key store you want to disconnect. To find the
    // ID of a custom key store, use the DescribeCustomKeyStores operation.
    //
    // CustomKeyStoreId is a required field
    CustomKeyStoreId *string `min:"1" type:"string" required:"true"`
    // contains filtered or unexported fields
}

func (DisconnectCustomKeyStoreInput) GoString

func (s DisconnectCustomKeyStoreInput) GoString() string

GoString returns the string representation.

API parameter values that are decorated as "sensitive" in the API will not be included in the string output. The member name will be present, but the value will be replaced with "sensitive".

func (*DisconnectCustomKeyStoreInput) SetCustomKeyStoreId

func (s *DisconnectCustomKeyStoreInput) SetCustomKeyStoreId(v string) *DisconnectCustomKeyStoreInput

SetCustomKeyStoreId sets the CustomKeyStoreId field's value.

func (DisconnectCustomKeyStoreInput) String

func (s DisconnectCustomKeyStoreInput) String() string

String returns the string representation.

API parameter values that are decorated as "sensitive" in the API will not be included in the string output. The member name will be present, but the value will be replaced with "sensitive".

func (*DisconnectCustomKeyStoreInput) Validate

func (s *DisconnectCustomKeyStoreInput) Validate() error

Validate inspects the fields of the type to determine if they are valid.

type DisconnectCustomKeyStoreOutput

type DisconnectCustomKeyStoreOutput struct {
    // contains filtered or unexported fields
}

func (DisconnectCustomKeyStoreOutput) GoString

func (s DisconnectCustomKeyStoreOutput) GoString() string

GoString returns the string representation.

API parameter values that are decorated as "sensitive" in the API will not be included in the string output. The member name will be present, but the value will be replaced with "sensitive".

func (DisconnectCustomKeyStoreOutput) String

func (s DisconnectCustomKeyStoreOutput) String() string

String returns the string representation.

API parameter values that are decorated as "sensitive" in the API will not be included in the string output. The member name will be present, but the value will be replaced with "sensitive".

type DryRunOperationException

type DryRunOperationException struct {
    RespMetadata protocol.ResponseMetadata `json:"-" xml:"-"`

    Message_ *string `locationName:"message" type:"string"`
    // contains filtered or unexported fields
}

The request was rejected because the DryRun parameter was specified.

func (*DryRunOperationException) Code

func (s *DryRunOperationException) Code() string

Code returns the exception type name.

func (*DryRunOperationException) Error

func (s *DryRunOperationException) Error() string

func (DryRunOperationException) GoString

func (s DryRunOperationException) GoString() string

GoString returns the string representation.

API parameter values that are decorated as "sensitive" in the API will not be included in the string output. The member name will be present, but the value will be replaced with "sensitive".

func (*DryRunOperationException) Message

func (s *DryRunOperationException) Message() string

Message returns the exception's message.

func (*DryRunOperationException) OrigErr

func (s *DryRunOperationException) OrigErr() error

OrigErr always returns nil, satisfies awserr.Error interface.

func (*DryRunOperationException) RequestID

func (s *DryRunOperationException) RequestID() string

RequestID returns the service's response RequestID for request.

func (*DryRunOperationException) StatusCode

func (s *DryRunOperationException) StatusCode() int

Status code returns the HTTP status code for the request's response error.

func (DryRunOperationException) String

func (s DryRunOperationException) String() string

String returns the string representation.

API parameter values that are decorated as "sensitive" in the API will not be included in the string output. The member name will be present, but the value will be replaced with "sensitive".

type EnableKeyInput

type EnableKeyInput struct {

    // Identifies the KMS key to enable.
    //
    // Specify the key ID or key ARN of the KMS key.
    //
    // For example:
    //
    //    * Key ID: 1234abcd-12ab-34cd-56ef-1234567890ab
    //
    //    * Key ARN: arn:aws:kms:us-east-2:111122223333:key/1234abcd-12ab-34cd-56ef-1234567890ab
    //
    // To get the key ID and key ARN for a KMS key, use ListKeys or DescribeKey.
    //
    // KeyId is a required field
    KeyId *string `min:"1" type:"string" required:"true"`
    // contains filtered or unexported fields
}

func (EnableKeyInput) GoString

func (s EnableKeyInput) GoString() string

GoString returns the string representation.

API parameter values that are decorated as "sensitive" in the API will not be included in the string output. The member name will be present, but the value will be replaced with "sensitive".

func (*EnableKeyInput) SetKeyId

func (s *EnableKeyInput) SetKeyId(v string) *EnableKeyInput

SetKeyId sets the KeyId field's value.

func (EnableKeyInput) String

func (s EnableKeyInput) String() string

String returns the string representation.

API parameter values that are decorated as "sensitive" in the API will not be included in the string output. The member name will be present, but the value will be replaced with "sensitive".

func (*EnableKeyInput) Validate

func (s *EnableKeyInput) Validate() error

Validate inspects the fields of the type to determine if they are valid.

type EnableKeyOutput

type EnableKeyOutput struct {
    // contains filtered or unexported fields
}

func (EnableKeyOutput) GoString

func (s EnableKeyOutput) GoString() string

GoString returns the string representation.

API parameter values that are decorated as "sensitive" in the API will not be included in the string output. The member name will be present, but the value will be replaced with "sensitive".

func (EnableKeyOutput) String

func (s EnableKeyOutput) String() string

String returns the string representation.

API parameter values that are decorated as "sensitive" in the API will not be included in the string output. The member name will be present, but the value will be replaced with "sensitive".

type EnableKeyRotationInput

type EnableKeyRotationInput struct {

    // Identifies a symmetric encryption KMS key. You cannot enable automatic rotation
    // of asymmetric KMS keys (https://docs.aws.amazon.com/kms/latest/developerguide/symmetric-asymmetric.html),
    // HMAC KMS keys (https://docs.aws.amazon.com/kms/latest/developerguide/hmac.html),
    // KMS keys with imported key material (https://docs.aws.amazon.com/kms/latest/developerguide/importing-keys.html),
    // or KMS keys in a custom key store (https://docs.aws.amazon.com/kms/latest/developerguide/custom-key-store-overview.html).
    // To enable or disable automatic rotation of a set of related multi-Region
    // keys (https://docs.aws.amazon.com/kms/latest/developerguide/multi-region-keys-manage.html#multi-region-rotate),
    // set the property on the primary key.
    //
    // Specify the key ID or key ARN of the KMS key.
    //
    // For example:
    //
    //    * Key ID: 1234abcd-12ab-34cd-56ef-1234567890ab
    //
    //    * Key ARN: arn:aws:kms:us-east-2:111122223333:key/1234abcd-12ab-34cd-56ef-1234567890ab
    //
    // To get the key ID and key ARN for a KMS key, use ListKeys or DescribeKey.
    //
    // KeyId is a required field
    KeyId *string `min:"1" type:"string" required:"true"`

    // Use this parameter to specify a custom period of time between each rotation
    // date. If no value is specified, the default value is 365 days.
    //
    // The rotation period defines the number of days after you enable automatic
    // key rotation that KMS will rotate your key material, and the number of days
    // between each automatic rotation thereafter.
    //
    // You can use the kms:RotationPeriodInDays (https://docs.aws.amazon.com/kms/latest/developerguide/conditions-kms.html#conditions-kms-rotation-period-in-days)
    // condition key to further constrain the values that principals can specify
    // in the RotationPeriodInDays parameter.
    RotationPeriodInDays *int64 `min:"90" type:"integer"`
    // contains filtered or unexported fields
}

func (EnableKeyRotationInput) GoString

func (s EnableKeyRotationInput) GoString() string

GoString returns the string representation.

API parameter values that are decorated as "sensitive" in the API will not be included in the string output. The member name will be present, but the value will be replaced with "sensitive".

func (*EnableKeyRotationInput) SetKeyId

func (s *EnableKeyRotationInput) SetKeyId(v string) *EnableKeyRotationInput

SetKeyId sets the KeyId field's value.

func (*EnableKeyRotationInput) SetRotationPeriodInDays

func (s *EnableKeyRotationInput) SetRotationPeriodInDays(v int64) *EnableKeyRotationInput

SetRotationPeriodInDays sets the RotationPeriodInDays field's value.

func (EnableKeyRotationInput) String

func (s EnableKeyRotationInput) String() string

String returns the string representation.

API parameter values that are decorated as "sensitive" in the API will not be included in the string output. The member name will be present, but the value will be replaced with "sensitive".

func (*EnableKeyRotationInput) Validate

func (s *EnableKeyRotationInput) Validate() error

Validate inspects the fields of the type to determine if they are valid.

type EnableKeyRotationOutput

type EnableKeyRotationOutput struct {
    // contains filtered or unexported fields
}

func (EnableKeyRotationOutput) GoString

func (s EnableKeyRotationOutput) GoString() string

GoString returns the string representation.

API parameter values that are decorated as "sensitive" in the API will not be included in the string output. The member name will be present, but the value will be replaced with "sensitive".

func (EnableKeyRotationOutput) String

func (s EnableKeyRotationOutput) String() string

String returns the string representation.

API parameter values that are decorated as "sensitive" in the API will not be included in the string output. The member name will be present, but the value will be replaced with "sensitive".

type EncryptInput

type EncryptInput struct {

    // Checks if your request will succeed. DryRun is an optional parameter.
    //
    // To learn more about how to use this parameter, see Testing your KMS API calls
    // (https://docs.aws.amazon.com/kms/latest/developerguide/programming-dryrun.html)
    // in the Key Management Service Developer Guide.
    DryRun *bool `type:"boolean"`

    // Specifies the encryption algorithm that KMS will use to encrypt the plaintext
    // message. The algorithm must be compatible with the KMS key that you specify.
    //
    // This parameter is required only for asymmetric KMS keys. The default value,
    // SYMMETRIC_DEFAULT, is the algorithm used for symmetric encryption KMS keys.
    // If you are using an asymmetric KMS key, we recommend RSAES_OAEP_SHA_256.
    //
    // The SM2PKE algorithm is only available in China Regions.
    EncryptionAlgorithm *string `type:"string" enum:"EncryptionAlgorithmSpec"`

    // Specifies the encryption context that will be used to encrypt the data. An
    // encryption context is valid only for cryptographic operations (https://docs.aws.amazon.com/kms/latest/developerguide/concepts.html#cryptographic-operations)
    // with a symmetric encryption KMS key. The standard asymmetric encryption algorithms
    // and HMAC algorithms that KMS uses do not support an encryption context.
    //
    // Do not include confidential or sensitive information in this field. This
    // field may be displayed in plaintext in CloudTrail logs and other output.
    //
    // An encryption context is a collection of non-secret key-value pairs that
    // represent additional authenticated data. When you use an encryption context
    // to encrypt data, you must specify the same (an exact case-sensitive match)
    // encryption context to decrypt the data. An encryption context is supported
    // only on operations with symmetric encryption KMS keys. On operations with
    // symmetric encryption KMS keys, an encryption context is optional, but it
    // is strongly recommended.
    //
    // For more information, see Encryption context (https://docs.aws.amazon.com/kms/latest/developerguide/concepts.html#encrypt_context)
    // in the Key Management Service Developer Guide.
    EncryptionContext map[string]*string `type:"map"`

    // A list of grant tokens.
    //
    // Use a grant token when your permission to call this operation comes from
    // a new grant that has not yet achieved eventual consistency. For more information,
    // see Grant token (https://docs.aws.amazon.com/kms/latest/developerguide/grants.html#grant_token)
    // and Using a grant token (https://docs.aws.amazon.com/kms/latest/developerguide/grant-manage.html#using-grant-token)
    // in the Key Management Service Developer Guide.
    GrantTokens []*string `type:"list"`

    // Identifies the KMS key to use in the encryption operation. The KMS key must
    // have a KeyUsage of ENCRYPT_DECRYPT. To find the KeyUsage of a KMS key, use
    // the DescribeKey operation.
    //
    // To specify a KMS key, use its key ID, key ARN, alias name, or alias ARN.
    // When using an alias name, prefix it with "alias/". To specify a KMS key in
    // a different Amazon Web Services account, you must use the key ARN or alias
    // ARN.
    //
    // For example:
    //
    //    * Key ID: 1234abcd-12ab-34cd-56ef-1234567890ab
    //
    //    * Key ARN: arn:aws:kms:us-east-2:111122223333:key/1234abcd-12ab-34cd-56ef-1234567890ab
    //
    //    * Alias name: alias/ExampleAlias
    //
    //    * Alias ARN: arn:aws:kms:us-east-2:111122223333:alias/ExampleAlias
    //
    // To get the key ID and key ARN for a KMS key, use ListKeys or DescribeKey.
    // To get the alias name and alias ARN, use ListAliases.
    //
    // KeyId is a required field
    KeyId *string `min:"1" type:"string" required:"true"`

    // Data to be encrypted.
    //
    // Plaintext is a sensitive parameter and its value will be
    // replaced with "sensitive" in string returned by EncryptInput's
    // String and GoString methods.
    //
    // Plaintext is automatically base64 encoded/decoded by the SDK.
    //
    // Plaintext is a required field
    Plaintext []byte `min:"1" type:"blob" required:"true" sensitive:"true"`
    // contains filtered or unexported fields
}

func (EncryptInput) GoString

func (s EncryptInput) GoString() string

GoString returns the string representation.

API parameter values that are decorated as "sensitive" in the API will not be included in the string output. The member name will be present, but the value will be replaced with "sensitive".

func (*EncryptInput) SetDryRun

func (s *EncryptInput) SetDryRun(v bool) *EncryptInput

SetDryRun sets the DryRun field's value.

func (*EncryptInput) SetEncryptionAlgorithm

func (s *EncryptInput) SetEncryptionAlgorithm(v string) *EncryptInput

SetEncryptionAlgorithm sets the EncryptionAlgorithm field's value.

func (*EncryptInput) SetEncryptionContext

func (s *EncryptInput) SetEncryptionContext(v map[string]*string) *EncryptInput

SetEncryptionContext sets the EncryptionContext field's value.

func (*EncryptInput) SetGrantTokens

func (s *EncryptInput) SetGrantTokens(v []*string) *EncryptInput

SetGrantTokens sets the GrantTokens field's value.

func (*EncryptInput) SetKeyId

func (s *EncryptInput) SetKeyId(v string) *EncryptInput

SetKeyId sets the KeyId field's value.

func (*EncryptInput) SetPlaintext

func (s *EncryptInput) SetPlaintext(v []byte) *EncryptInput

SetPlaintext sets the Plaintext field's value.

func (EncryptInput) String

func (s EncryptInput) String() string

String returns the string representation.

API parameter values that are decorated as "sensitive" in the API will not be included in the string output. The member name will be present, but the value will be replaced with "sensitive".

func (*EncryptInput) Validate

func (s *EncryptInput) Validate() error

Validate inspects the fields of the type to determine if they are valid.

type EncryptOutput

type EncryptOutput struct {

    // The encrypted plaintext. When you use the HTTP API or the Amazon Web Services
    // CLI, the value is Base64-encoded. Otherwise, it is not Base64-encoded.
    // CiphertextBlob is automatically base64 encoded/decoded by the SDK.
    CiphertextBlob []byte `min:"1" type:"blob"`

    // The encryption algorithm that was used to encrypt the plaintext.
    EncryptionAlgorithm *string `type:"string" enum:"EncryptionAlgorithmSpec"`

    // The Amazon Resource Name (key ARN (https://docs.aws.amazon.com/kms/latest/developerguide/concepts.html#key-id-key-ARN))
    // of the KMS key that was used to encrypt the plaintext.
    KeyId *string `min:"1" type:"string"`
    // contains filtered or unexported fields
}

func (EncryptOutput) GoString

func (s EncryptOutput) GoString() string

GoString returns the string representation.

API parameter values that are decorated as "sensitive" in the API will not be included in the string output. The member name will be present, but the value will be replaced with "sensitive".

func (*EncryptOutput) SetCiphertextBlob

func (s *EncryptOutput) SetCiphertextBlob(v []byte) *EncryptOutput

SetCiphertextBlob sets the CiphertextBlob field's value.

func (*EncryptOutput) SetEncryptionAlgorithm

func (s *EncryptOutput) SetEncryptionAlgorithm(v string) *EncryptOutput

SetEncryptionAlgorithm sets the EncryptionAlgorithm field's value.

func (*EncryptOutput) SetKeyId

func (s *EncryptOutput) SetKeyId(v string) *EncryptOutput

SetKeyId sets the KeyId field's value.

func (EncryptOutput) String

func (s EncryptOutput) String() string

String returns the string representation.

API parameter values that are decorated as "sensitive" in the API will not be included in the string output. The member name will be present, but the value will be replaced with "sensitive".

type ExpiredImportTokenException

type ExpiredImportTokenException struct {
    RespMetadata protocol.ResponseMetadata `json:"-" xml:"-"`

    Message_ *string `locationName:"message" type:"string"`
    // contains filtered or unexported fields
}

The request was rejected because the specified import token is expired. Use GetParametersForImport to get a new import token and public key, use the new public key to encrypt the key material, and then try the request again.

func (*ExpiredImportTokenException) Code

func (s *ExpiredImportTokenException) Code() string

Code returns the exception type name.

func (*ExpiredImportTokenException) Error

func (s *ExpiredImportTokenException) Error() string

func (ExpiredImportTokenException) GoString

func (s ExpiredImportTokenException) GoString() string

GoString returns the string representation.

API parameter values that are decorated as "sensitive" in the API will not be included in the string output. The member name will be present, but the value will be replaced with "sensitive".

func (*ExpiredImportTokenException) Message

func (s *ExpiredImportTokenException) Message() string

Message returns the exception's message.

func (*ExpiredImportTokenException) OrigErr

func (s *ExpiredImportTokenException) OrigErr() error

OrigErr always returns nil, satisfies awserr.Error interface.

func (*ExpiredImportTokenException) RequestID

func (s *ExpiredImportTokenException) RequestID() string

RequestID returns the service's response RequestID for request.

func (*ExpiredImportTokenException) StatusCode

func (s *ExpiredImportTokenException) StatusCode() int

Status code returns the HTTP status code for the request's response error.

func (ExpiredImportTokenException) String

func (s ExpiredImportTokenException) String() string

String returns the string representation.

API parameter values that are decorated as "sensitive" in the API will not be included in the string output. The member name will be present, but the value will be replaced with "sensitive".

type GenerateDataKeyInput

type GenerateDataKeyInput struct {

    // Checks if your request will succeed. DryRun is an optional parameter.
    //
    // To learn more about how to use this parameter, see Testing your KMS API calls
    // (https://docs.aws.amazon.com/kms/latest/developerguide/programming-dryrun.html)
    // in the Key Management Service Developer Guide.
    DryRun *bool `type:"boolean"`

    // Specifies the encryption context that will be used when encrypting the data
    // key.
    //
    // Do not include confidential or sensitive information in this field. This
    // field may be displayed in plaintext in CloudTrail logs and other output.
    //
    // An encryption context is a collection of non-secret key-value pairs that
    // represent additional authenticated data. When you use an encryption context
    // to encrypt data, you must specify the same (an exact case-sensitive match)
    // encryption context to decrypt the data. An encryption context is supported
    // only on operations with symmetric encryption KMS keys. On operations with
    // symmetric encryption KMS keys, an encryption context is optional, but it
    // is strongly recommended.
    //
    // For more information, see Encryption context (https://docs.aws.amazon.com/kms/latest/developerguide/concepts.html#encrypt_context)
    // in the Key Management Service Developer Guide.
    EncryptionContext map[string]*string `type:"map"`

    // A list of grant tokens.
    //
    // Use a grant token when your permission to call this operation comes from
    // a new grant that has not yet achieved eventual consistency. For more information,
    // see Grant token (https://docs.aws.amazon.com/kms/latest/developerguide/grants.html#grant_token)
    // and Using a grant token (https://docs.aws.amazon.com/kms/latest/developerguide/grant-manage.html#using-grant-token)
    // in the Key Management Service Developer Guide.
    GrantTokens []*string `type:"list"`

    // Specifies the symmetric encryption KMS key that encrypts the data key. You
    // cannot specify an asymmetric KMS key or a KMS key in a custom key store.
    // To get the type and origin of your KMS key, use the DescribeKey operation.
    //
    // To specify a KMS key, use its key ID, key ARN, alias name, or alias ARN.
    // When using an alias name, prefix it with "alias/". To specify a KMS key in
    // a different Amazon Web Services account, you must use the key ARN or alias
    // ARN.
    //
    // For example:
    //
    //    * Key ID: 1234abcd-12ab-34cd-56ef-1234567890ab
    //
    //    * Key ARN: arn:aws:kms:us-east-2:111122223333:key/1234abcd-12ab-34cd-56ef-1234567890ab
    //
    //    * Alias name: alias/ExampleAlias
    //
    //    * Alias ARN: arn:aws:kms:us-east-2:111122223333:alias/ExampleAlias
    //
    // To get the key ID and key ARN for a KMS key, use ListKeys or DescribeKey.
    // To get the alias name and alias ARN, use ListAliases.
    //
    // KeyId is a required field
    KeyId *string `min:"1" type:"string" required:"true"`

    // Specifies the length of the data key. Use AES_128 to generate a 128-bit symmetric
    // key, or AES_256 to generate a 256-bit symmetric key.
    //
    // You must specify either the KeySpec or the NumberOfBytes parameter (but not
    // both) in every GenerateDataKey request.
    KeySpec *string `type:"string" enum:"DataKeySpec"`

    // Specifies the length of the data key in bytes. For example, use the value
    // 64 to generate a 512-bit data key (64 bytes is 512 bits). For 128-bit (16-byte)
    // and 256-bit (32-byte) data keys, use the KeySpec parameter.
    //
    // You must specify either the KeySpec or the NumberOfBytes parameter (but not
    // both) in every GenerateDataKey request.
    NumberOfBytes *int64 `min:"1" type:"integer"`

    // A signed attestation document (https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/nitro-enclave-how.html#term-attestdoc)
    // from an Amazon Web Services Nitro enclave and the encryption algorithm to
    // use with the enclave's public key. The only valid encryption algorithm is
    // RSAES_OAEP_SHA_256.
    //
    // This parameter only supports attestation documents for Amazon Web Services
    // Nitro Enclaves. To include this parameter, use the Amazon Web Services Nitro
    // Enclaves SDK (https://docs.aws.amazon.com/enclaves/latest/user/developing-applications.html#sdk)
    // or any Amazon Web Services SDK.
    //
    // When you use this parameter, instead of returning the plaintext data key,
    // KMS encrypts the plaintext data key under the public key in the attestation
    // document, and returns the resulting ciphertext in the CiphertextForRecipient
    // field in the response. This ciphertext can be decrypted only with the private
    // key in the enclave. The CiphertextBlob field in the response contains a copy
    // of the data key encrypted under the KMS key specified by the KeyId parameter.
    // The Plaintext field in the response is null or empty.
    //
    // For information about the interaction between KMS and Amazon Web Services
    // Nitro Enclaves, see How Amazon Web Services Nitro Enclaves uses KMS (https://docs.aws.amazon.com/kms/latest/developerguide/services-nitro-enclaves.html)
    // in the Key Management Service Developer Guide.
    Recipient *RecipientInfo `type:"structure"`
    // contains filtered or unexported fields
}

func (GenerateDataKeyInput) GoString

func (s GenerateDataKeyInput) GoString() string

GoString returns the string representation.

API parameter values that are decorated as "sensitive" in the API will not be included in the string output. The member name will be present, but the value will be replaced with "sensitive".

func (*GenerateDataKeyInput) SetDryRun

func (s *GenerateDataKeyInput) SetDryRun(v bool) *GenerateDataKeyInput

SetDryRun sets the DryRun field's value.

func (*GenerateDataKeyInput) SetEncryptionContext

func (s *GenerateDataKeyInput) SetEncryptionContext(v map[string]*string) *GenerateDataKeyInput

SetEncryptionContext sets the EncryptionContext field's value.

func (*GenerateDataKeyInput) SetGrantTokens

func (s *GenerateDataKeyInput) SetGrantTokens(v []*string) *GenerateDataKeyInput

SetGrantTokens sets the GrantTokens field's value.

func (*GenerateDataKeyInput) SetKeyId

func (s *GenerateDataKeyInput) SetKeyId(v string) *GenerateDataKeyInput

SetKeyId sets the KeyId field's value.

func (*GenerateDataKeyInput) SetKeySpec

func (s *GenerateDataKeyInput) SetKeySpec(v string) *GenerateDataKeyInput

SetKeySpec sets the KeySpec field's value.

func (*GenerateDataKeyInput) SetNumberOfBytes

func (s *GenerateDataKeyInput) SetNumberOfBytes(v int64) *GenerateDataKeyInput

SetNumberOfBytes sets the NumberOfBytes field's value.

func (*GenerateDataKeyInput) SetRecipient

func (s *GenerateDataKeyInput) SetRecipient(v *RecipientInfo) *GenerateDataKeyInput

SetRecipient sets the Recipient field's value.

func (GenerateDataKeyInput) String

func (s GenerateDataKeyInput) String() string

String returns the string representation.

API parameter values that are decorated as "sensitive" in the API will not be included in the string output. The member name will be present, but the value will be replaced with "sensitive".

func (*GenerateDataKeyInput) Validate

func (s *GenerateDataKeyInput) Validate() error

Validate inspects the fields of the type to determine if they are valid.

type GenerateDataKeyOutput

type GenerateDataKeyOutput struct {

    // The encrypted copy of the data key. When you use the HTTP API or the Amazon
    // Web Services CLI, the value is Base64-encoded. Otherwise, it is not Base64-encoded.
    // CiphertextBlob is automatically base64 encoded/decoded by the SDK.
    CiphertextBlob []byte `min:"1" type:"blob"`

    // The plaintext data key encrypted with the public key from the Nitro enclave.
    // This ciphertext can be decrypted only by using a private key in the Nitro
    // enclave.
    //
    // This field is included in the response only when the Recipient parameter
    // in the request includes a valid attestation document from an Amazon Web Services
    // Nitro enclave. For information about the interaction between KMS and Amazon
    // Web Services Nitro Enclaves, see How Amazon Web Services Nitro Enclaves uses
    // KMS (https://docs.aws.amazon.com/kms/latest/developerguide/services-nitro-enclaves.html)
    // in the Key Management Service Developer Guide.
    // CiphertextForRecipient is automatically base64 encoded/decoded by the SDK.
    CiphertextForRecipient []byte `min:"1" type:"blob"`

    // The Amazon Resource Name (key ARN (https://docs.aws.amazon.com/kms/latest/developerguide/concepts.html#key-id-key-ARN))
    // of the KMS key that encrypted the data key.
    KeyId *string `min:"1" type:"string"`

    // The plaintext data key. When you use the HTTP API or the Amazon Web Services
    // CLI, the value is Base64-encoded. Otherwise, it is not Base64-encoded. Use
    // this data key to encrypt your data outside of KMS. Then, remove it from memory
    // as soon as possible.
    //
    // If the response includes the CiphertextForRecipient field, the Plaintext
    // field is null or empty.
    //
    // Plaintext is a sensitive parameter and its value will be
    // replaced with "sensitive" in string returned by GenerateDataKeyOutput's
    // String and GoString methods.
    //
    // Plaintext is automatically base64 encoded/decoded by the SDK.
    Plaintext []byte `min:"1" type:"blob" sensitive:"true"`
    // contains filtered or unexported fields
}

func (GenerateDataKeyOutput) GoString

func (s GenerateDataKeyOutput) GoString() string

GoString returns the string representation.

API parameter values that are decorated as "sensitive" in the API will not be included in the string output. The member name will be present, but the value will be replaced with "sensitive".

func (*GenerateDataKeyOutput) SetCiphertextBlob

func (s *GenerateDataKeyOutput) SetCiphertextBlob(v []byte) *GenerateDataKeyOutput

SetCiphertextBlob sets the CiphertextBlob field's value.

func (*GenerateDataKeyOutput) SetCiphertextForRecipient

func (s *GenerateDataKeyOutput) SetCiphertextForRecipient(v []byte) *GenerateDataKeyOutput

SetCiphertextForRecipient sets the CiphertextForRecipient field's value.

func (*GenerateDataKeyOutput) SetKeyId

func (s *GenerateDataKeyOutput) SetKeyId(v string) *GenerateDataKeyOutput

SetKeyId sets the KeyId field's value.

func (*GenerateDataKeyOutput) SetPlaintext

func (s *GenerateDataKeyOutput) SetPlaintext(v []byte) *GenerateDataKeyOutput

SetPlaintext sets the Plaintext field's value.

func (GenerateDataKeyOutput) String

func (s GenerateDataKeyOutput) String() string

String returns the string representation.

API parameter values that are decorated as "sensitive" in the API will not be included in the string output. The member name will be present, but the value will be replaced with "sensitive".

type GenerateDataKeyPairInput

type GenerateDataKeyPairInput struct {

    // Checks if your request will succeed. DryRun is an optional parameter.
    //
    // To learn more about how to use this parameter, see Testing your KMS API calls
    // (https://docs.aws.amazon.com/kms/latest/developerguide/programming-dryrun.html)
    // in the Key Management Service Developer Guide.
    DryRun *bool `type:"boolean"`

    // Specifies the encryption context that will be used when encrypting the private
    // key in the data key pair.
    //
    // Do not include confidential or sensitive information in this field. This
    // field may be displayed in plaintext in CloudTrail logs and other output.
    //
    // An encryption context is a collection of non-secret key-value pairs that
    // represent additional authenticated data. When you use an encryption context
    // to encrypt data, you must specify the same (an exact case-sensitive match)
    // encryption context to decrypt the data. An encryption context is supported
    // only on operations with symmetric encryption KMS keys. On operations with
    // symmetric encryption KMS keys, an encryption context is optional, but it
    // is strongly recommended.
    //
    // For more information, see Encryption context (https://docs.aws.amazon.com/kms/latest/developerguide/concepts.html#encrypt_context)
    // in the Key Management Service Developer Guide.
    EncryptionContext map[string]*string `type:"map"`

    // A list of grant tokens.
    //
    // Use a grant token when your permission to call this operation comes from
    // a new grant that has not yet achieved eventual consistency. For more information,
    // see Grant token (https://docs.aws.amazon.com/kms/latest/developerguide/grants.html#grant_token)
    // and Using a grant token (https://docs.aws.amazon.com/kms/latest/developerguide/grant-manage.html#using-grant-token)
    // in the Key Management Service Developer Guide.
    GrantTokens []*string `type:"list"`

    // Specifies the symmetric encryption KMS key that encrypts the private key
    // in the data key pair. You cannot specify an asymmetric KMS key or a KMS key
    // in a custom key store. To get the type and origin of your KMS key, use the
    // DescribeKey operation.
    //
    // To specify a KMS key, use its key ID, key ARN, alias name, or alias ARN.
    // When using an alias name, prefix it with "alias/". To specify a KMS key in
    // a different Amazon Web Services account, you must use the key ARN or alias
    // ARN.
    //
    // For example:
    //
    //    * Key ID: 1234abcd-12ab-34cd-56ef-1234567890ab
    //
    //    * Key ARN: arn:aws:kms:us-east-2:111122223333:key/1234abcd-12ab-34cd-56ef-1234567890ab
    //
    //    * Alias name: alias/ExampleAlias
    //
    //    * Alias ARN: arn:aws:kms:us-east-2:111122223333:alias/ExampleAlias
    //
    // To get the key ID and key ARN for a KMS key, use ListKeys or DescribeKey.
    // To get the alias name and alias ARN, use ListAliases.
    //
    // KeyId is a required field
    KeyId *string `min:"1" type:"string" required:"true"`

    // Determines the type of data key pair that is generated.
    //
    // The KMS rule that restricts the use of asymmetric RSA and SM2 KMS keys to
    // encrypt and decrypt or to sign and verify (but not both), and the rule that
    // permits you to use ECC KMS keys only to sign and verify, are not effective
    // on data key pairs, which are used outside of KMS. The SM2 key spec is only
    // available in China Regions.
    //
    // KeyPairSpec is a required field
    KeyPairSpec *string `type:"string" required:"true" enum:"DataKeyPairSpec"`

    // A signed attestation document (https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/nitro-enclave-how.html#term-attestdoc)
    // from an Amazon Web Services Nitro enclave and the encryption algorithm to
    // use with the enclave's public key. The only valid encryption algorithm is
    // RSAES_OAEP_SHA_256.
    //
    // This parameter only supports attestation documents for Amazon Web Services
    // Nitro Enclaves. To call DeriveSharedSecret for an Amazon Web Services Nitro
    // Enclaves, use the Amazon Web Services Nitro Enclaves SDK (https://docs.aws.amazon.com/enclaves/latest/user/developing-applications.html#sdk)
    // to generate the attestation document and then use the Recipient parameter
    // from any Amazon Web Services SDK to provide the attestation document for
    // the enclave.
    //
    // When you use this parameter, instead of returning a plaintext copy of the
    // private data key, KMS encrypts the plaintext private data key under the public
    // key in the attestation document, and returns the resulting ciphertext in
    // the CiphertextForRecipient field in the response. This ciphertext can be
    // decrypted only with the private key in the enclave. The CiphertextBlob field
    // in the response contains a copy of the private data key encrypted under the
    // KMS key specified by the KeyId parameter. The PrivateKeyPlaintext field in
    // the response is null or empty.
    //
    // For information about the interaction between KMS and Amazon Web Services
    // Nitro Enclaves, see How Amazon Web Services Nitro Enclaves uses KMS (https://docs.aws.amazon.com/kms/latest/developerguide/services-nitro-enclaves.html)
    // in the Key Management Service Developer Guide.
    Recipient *RecipientInfo `type:"structure"`
    // contains filtered or unexported fields
}

func (GenerateDataKeyPairInput) GoString

func (s GenerateDataKeyPairInput) GoString() string

GoString returns the string representation.

API parameter values that are decorated as "sensitive" in the API will not be included in the string output. The member name will be present, but the value will be replaced with "sensitive".

func (*GenerateDataKeyPairInput) SetDryRun

func (s *GenerateDataKeyPairInput) SetDryRun(v bool) *GenerateDataKeyPairInput

SetDryRun sets the DryRun field's value.

func (*GenerateDataKeyPairInput) SetEncryptionContext

func (s *GenerateDataKeyPairInput) SetEncryptionContext(v map[string]*string) *GenerateDataKeyPairInput

SetEncryptionContext sets the EncryptionContext field's value.

func (*GenerateDataKeyPairInput) SetGrantTokens

func (s *GenerateDataKeyPairInput) SetGrantTokens(v []*string) *GenerateDataKeyPairInput

SetGrantTokens sets the GrantTokens field's value.

func (*GenerateDataKeyPairInput) SetKeyId

func (s *GenerateDataKeyPairInput) SetKeyId(v string) *GenerateDataKeyPairInput

SetKeyId sets the KeyId field's value.

func (*GenerateDataKeyPairInput) SetKeyPairSpec

func (s *GenerateDataKeyPairInput) SetKeyPairSpec(v string) *GenerateDataKeyPairInput

SetKeyPairSpec sets the KeyPairSpec field's value.

func (*GenerateDataKeyPairInput) SetRecipient

func (s *GenerateDataKeyPairInput) SetRecipient(v *RecipientInfo) *GenerateDataKeyPairInput

SetRecipient sets the Recipient field's value.

func (GenerateDataKeyPairInput) String

func (s GenerateDataKeyPairInput) String() string

String returns the string representation.

API parameter values that are decorated as "sensitive" in the API will not be included in the string output. The member name will be present, but the value will be replaced with "sensitive".

func (*GenerateDataKeyPairInput) Validate

func (s *GenerateDataKeyPairInput) Validate() error

Validate inspects the fields of the type to determine if they are valid.

type GenerateDataKeyPairOutput

type GenerateDataKeyPairOutput struct {

    // The plaintext private data key encrypted with the public key from the Nitro
    // enclave. This ciphertext can be decrypted only by using a private key in
    // the Nitro enclave.
    //
    // This field is included in the response only when the Recipient parameter
    // in the request includes a valid attestation document from an Amazon Web Services
    // Nitro enclave. For information about the interaction between KMS and Amazon
    // Web Services Nitro Enclaves, see How Amazon Web Services Nitro Enclaves uses
    // KMS (https://docs.aws.amazon.com/kms/latest/developerguide/services-nitro-enclaves.html)
    // in the Key Management Service Developer Guide.
    // CiphertextForRecipient is automatically base64 encoded/decoded by the SDK.
    CiphertextForRecipient []byte `min:"1" type:"blob"`

    // The Amazon Resource Name (key ARN (https://docs.aws.amazon.com/kms/latest/developerguide/concepts.html#key-id-key-ARN))
    // of the KMS key that encrypted the private key.
    KeyId *string `min:"1" type:"string"`

    // The type of data key pair that was generated.
    KeyPairSpec *string `type:"string" enum:"DataKeyPairSpec"`

    // The encrypted copy of the private key. When you use the HTTP API or the Amazon
    // Web Services CLI, the value is Base64-encoded. Otherwise, it is not Base64-encoded.
    // PrivateKeyCiphertextBlob is automatically base64 encoded/decoded by the SDK.
    PrivateKeyCiphertextBlob []byte `min:"1" type:"blob"`

    // The plaintext copy of the private key. When you use the HTTP API or the Amazon
    // Web Services CLI, the value is Base64-encoded. Otherwise, it is not Base64-encoded.
    //
    // If the response includes the CiphertextForRecipient field, the PrivateKeyPlaintext
    // field is null or empty.
    //
    // PrivateKeyPlaintext is a sensitive parameter and its value will be
    // replaced with "sensitive" in string returned by GenerateDataKeyPairOutput's
    // String and GoString methods.
    //
    // PrivateKeyPlaintext is automatically base64 encoded/decoded by the SDK.
    PrivateKeyPlaintext []byte `min:"1" type:"blob" sensitive:"true"`

    // The public key (in plaintext). When you use the HTTP API or the Amazon Web
    // Services CLI, the value is Base64-encoded. Otherwise, it is not Base64-encoded.
    // PublicKey is automatically base64 encoded/decoded by the SDK.
    PublicKey []byte `min:"1" type:"blob"`
    // contains filtered or unexported fields
}

func (GenerateDataKeyPairOutput) GoString

func (s GenerateDataKeyPairOutput) GoString() string

GoString returns the string representation.

API parameter values that are decorated as "sensitive" in the API will not be included in the string output. The member name will be present, but the value will be replaced with "sensitive".

func (*GenerateDataKeyPairOutput) SetCiphertextForRecipient

func (s *GenerateDataKeyPairOutput) SetCiphertextForRecipient(v []byte) *GenerateDataKeyPairOutput

SetCiphertextForRecipient sets the CiphertextForRecipient field's value.

func (*GenerateDataKeyPairOutput) SetKeyId

func (s *GenerateDataKeyPairOutput) SetKeyId(v string) *GenerateDataKeyPairOutput

SetKeyId sets the KeyId field's value.

func (*GenerateDataKeyPairOutput) SetKeyPairSpec

func (s *GenerateDataKeyPairOutput) SetKeyPairSpec(v string) *GenerateDataKeyPairOutput

SetKeyPairSpec sets the KeyPairSpec field's value.

func (*GenerateDataKeyPairOutput) SetPrivateKeyCiphertextBlob

func (s *GenerateDataKeyPairOutput) SetPrivateKeyCiphertextBlob(v []byte) *GenerateDataKeyPairOutput

SetPrivateKeyCiphertextBlob sets the PrivateKeyCiphertextBlob field's value.

func (*GenerateDataKeyPairOutput) SetPrivateKeyPlaintext

func (s *GenerateDataKeyPairOutput) SetPrivateKeyPlaintext(v []byte) *GenerateDataKeyPairOutput

SetPrivateKeyPlaintext sets the PrivateKeyPlaintext field's value.

func (*GenerateDataKeyPairOutput) SetPublicKey

func (s *GenerateDataKeyPairOutput) SetPublicKey(v []byte) *GenerateDataKeyPairOutput

SetPublicKey sets the PublicKey field's value.

func (GenerateDataKeyPairOutput) String

func (s GenerateDataKeyPairOutput) String() string

String returns the string representation.

API parameter values that are decorated as "sensitive" in the API will not be included in the string output. The member name will be present, but the value will be replaced with "sensitive".

type GenerateDataKeyPairWithoutPlaintextInput

type GenerateDataKeyPairWithoutPlaintextInput struct {

    // Checks if your request will succeed. DryRun is an optional parameter.
    //
    // To learn more about how to use this parameter, see Testing your KMS API calls
    // (https://docs.aws.amazon.com/kms/latest/developerguide/programming-dryrun.html)
    // in the Key Management Service Developer Guide.
    DryRun *bool `type:"boolean"`

    // Specifies the encryption context that will be used when encrypting the private
    // key in the data key pair.
    //
    // Do not include confidential or sensitive information in this field. This
    // field may be displayed in plaintext in CloudTrail logs and other output.
    //
    // An encryption context is a collection of non-secret key-value pairs that
    // represent additional authenticated data. When you use an encryption context
    // to encrypt data, you must specify the same (an exact case-sensitive match)
    // encryption context to decrypt the data. An encryption context is supported
    // only on operations with symmetric encryption KMS keys. On operations with
    // symmetric encryption KMS keys, an encryption context is optional, but it
    // is strongly recommended.
    //
    // For more information, see Encryption context (https://docs.aws.amazon.com/kms/latest/developerguide/concepts.html#encrypt_context)
    // in the Key Management Service Developer Guide.
    EncryptionContext map[string]*string `type:"map"`

    // A list of grant tokens.
    //
    // Use a grant token when your permission to call this operation comes from
    // a new grant that has not yet achieved eventual consistency. For more information,
    // see Grant token (https://docs.aws.amazon.com/kms/latest/developerguide/grants.html#grant_token)
    // and Using a grant token (https://docs.aws.amazon.com/kms/latest/developerguide/grant-manage.html#using-grant-token)
    // in the Key Management Service Developer Guide.
    GrantTokens []*string `type:"list"`

    // Specifies the symmetric encryption KMS key that encrypts the private key
    // in the data key pair. You cannot specify an asymmetric KMS key or a KMS key
    // in a custom key store. To get the type and origin of your KMS key, use the
    // DescribeKey operation.
    //
    // To specify a KMS key, use its key ID, key ARN, alias name, or alias ARN.
    // When using an alias name, prefix it with "alias/". To specify a KMS key in
    // a different Amazon Web Services account, you must use the key ARN or alias
    // ARN.
    //
    // For example:
    //
    //    * Key ID: 1234abcd-12ab-34cd-56ef-1234567890ab
    //
    //    * Key ARN: arn:aws:kms:us-east-2:111122223333:key/1234abcd-12ab-34cd-56ef-1234567890ab
    //
    //    * Alias name: alias/ExampleAlias
    //
    //    * Alias ARN: arn:aws:kms:us-east-2:111122223333:alias/ExampleAlias
    //
    // To get the key ID and key ARN for a KMS key, use ListKeys or DescribeKey.
    // To get the alias name and alias ARN, use ListAliases.
    //
    // KeyId is a required field
    KeyId *string `min:"1" type:"string" required:"true"`

    // Determines the type of data key pair that is generated.
    //
    // The KMS rule that restricts the use of asymmetric RSA and SM2 KMS keys to
    // encrypt and decrypt or to sign and verify (but not both), and the rule that
    // permits you to use ECC KMS keys only to sign and verify, are not effective
    // on data key pairs, which are used outside of KMS. The SM2 key spec is only
    // available in China Regions.
    //
    // KeyPairSpec is a required field
    KeyPairSpec *string `type:"string" required:"true" enum:"DataKeyPairSpec"`
    // contains filtered or unexported fields
}

func (GenerateDataKeyPairWithoutPlaintextInput) GoString

func (s GenerateDataKeyPairWithoutPlaintextInput) GoString() string

GoString returns the string representation.

API parameter values that are decorated as "sensitive" in the API will not be included in the string output. The member name will be present, but the value will be replaced with "sensitive".

func (*GenerateDataKeyPairWithoutPlaintextInput) SetDryRun

func (s *GenerateDataKeyPairWithoutPlaintextInput) SetDryRun(v bool) *GenerateDataKeyPairWithoutPlaintextInput

SetDryRun sets the DryRun field's value.

func (*GenerateDataKeyPairWithoutPlaintextInput) SetEncryptionContext

func (s *GenerateDataKeyPairWithoutPlaintextInput) SetEncryptionContext(v map[string]*string) *GenerateDataKeyPairWithoutPlaintextInput

SetEncryptionContext sets the EncryptionContext field's value.

func (*GenerateDataKeyPairWithoutPlaintextInput) SetGrantTokens

func (s *GenerateDataKeyPairWithoutPlaintextInput) SetGrantTokens(v []*string) *GenerateDataKeyPairWithoutPlaintextInput

SetGrantTokens sets the GrantTokens field's value.

func (*GenerateDataKeyPairWithoutPlaintextInput) SetKeyId

func (s *GenerateDataKeyPairWithoutPlaintextInput) SetKeyId(v string) *GenerateDataKeyPairWithoutPlaintextInput

SetKeyId sets the KeyId field's value.

func (*GenerateDataKeyPairWithoutPlaintextInput) SetKeyPairSpec

func (s *GenerateDataKeyPairWithoutPlaintextInput) SetKeyPairSpec(v string) *GenerateDataKeyPairWithoutPlaintextInput

SetKeyPairSpec sets the KeyPairSpec field's value.

func (GenerateDataKeyPairWithoutPlaintextInput) String

func (s GenerateDataKeyPairWithoutPlaintextInput) String() string

String returns the string representation.

API parameter values that are decorated as "sensitive" in the API will not be included in the string output. The member name will be present, but the value will be replaced with "sensitive".

func (*GenerateDataKeyPairWithoutPlaintextInput) Validate

func (s *GenerateDataKeyPairWithoutPlaintextInput) Validate() error

Validate inspects the fields of the type to determine if they are valid.

type GenerateDataKeyPairWithoutPlaintextOutput

type GenerateDataKeyPairWithoutPlaintextOutput struct {

    // The Amazon Resource Name (key ARN (https://docs.aws.amazon.com/kms/latest/developerguide/concepts.html#key-id-key-ARN))
    // of the KMS key that encrypted the private key.
    KeyId *string `min:"1" type:"string"`

    // The type of data key pair that was generated.
    KeyPairSpec *string `type:"string" enum:"DataKeyPairSpec"`

    // The encrypted copy of the private key. When you use the HTTP API or the Amazon
    // Web Services CLI, the value is Base64-encoded. Otherwise, it is not Base64-encoded.
    // PrivateKeyCiphertextBlob is automatically base64 encoded/decoded by the SDK.
    PrivateKeyCiphertextBlob []byte `min:"1" type:"blob"`

    // The public key (in plaintext). When you use the HTTP API or the Amazon Web
    // Services CLI, the value is Base64-encoded. Otherwise, it is not Base64-encoded.
    // PublicKey is automatically base64 encoded/decoded by the SDK.
    PublicKey []byte `min:"1" type:"blob"`
    // contains filtered or unexported fields
}

func (GenerateDataKeyPairWithoutPlaintextOutput) GoString

func (s GenerateDataKeyPairWithoutPlaintextOutput) GoString() string

GoString returns the string representation.

API parameter values that are decorated as "sensitive" in the API will not be included in the string output. The member name will be present, but the value will be replaced with "sensitive".

func (*GenerateDataKeyPairWithoutPlaintextOutput) SetKeyId

func (s *GenerateDataKeyPairWithoutPlaintextOutput) SetKeyId(v string) *GenerateDataKeyPairWithoutPlaintextOutput

SetKeyId sets the KeyId field's value.

func (*GenerateDataKeyPairWithoutPlaintextOutput) SetKeyPairSpec

func (s *GenerateDataKeyPairWithoutPlaintextOutput) SetKeyPairSpec(v string) *GenerateDataKeyPairWithoutPlaintextOutput

SetKeyPairSpec sets the KeyPairSpec field's value.

func (*GenerateDataKeyPairWithoutPlaintextOutput) SetPrivateKeyCiphertextBlob

func (s *GenerateDataKeyPairWithoutPlaintextOutput) SetPrivateKeyCiphertextBlob(v []byte) *GenerateDataKeyPairWithoutPlaintextOutput

SetPrivateKeyCiphertextBlob sets the PrivateKeyCiphertextBlob field's value.

func (*GenerateDataKeyPairWithoutPlaintextOutput) SetPublicKey

func (s *GenerateDataKeyPairWithoutPlaintextOutput) SetPublicKey(v []byte) *GenerateDataKeyPairWithoutPlaintextOutput

SetPublicKey sets the PublicKey field's value.

func (GenerateDataKeyPairWithoutPlaintextOutput) String

func (s GenerateDataKeyPairWithoutPlaintextOutput) String() string

String returns the string representation.

API parameter values that are decorated as "sensitive" in the API will not be included in the string output. The member name will be present, but the value will be replaced with "sensitive".

type GenerateDataKeyWithoutPlaintextInput

type GenerateDataKeyWithoutPlaintextInput struct {

    // Checks if your request will succeed. DryRun is an optional parameter.
    //
    // To learn more about how to use this parameter, see Testing your KMS API calls
    // (https://docs.aws.amazon.com/kms/latest/developerguide/programming-dryrun.html)
    // in the Key Management Service Developer Guide.
    DryRun *bool `type:"boolean"`

    // Specifies the encryption context that will be used when encrypting the data
    // key.
    //
    // Do not include confidential or sensitive information in this field. This
    // field may be displayed in plaintext in CloudTrail logs and other output.
    //
    // An encryption context is a collection of non-secret key-value pairs that
    // represent additional authenticated data. When you use an encryption context
    // to encrypt data, you must specify the same (an exact case-sensitive match)
    // encryption context to decrypt the data. An encryption context is supported
    // only on operations with symmetric encryption KMS keys. On operations with
    // symmetric encryption KMS keys, an encryption context is optional, but it
    // is strongly recommended.
    //
    // For more information, see Encryption context (https://docs.aws.amazon.com/kms/latest/developerguide/concepts.html#encrypt_context)
    // in the Key Management Service Developer Guide.
    EncryptionContext map[string]*string `type:"map"`

    // A list of grant tokens.
    //
    // Use a grant token when your permission to call this operation comes from
    // a new grant that has not yet achieved eventual consistency. For more information,
    // see Grant token (https://docs.aws.amazon.com/kms/latest/developerguide/grants.html#grant_token)
    // and Using a grant token (https://docs.aws.amazon.com/kms/latest/developerguide/grant-manage.html#using-grant-token)
    // in the Key Management Service Developer Guide.
    GrantTokens []*string `type:"list"`

    // Specifies the symmetric encryption KMS key that encrypts the data key. You
    // cannot specify an asymmetric KMS key or a KMS key in a custom key store.
    // To get the type and origin of your KMS key, use the DescribeKey operation.
    //
    // To specify a KMS key, use its key ID, key ARN, alias name, or alias ARN.
    // When using an alias name, prefix it with "alias/". To specify a KMS key in
    // a different Amazon Web Services account, you must use the key ARN or alias
    // ARN.
    //
    // For example:
    //
    //    * Key ID: 1234abcd-12ab-34cd-56ef-1234567890ab
    //
    //    * Key ARN: arn:aws:kms:us-east-2:111122223333:key/1234abcd-12ab-34cd-56ef-1234567890ab
    //
    //    * Alias name: alias/ExampleAlias
    //
    //    * Alias ARN: arn:aws:kms:us-east-2:111122223333:alias/ExampleAlias
    //
    // To get the key ID and key ARN for a KMS key, use ListKeys or DescribeKey.
    // To get the alias name and alias ARN, use ListAliases.
    //
    // KeyId is a required field
    KeyId *string `min:"1" type:"string" required:"true"`

    // The length of the data key. Use AES_128 to generate a 128-bit symmetric key,
    // or AES_256 to generate a 256-bit symmetric key.
    KeySpec *string `type:"string" enum:"DataKeySpec"`

    // The length of the data key in bytes. For example, use the value 64 to generate
    // a 512-bit data key (64 bytes is 512 bits). For common key lengths (128-bit
    // and 256-bit symmetric keys), we recommend that you use the KeySpec field
    // instead of this one.
    NumberOfBytes *int64 `min:"1" type:"integer"`
    // contains filtered or unexported fields
}

func (GenerateDataKeyWithoutPlaintextInput) GoString

func (s GenerateDataKeyWithoutPlaintextInput) GoString() string

GoString returns the string representation.

API parameter values that are decorated as "sensitive" in the API will not be included in the string output. The member name will be present, but the value will be replaced with "sensitive".

func (*GenerateDataKeyWithoutPlaintextInput) SetDryRun

func (s *GenerateDataKeyWithoutPlaintextInput) SetDryRun(v bool) *GenerateDataKeyWithoutPlaintextInput

SetDryRun sets the DryRun field's value.

func (*GenerateDataKeyWithoutPlaintextInput) SetEncryptionContext

func (s *GenerateDataKeyWithoutPlaintextInput) SetEncryptionContext(v map[string]*string) *GenerateDataKeyWithoutPlaintextInput

SetEncryptionContext sets the EncryptionContext field's value.

func (*GenerateDataKeyWithoutPlaintextInput) SetGrantTokens

func (s *GenerateDataKeyWithoutPlaintextInput) SetGrantTokens(v []*string) *GenerateDataKeyWithoutPlaintextInput

SetGrantTokens sets the GrantTokens field's value.

func (*GenerateDataKeyWithoutPlaintextInput) SetKeyId

func (s *GenerateDataKeyWithoutPlaintextInput) SetKeyId(v string) *GenerateDataKeyWithoutPlaintextInput

SetKeyId sets the KeyId field's value.

func (*GenerateDataKeyWithoutPlaintextInput) SetKeySpec

func (s *GenerateDataKeyWithoutPlaintextInput) SetKeySpec(v string) *GenerateDataKeyWithoutPlaintextInput

SetKeySpec sets the KeySpec field's value.

func (*GenerateDataKeyWithoutPlaintextInput) SetNumberOfBytes

func (s *GenerateDataKeyWithoutPlaintextInput) SetNumberOfBytes(v int64) *GenerateDataKeyWithoutPlaintextInput

SetNumberOfBytes sets the NumberOfBytes field's value.

func (GenerateDataKeyWithoutPlaintextInput) String

func (s GenerateDataKeyWithoutPlaintextInput) String() string

String returns the string representation.

API parameter values that are decorated as "sensitive" in the API will not be included in the string output. The member name will be present, but the value will be replaced with "sensitive".

func (*GenerateDataKeyWithoutPlaintextInput) Validate

func (s *GenerateDataKeyWithoutPlaintextInput) Validate() error

Validate inspects the fields of the type to determine if they are valid.

type GenerateDataKeyWithoutPlaintextOutput

type GenerateDataKeyWithoutPlaintextOutput struct {

    // The encrypted data key. When you use the HTTP API or the Amazon Web Services
    // CLI, the value is Base64-encoded. Otherwise, it is not Base64-encoded.
    // CiphertextBlob is automatically base64 encoded/decoded by the SDK.
    CiphertextBlob []byte `min:"1" type:"blob"`

    // The Amazon Resource Name (key ARN (https://docs.aws.amazon.com/kms/latest/developerguide/concepts.html#key-id-key-ARN))
    // of the KMS key that encrypted the data key.
    KeyId *string `min:"1" type:"string"`
    // contains filtered or unexported fields
}

func (GenerateDataKeyWithoutPlaintextOutput) GoString

func (s GenerateDataKeyWithoutPlaintextOutput) GoString() string

GoString returns the string representation.

API parameter values that are decorated as "sensitive" in the API will not be included in the string output. The member name will be present, but the value will be replaced with "sensitive".

func (*GenerateDataKeyWithoutPlaintextOutput) SetCiphertextBlob

func (s *GenerateDataKeyWithoutPlaintextOutput) SetCiphertextBlob(v []byte) *GenerateDataKeyWithoutPlaintextOutput

SetCiphertextBlob sets the CiphertextBlob field's value.

func (*GenerateDataKeyWithoutPlaintextOutput) SetKeyId

func (s *GenerateDataKeyWithoutPlaintextOutput) SetKeyId(v string) *GenerateDataKeyWithoutPlaintextOutput

SetKeyId sets the KeyId field's value.

func (GenerateDataKeyWithoutPlaintextOutput) String

func (s GenerateDataKeyWithoutPlaintextOutput) String() string

String returns the string representation.

API parameter values that are decorated as "sensitive" in the API will not be included in the string output. The member name will be present, but the value will be replaced with "sensitive".

type GenerateMacInput

type GenerateMacInput struct {

    // Checks if your request will succeed. DryRun is an optional parameter.
    //
    // To learn more about how to use this parameter, see Testing your KMS API calls
    // (https://docs.aws.amazon.com/kms/latest/developerguide/programming-dryrun.html)
    // in the Key Management Service Developer Guide.
    DryRun *bool `type:"boolean"`

    // A list of grant tokens.
    //
    // Use a grant token when your permission to call this operation comes from
    // a new grant that has not yet achieved eventual consistency. For more information,
    // see Grant token (https://docs.aws.amazon.com/kms/latest/developerguide/grants.html#grant_token)
    // and Using a grant token (https://docs.aws.amazon.com/kms/latest/developerguide/grant-manage.html#using-grant-token)
    // in the Key Management Service Developer Guide.
    GrantTokens []*string `type:"list"`

    // The HMAC KMS key to use in the operation. The MAC algorithm computes the
    // HMAC for the message and the key as described in RFC 2104 (https://datatracker.ietf.org/doc/html/rfc2104).
    //
    // To identify an HMAC KMS key, use the DescribeKey operation and see the KeySpec
    // field in the response.
    //
    // KeyId is a required field
    KeyId *string `min:"1" type:"string" required:"true"`

    // The MAC algorithm used in the operation.
    //
    // The algorithm must be compatible with the HMAC KMS key that you specify.
    // To find the MAC algorithms that your HMAC KMS key supports, use the DescribeKey
    // operation and see the MacAlgorithms field in the DescribeKey response.
    //
    // MacAlgorithm is a required field
    MacAlgorithm *string `type:"string" required:"true" enum:"MacAlgorithmSpec"`

    // The message to be hashed. Specify a message of up to 4,096 bytes.
    //
    // GenerateMac and VerifyMac do not provide special handling for message digests.
    // If you generate an HMAC for a hash digest of a message, you must verify the
    // HMAC of the same hash digest.
    //
    // Message is a sensitive parameter and its value will be
    // replaced with "sensitive" in string returned by GenerateMacInput's
    // String and GoString methods.
    //
    // Message is automatically base64 encoded/decoded by the SDK.
    //
    // Message is a required field
    Message []byte `min:"1" type:"blob" required:"true" sensitive:"true"`
    // contains filtered or unexported fields
}

func (GenerateMacInput) GoString

func (s GenerateMacInput) GoString() string

GoString returns the string representation.

API parameter values that are decorated as "sensitive" in the API will not be included in the string output. The member name will be present, but the value will be replaced with "sensitive".

func (*GenerateMacInput) SetDryRun

func (s *GenerateMacInput) SetDryRun(v bool) *GenerateMacInput

SetDryRun sets the DryRun field's value.

func (*GenerateMacInput) SetGrantTokens

func (s *GenerateMacInput) SetGrantTokens(v []*string) *GenerateMacInput

SetGrantTokens sets the GrantTokens field's value.

func (*GenerateMacInput) SetKeyId

func (s *GenerateMacInput) SetKeyId(v string) *GenerateMacInput

SetKeyId sets the KeyId field's value.

func (*GenerateMacInput) SetMacAlgorithm

func (s *GenerateMacInput) SetMacAlgorithm(v string) *GenerateMacInput

SetMacAlgorithm sets the MacAlgorithm field's value.

func (*GenerateMacInput) SetMessage

func (s *GenerateMacInput) SetMessage(v []byte) *GenerateMacInput

SetMessage sets the Message field's value.

func (GenerateMacInput) String

func (s GenerateMacInput) String() string

String returns the string representation.

API parameter values that are decorated as "sensitive" in the API will not be included in the string output. The member name will be present, but the value will be replaced with "sensitive".

func (*GenerateMacInput) Validate

func (s *GenerateMacInput) Validate() error

Validate inspects the fields of the type to determine if they are valid.

type GenerateMacOutput

type GenerateMacOutput struct {

    // The HMAC KMS key used in the operation.
    KeyId *string `min:"1" type:"string"`

    // The hash-based message authentication code (HMAC) that was generated for
    // the specified message, HMAC KMS key, and MAC algorithm.
    //
    // This is the standard, raw HMAC defined in RFC 2104 (https://datatracker.ietf.org/doc/html/rfc2104).
    // Mac is automatically base64 encoded/decoded by the SDK.
    Mac []byte `min:"1" type:"blob"`

    // The MAC algorithm that was used to generate the HMAC.
    MacAlgorithm *string `type:"string" enum:"MacAlgorithmSpec"`
    // contains filtered or unexported fields
}

func (GenerateMacOutput) GoString

func (s GenerateMacOutput) GoString() string

GoString returns the string representation.

API parameter values that are decorated as "sensitive" in the API will not be included in the string output. The member name will be present, but the value will be replaced with "sensitive".

func (*GenerateMacOutput) SetKeyId

func (s *GenerateMacOutput) SetKeyId(v string) *GenerateMacOutput

SetKeyId sets the KeyId field's value.

func (*GenerateMacOutput) SetMac

func (s *GenerateMacOutput) SetMac(v []byte) *GenerateMacOutput

SetMac sets the Mac field's value.

func (*GenerateMacOutput) SetMacAlgorithm

func (s *GenerateMacOutput) SetMacAlgorithm(v string) *GenerateMacOutput

SetMacAlgorithm sets the MacAlgorithm field's value.

func (GenerateMacOutput) String

func (s GenerateMacOutput) String() string

String returns the string representation.

API parameter values that are decorated as "sensitive" in the API will not be included in the string output. The member name will be present, but the value will be replaced with "sensitive".

type GenerateRandomInput

type GenerateRandomInput struct {

    // Generates the random byte string in the CloudHSM cluster that is associated
    // with the specified CloudHSM key store. To find the ID of a custom key store,
    // use the DescribeCustomKeyStores operation.
    //
    // External key store IDs are not valid for this parameter. If you specify the
    // ID of an external key store, GenerateRandom throws an UnsupportedOperationException.
    CustomKeyStoreId *string `min:"1" type:"string"`

    // The length of the random byte string. This parameter is required.
    NumberOfBytes *int64 `min:"1" type:"integer"`

    // A signed attestation document (https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/nitro-enclave-how.html#term-attestdoc)
    // from an Amazon Web Services Nitro enclave and the encryption algorithm to
    // use with the enclave's public key. The only valid encryption algorithm is
    // RSAES_OAEP_SHA_256.
    //
    // This parameter only supports attestation documents for Amazon Web Services
    // Nitro Enclaves. To include this parameter, use the Amazon Web Services Nitro
    // Enclaves SDK (https://docs.aws.amazon.com/enclaves/latest/user/developing-applications.html#sdk)
    // or any Amazon Web Services SDK.
    //
    // When you use this parameter, instead of returning plaintext bytes, KMS encrypts
    // the plaintext bytes under the public key in the attestation document, and
    // returns the resulting ciphertext in the CiphertextForRecipient field in the
    // response. This ciphertext can be decrypted only with the private key in the
    // enclave. The Plaintext field in the response is null or empty.
    //
    // For information about the interaction between KMS and Amazon Web Services
    // Nitro Enclaves, see How Amazon Web Services Nitro Enclaves uses KMS (https://docs.aws.amazon.com/kms/latest/developerguide/services-nitro-enclaves.html)
    // in the Key Management Service Developer Guide.
    Recipient *RecipientInfo `type:"structure"`
    // contains filtered or unexported fields
}

func (GenerateRandomInput) GoString

func (s GenerateRandomInput) GoString() string

GoString returns the string representation.

API parameter values that are decorated as "sensitive" in the API will not be included in the string output. The member name will be present, but the value will be replaced with "sensitive".

func (*GenerateRandomInput) SetCustomKeyStoreId

func (s *GenerateRandomInput) SetCustomKeyStoreId(v string) *GenerateRandomInput

SetCustomKeyStoreId sets the CustomKeyStoreId field's value.

func (*GenerateRandomInput) SetNumberOfBytes

func (s *GenerateRandomInput) SetNumberOfBytes(v int64) *GenerateRandomInput

SetNumberOfBytes sets the NumberOfBytes field's value.

func (*GenerateRandomInput) SetRecipient

func (s *GenerateRandomInput) SetRecipient(v *RecipientInfo) *GenerateRandomInput

SetRecipient sets the Recipient field's value.

func (GenerateRandomInput) String

func (s GenerateRandomInput) String() string

String returns the string representation.

API parameter values that are decorated as "sensitive" in the API will not be included in the string output. The member name will be present, but the value will be replaced with "sensitive".

func (*GenerateRandomInput) Validate

func (s *GenerateRandomInput) Validate() error

Validate inspects the fields of the type to determine if they are valid.

type GenerateRandomOutput

type GenerateRandomOutput struct {

    // The plaintext random bytes encrypted with the public key from the Nitro enclave.
    // This ciphertext can be decrypted only by using a private key in the Nitro
    // enclave.
    //
    // This field is included in the response only when the Recipient parameter
    // in the request includes a valid attestation document from an Amazon Web Services
    // Nitro enclave. For information about the interaction between KMS and Amazon
    // Web Services Nitro Enclaves, see How Amazon Web Services Nitro Enclaves uses
    // KMS (https://docs.aws.amazon.com/kms/latest/developerguide/services-nitro-enclaves.html)
    // in the Key Management Service Developer Guide.
    // CiphertextForRecipient is automatically base64 encoded/decoded by the SDK.
    CiphertextForRecipient []byte `min:"1" type:"blob"`

    // The random byte string. When you use the HTTP API or the Amazon Web Services
    // CLI, the value is Base64-encoded. Otherwise, it is not Base64-encoded.
    //
    // If the response includes the CiphertextForRecipient field, the Plaintext
    // field is null or empty.
    //
    // Plaintext is a sensitive parameter and its value will be
    // replaced with "sensitive" in string returned by GenerateRandomOutput's
    // String and GoString methods.
    //
    // Plaintext is automatically base64 encoded/decoded by the SDK.
    Plaintext []byte `min:"1" type:"blob" sensitive:"true"`
    // contains filtered or unexported fields
}

func (GenerateRandomOutput) GoString

func (s GenerateRandomOutput) GoString() string

GoString returns the string representation.

API parameter values that are decorated as "sensitive" in the API will not be included in the string output. The member name will be present, but the value will be replaced with "sensitive".

func (*GenerateRandomOutput) SetCiphertextForRecipient

func (s *GenerateRandomOutput) SetCiphertextForRecipient(v []byte) *GenerateRandomOutput

SetCiphertextForRecipient sets the CiphertextForRecipient field's value.

func (*GenerateRandomOutput) SetPlaintext

func (s *GenerateRandomOutput) SetPlaintext(v []byte) *GenerateRandomOutput

SetPlaintext sets the Plaintext field's value.

func (GenerateRandomOutput) String

func (s GenerateRandomOutput) String() string

String returns the string representation.

API parameter values that are decorated as "sensitive" in the API will not be included in the string output. The member name will be present, but the value will be replaced with "sensitive".

type GetKeyPolicyInput

type GetKeyPolicyInput struct {

    // Gets the key policy for the specified KMS key.
    //
    // Specify the key ID or key ARN of the KMS key.
    //
    // For example:
    //
    //    * Key ID: 1234abcd-12ab-34cd-56ef-1234567890ab
    //
    //    * Key ARN: arn:aws:kms:us-east-2:111122223333:key/1234abcd-12ab-34cd-56ef-1234567890ab
    //
    // To get the key ID and key ARN for a KMS key, use ListKeys or DescribeKey.
    //
    // KeyId is a required field
    KeyId *string `min:"1" type:"string" required:"true"`

    // Specifies the name of the key policy. If no policy name is specified, the
    // default value is default. The only valid name is default. To get the names
    // of key policies, use ListKeyPolicies.
    PolicyName *string `min:"1" type:"string"`
    // contains filtered or unexported fields
}

func (GetKeyPolicyInput) GoString

func (s GetKeyPolicyInput) GoString() string

GoString returns the string representation.

API parameter values that are decorated as "sensitive" in the API will not be included in the string output. The member name will be present, but the value will be replaced with "sensitive".

func (*GetKeyPolicyInput) SetKeyId

func (s *GetKeyPolicyInput) SetKeyId(v string) *GetKeyPolicyInput

SetKeyId sets the KeyId field's value.

func (*GetKeyPolicyInput) SetPolicyName

func (s *GetKeyPolicyInput) SetPolicyName(v string) *GetKeyPolicyInput

SetPolicyName sets the PolicyName field's value.

func (GetKeyPolicyInput) String

func (s GetKeyPolicyInput) String() string

String returns the string representation.

API parameter values that are decorated as "sensitive" in the API will not be included in the string output. The member name will be present, but the value will be replaced with "sensitive".

func (*GetKeyPolicyInput) Validate

func (s *GetKeyPolicyInput) Validate() error

Validate inspects the fields of the type to determine if they are valid.

type GetKeyPolicyOutput

type GetKeyPolicyOutput struct {

    // A key policy document in JSON format.
    Policy *string `min:"1" type:"string"`

    // The name of the key policy. The only valid value is default.
    PolicyName *string `min:"1" type:"string"`
    // contains filtered or unexported fields
}

func (GetKeyPolicyOutput) GoString

func (s GetKeyPolicyOutput) GoString() string

GoString returns the string representation.

API parameter values that are decorated as "sensitive" in the API will not be included in the string output. The member name will be present, but the value will be replaced with "sensitive".

func (*GetKeyPolicyOutput) SetPolicy

func (s *GetKeyPolicyOutput) SetPolicy(v string) *GetKeyPolicyOutput

SetPolicy sets the Policy field's value.

func (*GetKeyPolicyOutput) SetPolicyName

func (s *GetKeyPolicyOutput) SetPolicyName(v string) *GetKeyPolicyOutput

SetPolicyName sets the PolicyName field's value.

func (GetKeyPolicyOutput) String

func (s GetKeyPolicyOutput) String() string

String returns the string representation.

API parameter values that are decorated as "sensitive" in the API will not be included in the string output. The member name will be present, but the value will be replaced with "sensitive".

type GetKeyRotationStatusInput

type GetKeyRotationStatusInput struct {

    // Gets the rotation status for the specified KMS key.
    //
    // Specify the key ID or key ARN of the KMS key. To specify a KMS key in a different
    // Amazon Web Services account, you must use the key ARN.
    //
    // For example:
    //
    //    * Key ID: 1234abcd-12ab-34cd-56ef-1234567890ab
    //
    //    * Key ARN: arn:aws:kms:us-east-2:111122223333:key/1234abcd-12ab-34cd-56ef-1234567890ab
    //
    // To get the key ID and key ARN for a KMS key, use ListKeys or DescribeKey.
    //
    // KeyId is a required field
    KeyId *string `min:"1" type:"string" required:"true"`
    // contains filtered or unexported fields
}

func (GetKeyRotationStatusInput) GoString

func (s GetKeyRotationStatusInput) GoString() string

GoString returns the string representation.

API parameter values that are decorated as "sensitive" in the API will not be included in the string output. The member name will be present, but the value will be replaced with "sensitive".

func (*GetKeyRotationStatusInput) SetKeyId

func (s *GetKeyRotationStatusInput) SetKeyId(v string) *GetKeyRotationStatusInput

SetKeyId sets the KeyId field's value.

func (GetKeyRotationStatusInput) String

func (s GetKeyRotationStatusInput) String() string

String returns the string representation.

API parameter values that are decorated as "sensitive" in the API will not be included in the string output. The member name will be present, but the value will be replaced with "sensitive".

func (*GetKeyRotationStatusInput) Validate

func (s *GetKeyRotationStatusInput) Validate() error

Validate inspects the fields of the type to determine if they are valid.

type GetKeyRotationStatusOutput

type GetKeyRotationStatusOutput struct {

    // Identifies the specified symmetric encryption KMS key.
    KeyId *string `min:"1" type:"string"`

    // A Boolean value that specifies whether key rotation is enabled.
    KeyRotationEnabled *bool `type:"boolean"`

    // The next date that KMS will automatically rotate the key material.
    NextRotationDate *time.Time `type:"timestamp"`

    // Identifies the date and time that an in progress on-demand rotation was initiated.
    //
    // The KMS API follows an eventual consistency (https://docs.aws.amazon.com/kms/latest/developerguide/programming-eventual-consistency.html)
    // model due to the distributed nature of the system. As a result, there might
    // be a slight delay between initiating on-demand key rotation and the rotation's
    // completion. Once the on-demand rotation is complete, use ListKeyRotations
    // to view the details of the on-demand rotation.
    OnDemandRotationStartDate *time.Time `type:"timestamp"`

    // The number of days between each automatic rotation. The default value is
    // 365 days.
    RotationPeriodInDays *int64 `min:"90" type:"integer"`
    // contains filtered or unexported fields
}

func (GetKeyRotationStatusOutput) GoString

func (s GetKeyRotationStatusOutput) GoString() string

GoString returns the string representation.

API parameter values that are decorated as "sensitive" in the API will not be included in the string output. The member name will be present, but the value will be replaced with "sensitive".

func (*GetKeyRotationStatusOutput) SetKeyId

func (s *GetKeyRotationStatusOutput) SetKeyId(v string) *GetKeyRotationStatusOutput

SetKeyId sets the KeyId field's value.

func (*GetKeyRotationStatusOutput) SetKeyRotationEnabled

func (s *GetKeyRotationStatusOutput) SetKeyRotationEnabled(v bool) *GetKeyRotationStatusOutput

SetKeyRotationEnabled sets the KeyRotationEnabled field's value.

func (*GetKeyRotationStatusOutput) SetNextRotationDate

func (s *GetKeyRotationStatusOutput) SetNextRotationDate(v time.Time) *GetKeyRotationStatusOutput

SetNextRotationDate sets the NextRotationDate field's value.

func (*GetKeyRotationStatusOutput) SetOnDemandRotationStartDate

func (s *GetKeyRotationStatusOutput) SetOnDemandRotationStartDate(v time.Time) *GetKeyRotationStatusOutput

SetOnDemandRotationStartDate sets the OnDemandRotationStartDate field's value.

func (*GetKeyRotationStatusOutput) SetRotationPeriodInDays

func (s *GetKeyRotationStatusOutput) SetRotationPeriodInDays(v int64) *GetKeyRotationStatusOutput

SetRotationPeriodInDays sets the RotationPeriodInDays field's value.

func (GetKeyRotationStatusOutput) String

func (s GetKeyRotationStatusOutput) String() string

String returns the string representation.

API parameter values that are decorated as "sensitive" in the API will not be included in the string output. The member name will be present, but the value will be replaced with "sensitive".

type GetParametersForImportInput

type GetParametersForImportInput struct {

    // The identifier of the KMS key that will be associated with the imported key
    // material. The Origin of the KMS key must be EXTERNAL.
    //
    // All KMS key types are supported, including multi-Region keys. However, you
    // cannot import key material into a KMS key in a custom key store.
    //
    // Specify the key ID or key ARN of the KMS key.
    //
    // For example:
    //
    //    * Key ID: 1234abcd-12ab-34cd-56ef-1234567890ab
    //
    //    * Key ARN: arn:aws:kms:us-east-2:111122223333:key/1234abcd-12ab-34cd-56ef-1234567890ab
    //
    // To get the key ID and key ARN for a KMS key, use ListKeys or DescribeKey.
    //
    // KeyId is a required field
    KeyId *string `min:"1" type:"string" required:"true"`

    // The algorithm you will use with the RSA public key (PublicKey) in the response
    // to protect your key material during import. For more information, see Select
    // a wrapping algorithm (kms/latest/developerguide/importing-keys-get-public-key-and-token.html#select-wrapping-algorithm)
    // in the Key Management Service Developer Guide.
    //
    // For RSA_AES wrapping algorithms, you encrypt your key material with an AES
    // key that you generate, then encrypt your AES key with the RSA public key
    // from KMS. For RSAES wrapping algorithms, you encrypt your key material directly
    // with the RSA public key from KMS.
    //
    // The wrapping algorithms that you can use depend on the type of key material
    // that you are importing. To import an RSA private key, you must use an RSA_AES
    // wrapping algorithm.
    //
    //    * RSA_AES_KEY_WRAP_SHA_256 — Supported for wrapping RSA and ECC key
    //    material.
    //
    //    * RSA_AES_KEY_WRAP_SHA_1 — Supported for wrapping RSA and ECC key material.
    //
    //    * RSAES_OAEP_SHA_256 — Supported for all types of key material, except
    //    RSA key material (private key). You cannot use the RSAES_OAEP_SHA_256
    //    wrapping algorithm with the RSA_2048 wrapping key spec to wrap ECC_NIST_P521
    //    key material.
    //
    //    * RSAES_OAEP_SHA_1 — Supported for all types of key material, except
    //    RSA key material (private key). You cannot use the RSAES_OAEP_SHA_1 wrapping
    //    algorithm with the RSA_2048 wrapping key spec to wrap ECC_NIST_P521 key
    //    material.
    //
    //    * RSAES_PKCS1_V1_5 (Deprecated) — As of October 10, 2023, KMS does not
    //    support the RSAES_PKCS1_V1_5 wrapping algorithm.
    //
    // WrappingAlgorithm is a required field
    WrappingAlgorithm *string `type:"string" required:"true" enum:"AlgorithmSpec"`

    // The type of RSA public key to return in the response. You will use this wrapping
    // key with the specified wrapping algorithm to protect your key material during
    // import.
    //
    // Use the longest RSA wrapping key that is practical.
    //
    // You cannot use an RSA_2048 public key to directly wrap an ECC_NIST_P521 private
    // key. Instead, use an RSA_AES wrapping algorithm or choose a longer RSA public
    // key.
    //
    // WrappingKeySpec is a required field
    WrappingKeySpec *string `type:"string" required:"true" enum:"WrappingKeySpec"`
    // contains filtered or unexported fields
}

func (GetParametersForImportInput) GoString

func (s GetParametersForImportInput) GoString() string

GoString returns the string representation.

API parameter values that are decorated as "sensitive" in the API will not be included in the string output. The member name will be present, but the value will be replaced with "sensitive".

func (*GetParametersForImportInput) SetKeyId

func (s *GetParametersForImportInput) SetKeyId(v string) *GetParametersForImportInput

SetKeyId sets the KeyId field's value.

func (*GetParametersForImportInput) SetWrappingAlgorithm

func (s *GetParametersForImportInput) SetWrappingAlgorithm(v string) *GetParametersForImportInput

SetWrappingAlgorithm sets the WrappingAlgorithm field's value.

func (*GetParametersForImportInput) SetWrappingKeySpec

func (s *GetParametersForImportInput) SetWrappingKeySpec(v string) *GetParametersForImportInput

SetWrappingKeySpec sets the WrappingKeySpec field's value.

func (GetParametersForImportInput) String

func (s GetParametersForImportInput) String() string

String returns the string representation.

API parameter values that are decorated as "sensitive" in the API will not be included in the string output. The member name will be present, but the value will be replaced with "sensitive".

func (*GetParametersForImportInput) Validate

func (s *GetParametersForImportInput) Validate() error

Validate inspects the fields of the type to determine if they are valid.

type GetParametersForImportOutput

type GetParametersForImportOutput struct {

    // The import token to send in a subsequent ImportKeyMaterial request.
    // ImportToken is automatically base64 encoded/decoded by the SDK.
    ImportToken []byte `min:"1" type:"blob"`

    // The Amazon Resource Name (key ARN (https://docs.aws.amazon.com/kms/latest/developerguide/concepts.html#key-id-key-ARN))
    // of the KMS key to use in a subsequent ImportKeyMaterial request. This is
    // the same KMS key specified in the GetParametersForImport request.
    KeyId *string `min:"1" type:"string"`

    // The time at which the import token and public key are no longer valid. After
    // this time, you cannot use them to make an ImportKeyMaterial request and you
    // must send another GetParametersForImport request to get new ones.
    ParametersValidTo *time.Time `type:"timestamp"`

    // The public key to use to encrypt the key material before importing it with
    // ImportKeyMaterial.
    //
    // PublicKey is a sensitive parameter and its value will be
    // replaced with "sensitive" in string returned by GetParametersForImportOutput's
    // String and GoString methods.
    //
    // PublicKey is automatically base64 encoded/decoded by the SDK.
    PublicKey []byte `min:"1" type:"blob" sensitive:"true"`
    // contains filtered or unexported fields
}

func (GetParametersForImportOutput) GoString

func (s GetParametersForImportOutput) GoString() string

GoString returns the string representation.

API parameter values that are decorated as "sensitive" in the API will not be included in the string output. The member name will be present, but the value will be replaced with "sensitive".

func (*GetParametersForImportOutput) SetImportToken

func (s *GetParametersForImportOutput) SetImportToken(v []byte) *GetParametersForImportOutput

SetImportToken sets the ImportToken field's value.

func (*GetParametersForImportOutput) SetKeyId

func (s *GetParametersForImportOutput) SetKeyId(v string) *GetParametersForImportOutput

SetKeyId sets the KeyId field's value.

func (*GetParametersForImportOutput) SetParametersValidTo

func (s *GetParametersForImportOutput) SetParametersValidTo(v time.Time) *GetParametersForImportOutput

SetParametersValidTo sets the ParametersValidTo field's value.

func (*GetParametersForImportOutput) SetPublicKey

func (s *GetParametersForImportOutput) SetPublicKey(v []byte) *GetParametersForImportOutput

SetPublicKey sets the PublicKey field's value.

func (GetParametersForImportOutput) String

func (s GetParametersForImportOutput) String() string

String returns the string representation.

API parameter values that are decorated as "sensitive" in the API will not be included in the string output. The member name will be present, but the value will be replaced with "sensitive".

type GetPublicKeyInput

type GetPublicKeyInput struct {

    // A list of grant tokens.
    //
    // Use a grant token when your permission to call this operation comes from
    // a new grant that has not yet achieved eventual consistency. For more information,
    // see Grant token (https://docs.aws.amazon.com/kms/latest/developerguide/grants.html#grant_token)
    // and Using a grant token (https://docs.aws.amazon.com/kms/latest/developerguide/grant-manage.html#using-grant-token)
    // in the Key Management Service Developer Guide.
    GrantTokens []*string `type:"list"`

    // Identifies the asymmetric KMS key that includes the public key.
    //
    // To specify a KMS key, use its key ID, key ARN, alias name, or alias ARN.
    // When using an alias name, prefix it with "alias/". To specify a KMS key in
    // a different Amazon Web Services account, you must use the key ARN or alias
    // ARN.
    //
    // For example:
    //
    //    * Key ID: 1234abcd-12ab-34cd-56ef-1234567890ab
    //
    //    * Key ARN: arn:aws:kms:us-east-2:111122223333:key/1234abcd-12ab-34cd-56ef-1234567890ab
    //
    //    * Alias name: alias/ExampleAlias
    //
    //    * Alias ARN: arn:aws:kms:us-east-2:111122223333:alias/ExampleAlias
    //
    // To get the key ID and key ARN for a KMS key, use ListKeys or DescribeKey.
    // To get the alias name and alias ARN, use ListAliases.
    //
    // KeyId is a required field
    KeyId *string `min:"1" type:"string" required:"true"`
    // contains filtered or unexported fields
}

func (GetPublicKeyInput) GoString

func (s GetPublicKeyInput) GoString() string

GoString returns the string representation.

API parameter values that are decorated as "sensitive" in the API will not be included in the string output. The member name will be present, but the value will be replaced with "sensitive".

func (*GetPublicKeyInput) SetGrantTokens

func (s *GetPublicKeyInput) SetGrantTokens(v []*string) *GetPublicKeyInput

SetGrantTokens sets the GrantTokens field's value.

func (*GetPublicKeyInput) SetKeyId

func (s *GetPublicKeyInput) SetKeyId(v string) *GetPublicKeyInput

SetKeyId sets the KeyId field's value.

func (GetPublicKeyInput) String

func (s GetPublicKeyInput) String() string

String returns the string representation.

API parameter values that are decorated as "sensitive" in the API will not be included in the string output. The member name will be present, but the value will be replaced with "sensitive".

func (*GetPublicKeyInput) Validate

func (s *GetPublicKeyInput) Validate() error

Validate inspects the fields of the type to determine if they are valid.

type GetPublicKeyOutput

type GetPublicKeyOutput struct {

    // 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: This field has been deprecated. Instead, use the KeySpec field.
    CustomerMasterKeySpec *string `deprecated:"true" type:"string" enum:"CustomerMasterKeySpec"`

    // 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.
    EncryptionAlgorithms []*string `type:"list" enum:"EncryptionAlgorithmSpec"`

    // 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.
    KeyAgreementAlgorithms []*string `type:"list" enum:"KeyAgreementAlgorithmSpec"`

    // The Amazon Resource Name (key ARN (https://docs.aws.amazon.com/kms/latest/developerguide/concepts.html#key-id-key-ARN))
    // of the asymmetric KMS key from which the public key was downloaded.
    KeyId *string `min:"1" type:"string"`

    // The type of the of the public key that was downloaded.
    KeySpec *string `type:"string" enum:"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.
    KeyUsage *string `type:"string" enum:"KeyUsageType"`

    // The exported public key.
    //
    // The value is a DER-encoded X.509 public key, also known as SubjectPublicKeyInfo
    // (SPKI), as defined in RFC 5280 (https://tools.ietf.org/html/rfc5280). When
    // you use the HTTP API or the Amazon Web Services CLI, the value is Base64-encoded.
    // Otherwise, it is not Base64-encoded.
    // PublicKey is automatically base64 encoded/decoded by the SDK.
    PublicKey []byte `min:"1" type:"blob"`

    // 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.
    SigningAlgorithms []*string `type:"list" enum:"SigningAlgorithmSpec"`
    // contains filtered or unexported fields
}

func (GetPublicKeyOutput) GoString

func (s GetPublicKeyOutput) GoString() string

GoString returns the string representation.

API parameter values that are decorated as "sensitive" in the API will not be included in the string output. The member name will be present, but the value will be replaced with "sensitive".

func (*GetPublicKeyOutput) SetCustomerMasterKeySpec

func (s *GetPublicKeyOutput) SetCustomerMasterKeySpec(v string) *GetPublicKeyOutput

SetCustomerMasterKeySpec sets the CustomerMasterKeySpec field's value.

func (*GetPublicKeyOutput) SetEncryptionAlgorithms

func (s *GetPublicKeyOutput) SetEncryptionAlgorithms(v []*string) *GetPublicKeyOutput

SetEncryptionAlgorithms sets the EncryptionAlgorithms field's value.

func (*GetPublicKeyOutput) SetKeyAgreementAlgorithms

func (s *GetPublicKeyOutput) SetKeyAgreementAlgorithms(v []*string) *GetPublicKeyOutput

SetKeyAgreementAlgorithms sets the KeyAgreementAlgorithms field's value.

func (*GetPublicKeyOutput) SetKeyId

func (s *GetPublicKeyOutput) SetKeyId(v string) *GetPublicKeyOutput

SetKeyId sets the KeyId field's value.

func (*GetPublicKeyOutput) SetKeySpec

func (s *GetPublicKeyOutput) SetKeySpec(v string) *GetPublicKeyOutput

SetKeySpec sets the KeySpec field's value.

func (*GetPublicKeyOutput) SetKeyUsage

func (s *GetPublicKeyOutput) SetKeyUsage(v string) *GetPublicKeyOutput

SetKeyUsage sets the KeyUsage field's value.

func (*GetPublicKeyOutput) SetPublicKey

func (s *GetPublicKeyOutput) SetPublicKey(v []byte) *GetPublicKeyOutput

SetPublicKey sets the PublicKey field's value.

func (*GetPublicKeyOutput) SetSigningAlgorithms

func (s *GetPublicKeyOutput) SetSigningAlgorithms(v []*string) *GetPublicKeyOutput

SetSigningAlgorithms sets the SigningAlgorithms field's value.

func (GetPublicKeyOutput) String

func (s GetPublicKeyOutput) String() string

String returns the string representation.

API parameter values that are decorated as "sensitive" in the API will not be included in the string output. The member name will be present, but the value will be replaced with "sensitive".

type GrantConstraints

type GrantConstraints struct {

    // A list of key-value pairs that must match the encryption context in the cryptographic
    // operation (https://docs.aws.amazon.com/kms/latest/developerguide/concepts.html#cryptographic-operations)
    // request. The grant allows the operation only when the encryption context
    // in the request is the same as the encryption context specified in this constraint.
    EncryptionContextEquals map[string]*string `type:"map"`

    // A list of key-value pairs that must be included in the encryption context
    // of the cryptographic operation (https://docs.aws.amazon.com/kms/latest/developerguide/concepts.html#cryptographic-operations)
    // request. The grant allows the cryptographic operation only when the encryption
    // context in the request includes the key-value pairs specified in this constraint,
    // although it can include additional key-value pairs.
    EncryptionContextSubset map[string]*string `type:"map"`
    // contains filtered or unexported fields
}

Use this structure to allow cryptographic operations (https://docs.aws.amazon.com/kms/latest/developerguide/concepts.html#cryptographic-operations) in the grant only when the operation request includes the specified encryption context (https://docs.aws.amazon.com/kms/latest/developerguide/concepts.html#encrypt_context).

KMS applies the grant constraints only to cryptographic operations that support an encryption context, that is, all cryptographic operations with a symmetric KMS key (https://docs.aws.amazon.com/kms/latest/developerguide/symm-asymm-concepts.html#symmetric-cmks). Grant constraints are not applied to operations that do not support an encryption context, such as cryptographic operations with asymmetric KMS keys and management operations, such as DescribeKey or RetireGrant.

In a cryptographic operation, the encryption context in the decryption operation must be an exact, case-sensitive match for the keys and values in the encryption context of the encryption operation. Only the order of the pairs can vary.

However, in a grant constraint, the key in each key-value pair is not case sensitive, but the value is case sensitive.

To avoid confusion, do not use multiple encryption context pairs that differ only by case. To require a fully case-sensitive encryption context, use the kms:EncryptionContext: and kms:EncryptionContextKeys conditions in an IAM or key policy. For details, see kms:EncryptionContext: (https://docs.aws.amazon.com/kms/latest/developerguide/policy-conditions.html#conditions-kms-encryption-context) in the Key Management Service Developer Guide .

func (GrantConstraints) GoString

func (s GrantConstraints) GoString() string

GoString returns the string representation.

API parameter values that are decorated as "sensitive" in the API will not be included in the string output. The member name will be present, but the value will be replaced with "sensitive".

func (*GrantConstraints) SetEncryptionContextEquals

func (s *GrantConstraints) SetEncryptionContextEquals(v map[string]*string) *GrantConstraints

SetEncryptionContextEquals sets the EncryptionContextEquals field's value.

func (*GrantConstraints) SetEncryptionContextSubset

func (s *GrantConstraints) SetEncryptionContextSubset(v map[string]*string) *GrantConstraints

SetEncryptionContextSubset sets the EncryptionContextSubset field's value.

func (GrantConstraints) String

func (s GrantConstraints) String() string

String returns the string representation.

API parameter values that are decorated as "sensitive" in the API will not be included in the string output. The member name will be present, but the value will be replaced with "sensitive".

type GrantListEntry

type GrantListEntry struct {

    // A list of key-value pairs that must be present in the encryption context
    // of certain subsequent operations that the grant allows.
    Constraints *GrantConstraints `type:"structure"`

    // The date and time when the grant was created.
    CreationDate *time.Time `type:"timestamp"`

    // The unique identifier for the grant.
    GrantId *string `min:"1" type:"string"`

    // The identity that gets the permissions in the grant.
    //
    // The GranteePrincipal field in the ListGrants response usually contains the
    // user or role designated as the grantee principal in the grant. However, when
    // the grantee principal in the grant is an Amazon Web Services service, the
    // GranteePrincipal field contains the service principal (https://docs.aws.amazon.com/IAM/latest/UserGuide/reference_policies_elements_principal.html#principal-services),
    // which might represent several different grantee principals.
    GranteePrincipal *string `min:"1" type:"string"`

    // The Amazon Web Services account under which the grant was issued.
    IssuingAccount *string `min:"1" type:"string"`

    // The unique identifier for the KMS key to which the grant applies.
    KeyId *string `min:"1" type:"string"`

    // The friendly name that identifies the grant. If a name was provided in the
    // CreateGrant request, that name is returned. Otherwise this value is null.
    Name *string `min:"1" type:"string"`

    // The list of operations permitted by the grant.
    Operations []*string `type:"list" enum:"GrantOperation"`

    // The principal that can retire the grant.
    RetiringPrincipal *string `min:"1" type:"string"`
    // contains filtered or unexported fields
}

Contains information about a grant.

func (GrantListEntry) GoString

func (s GrantListEntry) GoString() string

GoString returns the string representation.

API parameter values that are decorated as "sensitive" in the API will not be included in the string output. The member name will be present, but the value will be replaced with "sensitive".

func (*GrantListEntry) SetConstraints

func (s *GrantListEntry) SetConstraints(v *GrantConstraints) *GrantListEntry

SetConstraints sets the Constraints field's value.

func (*GrantListEntry) SetCreationDate

func (s *GrantListEntry) SetCreationDate(v time.Time) *GrantListEntry

SetCreationDate sets the CreationDate field's value.

func (*GrantListEntry) SetGrantId

func (s *GrantListEntry) SetGrantId(v string) *GrantListEntry

SetGrantId sets the GrantId field's value.

func (*GrantListEntry) SetGranteePrincipal

func (s *GrantListEntry) SetGranteePrincipal(v string) *GrantListEntry

SetGranteePrincipal sets the GranteePrincipal field's value.

func (*GrantListEntry) SetIssuingAccount

func (s *GrantListEntry) SetIssuingAccount(v string) *GrantListEntry

SetIssuingAccount sets the IssuingAccount field's value.

func (*GrantListEntry) SetKeyId

func (s *GrantListEntry) SetKeyId(v string) *GrantListEntry

SetKeyId sets the KeyId field's value.

func (*GrantListEntry) SetName

func (s *GrantListEntry) SetName(v string) *GrantListEntry

SetName sets the Name field's value.

func (*GrantListEntry) SetOperations

func (s *GrantListEntry) SetOperations(v []*string) *GrantListEntry

SetOperations sets the Operations field's value.

func (*GrantListEntry) SetRetiringPrincipal

func (s *GrantListEntry) SetRetiringPrincipal(v string) *GrantListEntry

SetRetiringPrincipal sets the RetiringPrincipal field's value.

func (GrantListEntry) String

func (s GrantListEntry) String() string

String returns the string representation.

API parameter values that are decorated as "sensitive" in the API will not be included in the string output. The member name will be present, but the value will be replaced with "sensitive".

type ImportKeyMaterialInput

type ImportKeyMaterialInput struct {

    // The encrypted key material to import. The key material must be encrypted
    // under the public wrapping key that GetParametersForImport returned, using
    // the wrapping algorithm that you specified in the same GetParametersForImport
    // request.
    // EncryptedKeyMaterial is automatically base64 encoded/decoded by the SDK.
    //
    // EncryptedKeyMaterial is a required field
    EncryptedKeyMaterial []byte `min:"1" type:"blob" required:"true"`

    // Specifies whether the key material expires. The default is KEY_MATERIAL_EXPIRES.
    // For help with this choice, see Setting an expiration time (https://docs.aws.amazon.com/en_us/kms/latest/developerguide/importing-keys.html#importing-keys-expiration)
    // in the Key Management Service Developer Guide.
    //
    // When the value of ExpirationModel is KEY_MATERIAL_EXPIRES, you must specify
    // a value for the ValidTo parameter. When value is KEY_MATERIAL_DOES_NOT_EXPIRE,
    // you must omit the ValidTo parameter.
    //
    // You cannot change the ExpirationModel or ValidTo values for the current import
    // after the request completes. To change either value, you must reimport the
    // key material.
    ExpirationModel *string `type:"string" enum:"ExpirationModelType"`

    // The import token that you received in the response to a previous GetParametersForImport
    // request. It must be from the same response that contained the public key
    // that you used to encrypt the key material.
    // ImportToken is automatically base64 encoded/decoded by the SDK.
    //
    // ImportToken is a required field
    ImportToken []byte `min:"1" type:"blob" required:"true"`

    // The identifier of the KMS key that will be associated with the imported key
    // material. This must be the same KMS key specified in the KeyID parameter
    // of the corresponding GetParametersForImport request. The Origin of the KMS
    // key must be EXTERNAL and its KeyState must be PendingImport.
    //
    // The KMS key can be a symmetric encryption KMS key, HMAC KMS key, asymmetric
    // encryption KMS key, or asymmetric signing KMS key, including a multi-Region
    // key (kms/latest/developerguide/multi-region-keys-overview.html) of any supported
    // type. You cannot perform this operation on a KMS key in a custom key store,
    // or on a KMS key in a different Amazon Web Services account.
    //
    // Specify the key ID or key ARN of the KMS key.
    //
    // For example:
    //
    //    * Key ID: 1234abcd-12ab-34cd-56ef-1234567890ab
    //
    //    * Key ARN: arn:aws:kms:us-east-2:111122223333:key/1234abcd-12ab-34cd-56ef-1234567890ab
    //
    // To get the key ID and key ARN for a KMS key, use ListKeys or DescribeKey.
    //
    // KeyId is a required field
    KeyId *string `min:"1" type:"string" required:"true"`

    // The date and time when the imported key material expires. This parameter
    // is required when the value of the ExpirationModel parameter is KEY_MATERIAL_EXPIRES.
    // Otherwise it is not valid.
    //
    // The value of this parameter must be a future date and time. The maximum value
    // is 365 days from the request date.
    //
    // When the key material expires, KMS deletes the key material from the KMS
    // key. Without its key material, the KMS key is unusable. To use the KMS key
    // in cryptographic operations, you must reimport the same key material.
    //
    // You cannot change the ExpirationModel or ValidTo values for the current import
    // after the request completes. To change either value, you must delete (DeleteImportedKeyMaterial)
    // and reimport the key material.
    ValidTo *time.Time `type:"timestamp"`
    // contains filtered or unexported fields
}

func (ImportKeyMaterialInput) GoString

func (s ImportKeyMaterialInput) GoString() string

GoString returns the string representation.

API parameter values that are decorated as "sensitive" in the API will not be included in the string output. The member name will be present, but the value will be replaced with "sensitive".

func (*ImportKeyMaterialInput) SetEncryptedKeyMaterial

func (s *ImportKeyMaterialInput) SetEncryptedKeyMaterial(v []byte) *ImportKeyMaterialInput

SetEncryptedKeyMaterial sets the EncryptedKeyMaterial field's value.

func (*ImportKeyMaterialInput) SetExpirationModel

func (s *ImportKeyMaterialInput) SetExpirationModel(v string) *ImportKeyMaterialInput

SetExpirationModel sets the ExpirationModel field's value.

func (*ImportKeyMaterialInput) SetImportToken

func (s *ImportKeyMaterialInput) SetImportToken(v []byte) *ImportKeyMaterialInput

SetImportToken sets the ImportToken field's value.

func (*ImportKeyMaterialInput) SetKeyId

func (s *ImportKeyMaterialInput) SetKeyId(v string) *ImportKeyMaterialInput

SetKeyId sets the KeyId field's value.

func (*ImportKeyMaterialInput) SetValidTo

func (s *ImportKeyMaterialInput) SetValidTo(v time.Time) *ImportKeyMaterialInput

SetValidTo sets the ValidTo field's value.

func (ImportKeyMaterialInput) String

func (s ImportKeyMaterialInput) String() string

String returns the string representation.

API parameter values that are decorated as "sensitive" in the API will not be included in the string output. The member name will be present, but the value will be replaced with "sensitive".

func (*ImportKeyMaterialInput) Validate

func (s *ImportKeyMaterialInput) Validate() error

Validate inspects the fields of the type to determine if they are valid.

type ImportKeyMaterialOutput

type ImportKeyMaterialOutput struct {
    // contains filtered or unexported fields
}

func (ImportKeyMaterialOutput) GoString

func (s ImportKeyMaterialOutput) GoString() string

GoString returns the string representation.

API parameter values that are decorated as "sensitive" in the API will not be included in the string output. The member name will be present, but the value will be replaced with "sensitive".

func (ImportKeyMaterialOutput) String

func (s ImportKeyMaterialOutput) String() string

String returns the string representation.

API parameter values that are decorated as "sensitive" in the API will not be included in the string output. The member name will be present, but the value will be replaced with "sensitive".

type IncorrectKeyException

type IncorrectKeyException struct {
    RespMetadata protocol.ResponseMetadata `json:"-" xml:"-"`

    Message_ *string `locationName:"message" type:"string"`
    // contains filtered or unexported fields
}

The request was rejected because the specified KMS key cannot decrypt the data. The KeyId in a Decrypt request and the SourceKeyId in a ReEncrypt request must identify the same KMS key that was used to encrypt the ciphertext.

func (*IncorrectKeyException) Code

func (s *IncorrectKeyException) Code() string

Code returns the exception type name.

func (*IncorrectKeyException) Error

func (s *IncorrectKeyException) Error() string

func (IncorrectKeyException) GoString

func (s IncorrectKeyException) GoString() string

GoString returns the string representation.

API parameter values that are decorated as "sensitive" in the API will not be included in the string output. The member name will be present, but the value will be replaced with "sensitive".

func (*IncorrectKeyException) Message

func (s *IncorrectKeyException) Message() string

Message returns the exception's message.

func (*IncorrectKeyException) OrigErr

func (s *IncorrectKeyException) OrigErr() error

OrigErr always returns nil, satisfies awserr.Error interface.

func (*IncorrectKeyException) RequestID

func (s *IncorrectKeyException) RequestID() string

RequestID returns the service's response RequestID for request.

func (*IncorrectKeyException) StatusCode

func (s *IncorrectKeyException) StatusCode() int

Status code returns the HTTP status code for the request's response error.

func (IncorrectKeyException) String

func (s IncorrectKeyException) String() string

String returns the string representation.

API parameter values that are decorated as "sensitive" in the API will not be included in the string output. The member name will be present, but the value will be replaced with "sensitive".

type IncorrectKeyMaterialException

type IncorrectKeyMaterialException struct {
    RespMetadata protocol.ResponseMetadata `json:"-" xml:"-"`

    Message_ *string `locationName:"message" type:"string"`
    // contains filtered or unexported fields
}

The request was rejected because the key material in the request is, expired, invalid, or is not the same key material that was previously imported into this KMS key.

func (*IncorrectKeyMaterialException) Code

func (s *IncorrectKeyMaterialException) Code() string

Code returns the exception type name.

func (*IncorrectKeyMaterialException) Error

func (s *IncorrectKeyMaterialException) Error() string

func (IncorrectKeyMaterialException) GoString

func (s IncorrectKeyMaterialException) GoString() string

GoString returns the string representation.

API parameter values that are decorated as "sensitive" in the API will not be included in the string output. The member name will be present, but the value will be replaced with "sensitive".

func (*IncorrectKeyMaterialException) Message

func (s *IncorrectKeyMaterialException) Message() string

Message returns the exception's message.

func (*IncorrectKeyMaterialException) OrigErr

func (s *IncorrectKeyMaterialException) OrigErr() error

OrigErr always returns nil, satisfies awserr.Error interface.

func (*IncorrectKeyMaterialException) RequestID

func (s *IncorrectKeyMaterialException) RequestID() string

RequestID returns the service's response RequestID for request.

func (*IncorrectKeyMaterialException) StatusCode

func (s *IncorrectKeyMaterialException) StatusCode() int

Status code returns the HTTP status code for the request's response error.

func (IncorrectKeyMaterialException) String

func (s IncorrectKeyMaterialException) String() string

String returns the string representation.

API parameter values that are decorated as "sensitive" in the API will not be included in the string output. The member name will be present, but the value will be replaced with "sensitive".

type IncorrectTrustAnchorException

type IncorrectTrustAnchorException struct {
    RespMetadata protocol.ResponseMetadata `json:"-" xml:"-"`

    Message_ *string `locationName:"message" type:"string"`
    // contains filtered or unexported fields
}

The request was rejected because the trust anchor certificate in the request to create an CloudHSM key store is not the trust anchor certificate for the specified CloudHSM cluster.

When you initialize the CloudHSM cluster (https://docs.aws.amazon.com/cloudhsm/latest/userguide/initialize-cluster.html#sign-csr), you create the trust anchor certificate and save it in the customerCA.crt file.

func (*IncorrectTrustAnchorException) Code

func (s *IncorrectTrustAnchorException) Code() string

Code returns the exception type name.

func (*IncorrectTrustAnchorException) Error

func (s *IncorrectTrustAnchorException) Error() string

func (IncorrectTrustAnchorException) GoString

func (s IncorrectTrustAnchorException) GoString() string

GoString returns the string representation.

API parameter values that are decorated as "sensitive" in the API will not be included in the string output. The member name will be present, but the value will be replaced with "sensitive".

func (*IncorrectTrustAnchorException) Message

func (s *IncorrectTrustAnchorException) Message() string

Message returns the exception's message.

func (*IncorrectTrustAnchorException) OrigErr

func (s *IncorrectTrustAnchorException) OrigErr() error

OrigErr always returns nil, satisfies awserr.Error interface.

func (*IncorrectTrustAnchorException) RequestID

func (s *IncorrectTrustAnchorException) RequestID() string

RequestID returns the service's response RequestID for request.

func (*IncorrectTrustAnchorException) StatusCode

func (s *IncorrectTrustAnchorException) StatusCode() int

Status code returns the HTTP status code for the request's response error.

func (IncorrectTrustAnchorException) String

func (s IncorrectTrustAnchorException) String() string

String returns the string representation.

API parameter values that are decorated as "sensitive" in the API will not be included in the string output. The member name will be present, but the value will be replaced with "sensitive".

type InternalException

type InternalException struct {
    RespMetadata protocol.ResponseMetadata `json:"-" xml:"-"`

    Message_ *string `locationName:"message" type:"string"`
    // contains filtered or unexported fields
}

The request was rejected because an internal exception occurred. The request can be retried.

func (*InternalException) Code

func (s *InternalException) Code() string

Code returns the exception type name.

func (*InternalException) Error

func (s *InternalException) Error() string

func (InternalException) GoString

func (s InternalException) GoString() string

GoString returns the string representation.

API parameter values that are decorated as "sensitive" in the API will not be included in the string output. The member name will be present, but the value will be replaced with "sensitive".

func (*InternalException) Message

func (s *InternalException) Message() string

Message returns the exception's message.

func (*InternalException) OrigErr

func (s *InternalException) OrigErr() error

OrigErr always returns nil, satisfies awserr.Error interface.

func (*InternalException) RequestID

func (s *InternalException) RequestID() string

RequestID returns the service's response RequestID for request.

func (*InternalException) StatusCode

func (s *InternalException) StatusCode() int

Status code returns the HTTP status code for the request's response error.

func (InternalException) String

func (s InternalException) String() string

String returns the string representation.

API parameter values that are decorated as "sensitive" in the API will not be included in the string output. The member name will be present, but the value will be replaced with "sensitive".

type InvalidAliasNameException

type InvalidAliasNameException struct {
    RespMetadata protocol.ResponseMetadata `json:"-" xml:"-"`

    Message_ *string `locationName:"message" type:"string"`
    // contains filtered or unexported fields
}

The request was rejected because the specified alias name is not valid.

func (*InvalidAliasNameException) Code

func (s *InvalidAliasNameException) Code() string

Code returns the exception type name.

func (*InvalidAliasNameException) Error

func (s *InvalidAliasNameException) Error() string

func (InvalidAliasNameException) GoString

func (s InvalidAliasNameException) GoString() string

GoString returns the string representation.

API parameter values that are decorated as "sensitive" in the API will not be included in the string output. The member name will be present, but the value will be replaced with "sensitive".

func (*InvalidAliasNameException) Message

func (s *InvalidAliasNameException) Message() string

Message returns the exception's message.

func (*InvalidAliasNameException) OrigErr

func (s *InvalidAliasNameException) OrigErr() error

OrigErr always returns nil, satisfies awserr.Error interface.

func (*InvalidAliasNameException) RequestID

func (s *InvalidAliasNameException) RequestID() string

RequestID returns the service's response RequestID for request.

func (*InvalidAliasNameException) StatusCode

func (s *InvalidAliasNameException) StatusCode() int

Status code returns the HTTP status code for the request's response error.

func (InvalidAliasNameException) String

func (s InvalidAliasNameException) String() string

String returns the string representation.

API parameter values that are decorated as "sensitive" in the API will not be included in the string output. The member name will be present, but the value will be replaced with "sensitive".

type InvalidArnException

type InvalidArnException struct {
    RespMetadata protocol.ResponseMetadata `json:"-" xml:"-"`

    Message_ *string `locationName:"message" type:"string"`
    // contains filtered or unexported fields
}

The request was rejected because a specified ARN, or an ARN in a key policy, is not valid.

func (*InvalidArnException) Code

func (s *InvalidArnException) Code() string

Code returns the exception type name.

func (*InvalidArnException) Error

func (s *InvalidArnException) Error() string

func (InvalidArnException) GoString

func (s InvalidArnException) GoString() string

GoString returns the string representation.

API parameter values that are decorated as "sensitive" in the API will not be included in the string output. The member name will be present, but the value will be replaced with "sensitive".

func (*InvalidArnException) Message

func (s *InvalidArnException) Message() string

Message returns the exception's message.

func (*InvalidArnException) OrigErr

func (s *InvalidArnException) OrigErr() error

OrigErr always returns nil, satisfies awserr.Error interface.

func (*InvalidArnException) RequestID

func (s *InvalidArnException) RequestID() string

RequestID returns the service's response RequestID for request.

func (*InvalidArnException) StatusCode

func (s *InvalidArnException) StatusCode() int

Status code returns the HTTP status code for the request's response error.

func (InvalidArnException) String

func (s InvalidArnException) String() string

String returns the string representation.

API parameter values that are decorated as "sensitive" in the API will not be included in the string output. The member name will be present, but the value will be replaced with "sensitive".

type InvalidCiphertextException

type InvalidCiphertextException struct {
    RespMetadata protocol.ResponseMetadata `json:"-" xml:"-"`

    Message_ *string `locationName:"message" type:"string"`
    // contains filtered or unexported fields
}

From the Decrypt or ReEncrypt operation, the request was rejected because the specified ciphertext, or additional authenticated data incorporated into the ciphertext, such as the encryption context, is corrupted, missing, or otherwise invalid.

From the ImportKeyMaterial operation, the request was rejected because KMS could not decrypt the encrypted (wrapped) key material.

func (*InvalidCiphertextException) Code

func (s *InvalidCiphertextException) Code() string

Code returns the exception type name.

func (*InvalidCiphertextException) Error

func (s *InvalidCiphertextException) Error() string

func (InvalidCiphertextException) GoString

func (s InvalidCiphertextException) GoString() string

GoString returns the string representation.

API parameter values that are decorated as "sensitive" in the API will not be included in the string output. The member name will be present, but the value will be replaced with "sensitive".

func (*InvalidCiphertextException) Message

func (s *InvalidCiphertextException) Message() string

Message returns the exception's message.

func (*InvalidCiphertextException) OrigErr

func (s *InvalidCiphertextException) OrigErr() error

OrigErr always returns nil, satisfies awserr.Error interface.

func (*InvalidCiphertextException) RequestID

func (s *InvalidCiphertextException) RequestID() string

RequestID returns the service's response RequestID for request.

func (*InvalidCiphertextException) StatusCode

func (s *InvalidCiphertextException) StatusCode() int

Status code returns the HTTP status code for the request's response error.

func (InvalidCiphertextException) String

func (s InvalidCiphertextException) String() string

String returns the string representation.

API parameter values that are decorated as "sensitive" in the API will not be included in the string output. The member name will be present, but the value will be replaced with "sensitive".

type InvalidGrantIdException

type InvalidGrantIdException struct {
    RespMetadata protocol.ResponseMetadata `json:"-" xml:"-"`

    Message_ *string `locationName:"message" type:"string"`
    // contains filtered or unexported fields
}

The request was rejected because the specified GrantId is not valid.

func (*InvalidGrantIdException) Code

func (s *InvalidGrantIdException) Code() string

Code returns the exception type name.

func (*InvalidGrantIdException) Error

func (s *InvalidGrantIdException) Error() string

func (InvalidGrantIdException) GoString

func (s InvalidGrantIdException) GoString() string

GoString returns the string representation.

API parameter values that are decorated as "sensitive" in the API will not be included in the string output. The member name will be present, but the value will be replaced with "sensitive".

func (*InvalidGrantIdException) Message

func (s *InvalidGrantIdException) Message() string

Message returns the exception's message.

func (*InvalidGrantIdException) OrigErr

func (s *InvalidGrantIdException) OrigErr() error

OrigErr always returns nil, satisfies awserr.Error interface.

func (*InvalidGrantIdException) RequestID

func (s *InvalidGrantIdException) RequestID() string

RequestID returns the service's response RequestID for request.

func (*InvalidGrantIdException) StatusCode

func (s *InvalidGrantIdException) StatusCode() int

Status code returns the HTTP status code for the request's response error.

func (InvalidGrantIdException) String

func (s InvalidGrantIdException) String() string

String returns the string representation.

API parameter values that are decorated as "sensitive" in the API will not be included in the string output. The member name will be present, but the value will be replaced with "sensitive".

type InvalidGrantTokenException

type InvalidGrantTokenException struct {
    RespMetadata protocol.ResponseMetadata `json:"-" xml:"-"`

    Message_ *string `locationName:"message" type:"string"`
    // contains filtered or unexported fields
}

The request was rejected because the specified grant token is not valid.

func (*InvalidGrantTokenException) Code

func (s *InvalidGrantTokenException) Code() string

Code returns the exception type name.

func (*InvalidGrantTokenException) Error

func (s *InvalidGrantTokenException) Error() string

func (InvalidGrantTokenException) GoString

func (s InvalidGrantTokenException) GoString() string

GoString returns the string representation.

API parameter values that are decorated as "sensitive" in the API will not be included in the string output. The member name will be present, but the value will be replaced with "sensitive".

func (*InvalidGrantTokenException) Message

func (s *InvalidGrantTokenException) Message() string

Message returns the exception's message.

func (*InvalidGrantTokenException) OrigErr

func (s *InvalidGrantTokenException) OrigErr() error

OrigErr always returns nil, satisfies awserr.Error interface.

func (*InvalidGrantTokenException) RequestID

func (s *InvalidGrantTokenException) RequestID() string

RequestID returns the service's response RequestID for request.

func (*InvalidGrantTokenException) StatusCode

func (s *InvalidGrantTokenException) StatusCode() int

Status code returns the HTTP status code for the request's response error.

func (InvalidGrantTokenException) String

func (s InvalidGrantTokenException) String() string

String returns the string representation.

API parameter values that are decorated as "sensitive" in the API will not be included in the string output. The member name will be present, but the value will be replaced with "sensitive".

type InvalidImportTokenException

type InvalidImportTokenException struct {
    RespMetadata protocol.ResponseMetadata `json:"-" xml:"-"`

    Message_ *string `locationName:"message" type:"string"`
    // contains filtered or unexported fields
}

The request was rejected because the provided import token is invalid or is associated with a different KMS key.

func (*InvalidImportTokenException) Code

func (s *InvalidImportTokenException) Code() string

Code returns the exception type name.

func (*InvalidImportTokenException) Error

func (s *InvalidImportTokenException) Error() string

func (InvalidImportTokenException) GoString

func (s InvalidImportTokenException) GoString() string

GoString returns the string representation.

API parameter values that are decorated as "sensitive" in the API will not be included in the string output. The member name will be present, but the value will be replaced with "sensitive".

func (*InvalidImportTokenException) Message

func (s *InvalidImportTokenException) Message() string

Message returns the exception's message.

func (*InvalidImportTokenException) OrigErr

func (s *InvalidImportTokenException) OrigErr() error

OrigErr always returns nil, satisfies awserr.Error interface.

func (*InvalidImportTokenException) RequestID

func (s *InvalidImportTokenException) RequestID() string

RequestID returns the service's response RequestID for request.

func (*InvalidImportTokenException) StatusCode

func (s *InvalidImportTokenException) StatusCode() int

Status code returns the HTTP status code for the request's response error.

func (InvalidImportTokenException) String

func (s InvalidImportTokenException) String() string

String returns the string representation.

API parameter values that are decorated as "sensitive" in the API will not be included in the string output. The member name will be present, but the value will be replaced with "sensitive".

type InvalidKeyUsageException

type InvalidKeyUsageException struct {
    RespMetadata protocol.ResponseMetadata `json:"-" xml:"-"`

    Message_ *string `locationName:"message" type:"string"`
    // contains filtered or unexported fields
}

The request was rejected for one of the following reasons:

  • The KeyUsage value of the KMS key is incompatible with the API operation.

  • The encryption algorithm or signing algorithm specified for the operation is incompatible with the type of key material in the KMS key (KeySpec).

For encrypting, decrypting, re-encrypting, and generating data keys, the KeyUsage must be ENCRYPT_DECRYPT. For signing and verifying messages, the KeyUsage must be SIGN_VERIFY. For generating and verifying message authentication codes (MACs), the KeyUsage must be GENERATE_VERIFY_MAC. For deriving key agreement secrets, the KeyUsage must be KEY_AGREEMENT. To find the KeyUsage of a KMS key, use the DescribeKey operation.

To find the encryption or signing algorithms supported for a particular KMS key, use the DescribeKey operation.

func (*InvalidKeyUsageException) Code

func (s *InvalidKeyUsageException) Code() string

Code returns the exception type name.

func (*InvalidKeyUsageException) Error

func (s *InvalidKeyUsageException) Error() string

func (InvalidKeyUsageException) GoString

func (s InvalidKeyUsageException) GoString() string

GoString returns the string representation.

API parameter values that are decorated as "sensitive" in the API will not be included in the string output. The member name will be present, but the value will be replaced with "sensitive".

func (*InvalidKeyUsageException) Message

func (s *InvalidKeyUsageException) Message() string

Message returns the exception's message.

func (*InvalidKeyUsageException) OrigErr

func (s *InvalidKeyUsageException) OrigErr() error

OrigErr always returns nil, satisfies awserr.Error interface.

func (*InvalidKeyUsageException) RequestID

func (s *InvalidKeyUsageException) RequestID() string

RequestID returns the service's response RequestID for request.

func (*InvalidKeyUsageException) StatusCode

func (s *InvalidKeyUsageException) StatusCode() int

Status code returns the HTTP status code for the request's response error.

func (InvalidKeyUsageException) String

func (s InvalidKeyUsageException) String() string

String returns the string representation.

API parameter values that are decorated as "sensitive" in the API will not be included in the string output. The member name will be present, but the value will be replaced with "sensitive".

type InvalidMarkerException

type InvalidMarkerException struct {
    RespMetadata protocol.ResponseMetadata `json:"-" xml:"-"`

    Message_ *string `locationName:"message" type:"string"`
    // contains filtered or unexported fields
}

The request was rejected because the marker that specifies where pagination should next begin is not valid.

func (*InvalidMarkerException) Code

func (s *InvalidMarkerException) Code() string

Code returns the exception type name.

func (*InvalidMarkerException) Error

func (s *InvalidMarkerException) Error() string

func (InvalidMarkerException) GoString

func (s InvalidMarkerException) GoString() string

GoString returns the string representation.

API parameter values that are decorated as "sensitive" in the API will not be included in the string output. The member name will be present, but the value will be replaced with "sensitive".

func (*InvalidMarkerException) Message

func (s *InvalidMarkerException) Message() string

Message returns the exception's message.

func (*InvalidMarkerException) OrigErr

func (s *InvalidMarkerException) OrigErr() error

OrigErr always returns nil, satisfies awserr.Error interface.

func (*InvalidMarkerException) RequestID

func (s *InvalidMarkerException) RequestID() string

RequestID returns the service's response RequestID for request.

func (*InvalidMarkerException) StatusCode

func (s *InvalidMarkerException) StatusCode() int

Status code returns the HTTP status code for the request's response error.

func (InvalidMarkerException) String

func (s InvalidMarkerException) String() string

String returns the string representation.

API parameter values that are decorated as "sensitive" in the API will not be included in the string output. The member name will be present, but the value will be replaced with "sensitive".

type InvalidStateException

type InvalidStateException struct {
    RespMetadata protocol.ResponseMetadata `json:"-" xml:"-"`

    Message_ *string `locationName:"message" type:"string"`
    // contains filtered or unexported fields
}

The request was rejected because the state of the specified resource is not valid for this request.

This exceptions means one of the following:

  • The key state of the KMS key is not compatible with the operation. To find the key state, use the DescribeKey operation. For more information about which key states are compatible with each KMS operation, see Key states of KMS keys (https://docs.aws.amazon.com/kms/latest/developerguide/key-state.html) in the Key Management Service Developer Guide .

  • For cryptographic operations on KMS keys in custom key stores, this exception represents a general failure with many possible causes. To identify the cause, see the error message that accompanies the exception.

func (*InvalidStateException) Code

func (s *InvalidStateException) Code() string

Code returns the exception type name.

func (*InvalidStateException) Error

func (s *InvalidStateException) Error() string

func (InvalidStateException) GoString

func (s InvalidStateException) GoString() string

GoString returns the string representation.

API parameter values that are decorated as "sensitive" in the API will not be included in the string output. The member name will be present, but the value will be replaced with "sensitive".

func (*InvalidStateException) Message

func (s *InvalidStateException) Message() string

Message returns the exception's message.

func (*InvalidStateException) OrigErr

func (s *InvalidStateException) OrigErr() error

OrigErr always returns nil, satisfies awserr.Error interface.

func (*InvalidStateException) RequestID

func (s *InvalidStateException) RequestID() string

RequestID returns the service's response RequestID for request.

func (*InvalidStateException) StatusCode

func (s *InvalidStateException) StatusCode() int

Status code returns the HTTP status code for the request's response error.

func (InvalidStateException) String

func (s InvalidStateException) String() string

String returns the string representation.

API parameter values that are decorated as "sensitive" in the API will not be included in the string output. The member name will be present, but the value will be replaced with "sensitive".

type KMS

type KMS struct {
    *client.Client
}

KMS provides the API operation methods for making requests to AWS Key Management Service. See this package's package overview docs for details on the service.

KMS methods are safe to use concurrently. It is not safe to modify mutate any of the struct's properties though.

func New

func New(p client.ConfigProvider, cfgs ...*aws.Config) *KMS

New creates a new instance of the KMS client with a session. If additional configuration is needed for the client instance use the optional aws.Config parameter to add your extra config.

Example:

mySession := session.Must(session.NewSession())

// Create a KMS client from just a session.
svc := kms.New(mySession)

// Create a KMS client with additional configuration
svc := kms.New(mySession, aws.NewConfig().WithRegion("us-west-2"))

func (*KMS) CancelKeyDeletion

func (c *KMS) CancelKeyDeletion(input *CancelKeyDeletionInput) (*CancelKeyDeletionOutput, error)

CancelKeyDeletion API operation for AWS Key Management Service.

Cancels the deletion of a KMS key. When this operation succeeds, the key state of the KMS key is Disabled. To enable the KMS key, use EnableKey.

For more information about scheduling and canceling deletion of a KMS key, see Deleting KMS keys (https://docs.aws.amazon.com/kms/latest/developerguide/deleting-keys.html) in the Key Management Service Developer Guide.

The KMS key that you use for this operation must be in a compatible key state. For details, see Key states of KMS keys (https://docs.aws.amazon.com/kms/latest/developerguide/key-state.html) in the Key Management Service Developer Guide.

Cross-account use: No. You cannot perform this operation on a KMS key in a different Amazon Web Services account.

Required permissions: kms:CancelKeyDeletion (https://docs.aws.amazon.com/kms/latest/developerguide/kms-api-permissions-reference.html) (key policy)

Related operations: ScheduleKeyDeletion

Eventual consistency: The KMS API follows an eventual consistency model. For more information, see KMS eventual consistency (https://docs.aws.amazon.com/kms/latest/developerguide/programming-eventual-consistency.html).

Returns awserr.Error for service API and SDK errors. Use runtime type assertions with awserr.Error's Code and Message methods to get detailed information about the error.

See the AWS API reference guide for AWS Key Management Service's API operation CancelKeyDeletion for usage and error information.

Returned Error Types:

  • NotFoundException The request was rejected because the specified entity or resource could not be found.

  • InvalidArnException The request was rejected because a specified ARN, or an ARN in a key policy, is not valid.

  • DependencyTimeoutException The system timed out while trying to fulfill the request. You can retry the request.

  • InternalException The request was rejected because an internal exception occurred. The request can be retried.

  • InvalidStateException The request was rejected because the state of the specified resource is not valid for this request.

    This exceptions means one of the following:

  • The key state of the KMS key is not compatible with the operation. To find the key state, use the DescribeKey operation. For more information about which key states are compatible with each KMS operation, see Key states of KMS keys (https://docs.aws.amazon.com/kms/latest/developerguide/key-state.html) in the Key Management Service Developer Guide .

  • For cryptographic operations on KMS keys in custom key stores, this exception represents a general failure with many possible causes. To identify the cause, see the error message that accompanies the exception.

See also, https://docs.aws.amazon.com/goto/WebAPI/kms-2014-11-01/CancelKeyDeletion

Example (Shared00)

To cancel deletion of a KMS key The following example cancels deletion of the specified KMS key.

Code:

svc := kms.New(session.New())
input := &kms.CancelKeyDeletionInput{
    KeyId: aws.String("1234abcd-12ab-34cd-56ef-1234567890ab"),
}

result, err := svc.CancelKeyDeletion(input)
if err != nil {
    if aerr, ok := err.(awserr.Error); ok {
        switch aerr.Code() {
        case kms.ErrCodeNotFoundException:
            fmt.Println(kms.ErrCodeNotFoundException, aerr.Error())
        case kms.ErrCodeInvalidArnException:
            fmt.Println(kms.ErrCodeInvalidArnException, aerr.Error())
        case kms.ErrCodeDependencyTimeoutException:
            fmt.Println(kms.ErrCodeDependencyTimeoutException, aerr.Error())
        case kms.ErrCodeInternalException:
            fmt.Println(kms.ErrCodeInternalException, aerr.Error())
        case kms.ErrCodeInvalidStateException:
            fmt.Println(kms.ErrCodeInvalidStateException, aerr.Error())
        default:
            fmt.Println(aerr.Error())
        }
    } else {
        // Print the error, cast err to awserr.Error to get the Code and
        // Message from an error.
        fmt.Println(err.Error())
    }
    return
}

fmt.Println(result)

func (*KMS) CancelKeyDeletionRequest

func (c *KMS) CancelKeyDeletionRequest(input *CancelKeyDeletionInput) (req *request.Request, output *CancelKeyDeletionOutput)

CancelKeyDeletionRequest generates a "aws/request.Request" representing the client's request for the CancelKeyDeletion operation. The "output" return value will be populated with the request's response once the request completes successfully.

Use "Send" method on the returned Request to send the API call to the service. the "output" return value is not valid until after Send returns without error.

See CancelKeyDeletion for more information on using the CancelKeyDeletion API call, and error handling.

This method is useful when you want to inject custom logic or configuration into the SDK's request lifecycle. Such as custom headers, or retry logic.

// Example sending a request using the CancelKeyDeletionRequest method.
req, resp := client.CancelKeyDeletionRequest(params)

err := req.Send()
if err == nil { // resp is now filled
    fmt.Println(resp)
}

See also, https://docs.aws.amazon.com/goto/WebAPI/kms-2014-11-01/CancelKeyDeletion

func (*KMS) CancelKeyDeletionWithContext

func (c *KMS) CancelKeyDeletionWithContext(ctx aws.Context, input *CancelKeyDeletionInput, opts ...request.Option) (*CancelKeyDeletionOutput, error)

CancelKeyDeletionWithContext is the same as CancelKeyDeletion with the addition of the ability to pass a context and additional request options.

See CancelKeyDeletion for details on how to use this API operation.

The context must be non-nil and will be used for request cancellation. If the context is nil a panic will occur. In the future the SDK may create sub-contexts for http.Requests. See https://golang.org/pkg/context/ for more information on using Contexts.

func (*KMS) ConnectCustomKeyStore

func (c *KMS) ConnectCustomKeyStore(input *ConnectCustomKeyStoreInput) (*ConnectCustomKeyStoreOutput, error)

ConnectCustomKeyStore API operation for AWS Key Management Service.

Connects or reconnects a custom key store (https://docs.aws.amazon.com/kms/latest/developerguide/custom-key-store-overview.html) to its backing key store. For an CloudHSM key store, ConnectCustomKeyStore connects the key store to its associated CloudHSM cluster. For an external key store, ConnectCustomKeyStore connects the key store to the external key store proxy that communicates with your external key manager.

The custom key store must be connected before you can create KMS keys in the key store or use the KMS keys it contains. You can disconnect and reconnect a custom key store at any time.

The connection process for a custom key store can take an extended amount of time to complete. This operation starts the connection process, but it does not wait for it to complete. When it succeeds, this operation quickly returns an HTTP 200 response and a JSON object with no properties. However, this response does not indicate that the custom key store is connected. To get the connection state of the custom key store, use the DescribeCustomKeyStores operation.

This operation is part of the custom key stores (https://docs.aws.amazon.com/kms/latest/developerguide/custom-key-store-overview.html) feature in KMS, which combines the convenience and extensive integration of KMS with the isolation and control of a key store that you own and manage.

The ConnectCustomKeyStore operation might fail for various reasons. To find the reason, use the DescribeCustomKeyStores operation and see the ConnectionErrorCode in the response. For help interpreting the ConnectionErrorCode, see CustomKeyStoresListEntry.

To fix the failure, use the DisconnectCustomKeyStore operation to disconnect the custom key store, correct the error, use the UpdateCustomKeyStore operation if necessary, and then use ConnectCustomKeyStore again.

CloudHSM key store

During the connection process for an CloudHSM key store, KMS finds the CloudHSM cluster that is associated with the custom key store, creates the connection infrastructure, connects to the cluster, logs into the CloudHSM client as the kmsuser CU, and rotates its password.

To connect an CloudHSM key store, its associated CloudHSM cluster must have at least one active HSM. To get the number of active HSMs in a cluster, use the DescribeClusters (https://docs.aws.amazon.com/cloudhsm/latest/APIReference/API_DescribeClusters.html) operation. To add HSMs to the cluster, use the CreateHsm (https://docs.aws.amazon.com/cloudhsm/latest/APIReference/API_CreateHsm.html) operation. Also, the kmsuser crypto user (https://docs.aws.amazon.com/kms/latest/developerguide/key-store-concepts.html#concept-kmsuser) (CU) must not be logged into the cluster. This prevents KMS from using this account to log in.

If you are having trouble connecting or disconnecting a CloudHSM key store, see Troubleshooting an CloudHSM key store (https://docs.aws.amazon.com/kms/latest/developerguide/fix-keystore.html) in the Key Management Service Developer Guide.

External key store

When you connect an external key store that uses public endpoint connectivity, KMS tests its ability to communicate with your external key manager by sending a request via the external key store proxy.

When you connect to an external key store that uses VPC endpoint service connectivity, KMS establishes the networking elements that it needs to communicate with your external key manager via the external key store proxy. This includes creating an interface endpoint to the VPC endpoint service and a private hosted zone for traffic between KMS and the VPC endpoint service.

To connect an external key store, KMS must be able to connect to the external key store proxy, the external key store proxy must be able to communicate with your external key manager, and the external key manager must be available for cryptographic operations.

If you are having trouble connecting or disconnecting an external key store, see Troubleshooting an external key store (https://docs.aws.amazon.com/kms/latest/developerguide/xks-troubleshooting.html) in the Key Management Service Developer Guide.

Cross-account use: No. You cannot perform this operation on a custom key store in a different Amazon Web Services account.

Required permissions: kms:ConnectCustomKeyStore (https://docs.aws.amazon.com/kms/latest/developerguide/kms-api-permissions-reference.html) (IAM policy)

Related operations

  • CreateCustomKeyStore

  • DeleteCustomKeyStore

  • DescribeCustomKeyStores

  • DisconnectCustomKeyStore

  • UpdateCustomKeyStore

Eventual consistency: The KMS API follows an eventual consistency model. For more information, see KMS eventual consistency (https://docs.aws.amazon.com/kms/latest/developerguide/programming-eventual-consistency.html).

Returns awserr.Error for service API and SDK errors. Use runtime type assertions with awserr.Error's Code and Message methods to get detailed information about the error.

See the AWS API reference guide for AWS Key Management Service's API operation ConnectCustomKeyStore for usage and error information.

Returned Error Types:

  • CloudHsmClusterNotActiveException The request was rejected because the CloudHSM cluster associated with the CloudHSM key store is not active. Initialize and activate the cluster and try the command again. For detailed instructions, see Getting Started (https://docs.aws.amazon.com/cloudhsm/latest/userguide/getting-started.html) in the CloudHSM User Guide.

  • CustomKeyStoreInvalidStateException The request was rejected because of the ConnectionState of the custom key store. To get the ConnectionState of a custom key store, use the DescribeCustomKeyStores operation.

    This exception is thrown under the following conditions:

  • You requested the ConnectCustomKeyStore operation on a custom key store with a ConnectionState of DISCONNECTING or FAILED. This operation is valid for all other ConnectionState values. To reconnect a custom key store in a FAILED state, disconnect it (DisconnectCustomKeyStore), then connect it (ConnectCustomKeyStore).

  • You requested the CreateKey operation in a custom key store that is not connected. This operations is valid only when the custom key store ConnectionState is CONNECTED.

  • You requested the DisconnectCustomKeyStore operation on a custom key store with a ConnectionState of DISCONNECTING or DISCONNECTED. This operation is valid for all other ConnectionState values.

  • You requested the UpdateCustomKeyStore or DeleteCustomKeyStore operation on a custom key store that is not disconnected. This operation is valid only when the custom key store ConnectionState is DISCONNECTED.

  • You requested the GenerateRandom operation in an CloudHSM key store that is not connected. This operation is valid only when the CloudHSM key store ConnectionState is CONNECTED.

  • CustomKeyStoreNotFoundException The request was rejected because KMS cannot find a custom key store with the specified key store name or ID.

  • InternalException The request was rejected because an internal exception occurred. The request can be retried.

  • CloudHsmClusterInvalidConfigurationException The request was rejected because the associated CloudHSM cluster did not meet the configuration requirements for an CloudHSM key store.

  • The CloudHSM cluster must be configured with private subnets in at least two different Availability Zones in the Region.

  • The security group for the cluster (https://docs.aws.amazon.com/cloudhsm/latest/userguide/configure-sg.html) (cloudhsm-cluster-<cluster-id>-sg) must include inbound rules and outbound rules that allow TCP traffic on ports 2223-2225. The Source in the inbound rules and the Destination in the outbound rules must match the security group ID. These rules are set by default when you create the CloudHSM cluster. Do not delete or change them. To get information about a particular security group, use the DescribeSecurityGroups (https://docs.aws.amazon.com/AWSEC2/latest/APIReference/API_DescribeSecurityGroups.html) operation.

  • The CloudHSM cluster must contain at least as many HSMs as the operation requires. To add HSMs, use the CloudHSM CreateHsm (https://docs.aws.amazon.com/cloudhsm/latest/APIReference/API_CreateHsm.html) operation. For the CreateCustomKeyStore, UpdateCustomKeyStore, and CreateKey operations, the CloudHSM cluster must have at least two active HSMs, each in a different Availability Zone. For the ConnectCustomKeyStore operation, the CloudHSM must contain at least one active HSM.

    For information about the requirements for an CloudHSM cluster that is associated with an CloudHSM key store, see Assemble the Prerequisites (https://docs.aws.amazon.com/kms/latest/developerguide/create-keystore.html#before-keystore) in the Key Management Service Developer Guide. For information about creating a private subnet for an CloudHSM cluster, see Create a Private Subnet (https://docs.aws.amazon.com/cloudhsm/latest/userguide/create-subnets.html) in the CloudHSM User Guide. For information about cluster security groups, see Configure a Default Security Group (https://docs.aws.amazon.com/cloudhsm/latest/userguide/configure-sg.html) in the CloudHSM User Guide .

See also, https://docs.aws.amazon.com/goto/WebAPI/kms-2014-11-01/ConnectCustomKeyStore

Example (Shared00)

To connect a custom key store This example connects an AWS KMS custom key store to its backing key store. For an AWS CloudHSM key store, it connects the key store to its AWS CloudHSM cluster. For an external key store, it connects the key store to the external key store proxy that communicates with your external key manager. This operation does not return any data. To verify that the custom key store is connected, use the <code>DescribeCustomKeyStores</code> operation.

Code:

svc := kms.New(session.New())
input := &kms.ConnectCustomKeyStoreInput{
    CustomKeyStoreId: aws.String("cks-1234567890abcdef0"),
}

result, err := svc.ConnectCustomKeyStore(input)
if err != nil {
    if aerr, ok := err.(awserr.Error); ok {
        switch aerr.Code() {
        case kms.ErrCodeCloudHsmClusterNotActiveException:
            fmt.Println(kms.ErrCodeCloudHsmClusterNotActiveException, aerr.Error())
        case kms.ErrCodeCustomKeyStoreInvalidStateException:
            fmt.Println(kms.ErrCodeCustomKeyStoreInvalidStateException, aerr.Error())
        case kms.ErrCodeCustomKeyStoreNotFoundException:
            fmt.Println(kms.ErrCodeCustomKeyStoreNotFoundException, aerr.Error())
        case kms.ErrCodeInternalException:
            fmt.Println(kms.ErrCodeInternalException, aerr.Error())
        case kms.ErrCodeCloudHsmClusterInvalidConfigurationException:
            fmt.Println(kms.ErrCodeCloudHsmClusterInvalidConfigurationException, aerr.Error())
        default:
            fmt.Println(aerr.Error())
        }
    } else {
        // Print the error, cast err to awserr.Error to get the Code and
        // Message from an error.
        fmt.Println(err.Error())
    }
    return
}

fmt.Println(result)

func (*KMS) ConnectCustomKeyStoreRequest

func (c *KMS) ConnectCustomKeyStoreRequest(input *ConnectCustomKeyStoreInput) (req *request.Request, output *ConnectCustomKeyStoreOutput)

ConnectCustomKeyStoreRequest generates a "aws/request.Request" representing the client's request for the ConnectCustomKeyStore operation. The "output" return value will be populated with the request's response once the request completes successfully.

Use "Send" method on the returned Request to send the API call to the service. the "output" return value is not valid until after Send returns without error.

See ConnectCustomKeyStore for more information on using the ConnectCustomKeyStore API call, and error handling.

This method is useful when you want to inject custom logic or configuration into the SDK's request lifecycle. Such as custom headers, or retry logic.

// Example sending a request using the ConnectCustomKeyStoreRequest method.
req, resp := client.ConnectCustomKeyStoreRequest(params)

err := req.Send()
if err == nil { // resp is now filled
    fmt.Println(resp)
}

See also, https://docs.aws.amazon.com/goto/WebAPI/kms-2014-11-01/ConnectCustomKeyStore

func (*KMS) ConnectCustomKeyStoreWithContext

func (c *KMS) ConnectCustomKeyStoreWithContext(ctx aws.Context, input *ConnectCustomKeyStoreInput, opts ...request.Option) (*ConnectCustomKeyStoreOutput, error)

ConnectCustomKeyStoreWithContext is the same as ConnectCustomKeyStore with the addition of the ability to pass a context and additional request options.

See ConnectCustomKeyStore for details on how to use this API operation.

The context must be non-nil and will be used for request cancellation. If the context is nil a panic will occur. In the future the SDK may create sub-contexts for http.Requests. See https://golang.org/pkg/context/ for more information on using Contexts.

func (*KMS) CreateAlias

func (c *KMS) CreateAlias(input *CreateAliasInput) (*CreateAliasOutput, error)

CreateAlias API operation for AWS Key Management Service.

Creates a friendly name for a KMS key.

Adding, deleting, or updating an alias can allow or deny permission to the KMS key. For details, see ABAC for KMS (https://docs.aws.amazon.com/kms/latest/developerguide/abac.html) in the Key Management Service Developer Guide.

You can use an alias to identify a KMS key in the KMS console, in the DescribeKey operation and in cryptographic operations (https://docs.aws.amazon.com/kms/latest/developerguide/concepts.html#cryptographic-operations), such as Encrypt and GenerateDataKey. You can also change the KMS key that's associated with the alias (UpdateAlias) or delete the alias (DeleteAlias) at any time. These operations don't affect the underlying KMS key.

You can associate the alias with any customer managed key in the same Amazon Web Services Region. Each alias is associated with only one KMS key at a time, but a KMS key can have multiple aliases. A valid KMS key is required. You can't create an alias without a KMS key.

The alias must be unique in the account and Region, but you can have aliases with the same name in different Regions. For detailed information about aliases, see Using aliases (https://docs.aws.amazon.com/kms/latest/developerguide/kms-alias.html) in the Key Management Service Developer Guide.

This operation does not return a response. To get the alias that you created, use the ListAliases operation.

The KMS key that you use for this operation must be in a compatible key state. For details, see Key states of KMS keys (https://docs.aws.amazon.com/kms/latest/developerguide/key-state.html) in the Key Management Service Developer Guide.

Cross-account use: No. You cannot perform this operation on an alias in a different Amazon Web Services account.

Required permissions

For details, see Controlling access to aliases (https://docs.aws.amazon.com/kms/latest/developerguide/kms-alias.html#alias-access) in the Key Management Service Developer Guide.

Related operations:

  • DeleteAlias

  • ListAliases

  • UpdateAlias

Eventual consistency: The KMS API follows an eventual consistency model. For more information, see KMS eventual consistency (https://docs.aws.amazon.com/kms/latest/developerguide/programming-eventual-consistency.html).

Returns awserr.Error for service API and SDK errors. Use runtime type assertions with awserr.Error's Code and Message methods to get detailed information about the error.

See the AWS API reference guide for AWS Key Management Service's API operation CreateAlias for usage and error information.

Returned Error Types:

  • DependencyTimeoutException The system timed out while trying to fulfill the request. You can retry the request.

  • AlreadyExistsException The request was rejected because it attempted to create a resource that already exists.

  • NotFoundException The request was rejected because the specified entity or resource could not be found.

  • InvalidAliasNameException The request was rejected because the specified alias name is not valid.

  • InternalException The request was rejected because an internal exception occurred. The request can be retried.

  • LimitExceededException The request was rejected because a quota was exceeded. For more information, see Quotas (https://docs.aws.amazon.com/kms/latest/developerguide/limits.html) in the Key Management Service Developer Guide.

  • InvalidStateException The request was rejected because the state of the specified resource is not valid for this request.

    This exceptions means one of the following:

  • The key state of the KMS key is not compatible with the operation. To find the key state, use the DescribeKey operation. For more information about which key states are compatible with each KMS operation, see Key states of KMS keys (https://docs.aws.amazon.com/kms/latest/developerguide/key-state.html) in the Key Management Service Developer Guide .

  • For cryptographic operations on KMS keys in custom key stores, this exception represents a general failure with many possible causes. To identify the cause, see the error message that accompanies the exception.

See also, https://docs.aws.amazon.com/goto/WebAPI/kms-2014-11-01/CreateAlias

Example (Shared00)

To create an alias The following example creates an alias for the specified KMS key.

Code:

svc := kms.New(session.New())
input := &kms.CreateAliasInput{
    AliasName:   aws.String("alias/ExampleAlias"),
    TargetKeyId: aws.String("1234abcd-12ab-34cd-56ef-1234567890ab"),
}

result, err := svc.CreateAlias(input)
if err != nil {
    if aerr, ok := err.(awserr.Error); ok {
        switch aerr.Code() {
        case kms.ErrCodeDependencyTimeoutException:
            fmt.Println(kms.ErrCodeDependencyTimeoutException, aerr.Error())
        case kms.ErrCodeAlreadyExistsException:
            fmt.Println(kms.ErrCodeAlreadyExistsException, aerr.Error())
        case kms.ErrCodeNotFoundException:
            fmt.Println(kms.ErrCodeNotFoundException, aerr.Error())
        case kms.ErrCodeInvalidAliasNameException:
            fmt.Println(kms.ErrCodeInvalidAliasNameException, aerr.Error())
        case kms.ErrCodeInternalException:
            fmt.Println(kms.ErrCodeInternalException, aerr.Error())
        case kms.ErrCodeLimitExceededException:
            fmt.Println(kms.ErrCodeLimitExceededException, aerr.Error())
        case kms.ErrCodeInvalidStateException:
            fmt.Println(kms.ErrCodeInvalidStateException, aerr.Error())
        default:
            fmt.Println(aerr.Error())
        }
    } else {
        // Print the error, cast err to awserr.Error to get the Code and
        // Message from an error.
        fmt.Println(err.Error())
    }
    return
}

fmt.Println(result)

func (*KMS) CreateAliasRequest

func (c *KMS) CreateAliasRequest(input *CreateAliasInput) (req *request.Request, output *CreateAliasOutput)

CreateAliasRequest generates a "aws/request.Request" representing the client's request for the CreateAlias operation. The "output" return value will be populated with the request's response once the request completes successfully.

Use "Send" method on the returned Request to send the API call to the service. the "output" return value is not valid until after Send returns without error.

See CreateAlias for more information on using the CreateAlias API call, and error handling.

This method is useful when you want to inject custom logic or configuration into the SDK's request lifecycle. Such as custom headers, or retry logic.

// Example sending a request using the CreateAliasRequest method.
req, resp := client.CreateAliasRequest(params)

err := req.Send()
if err == nil { // resp is now filled
    fmt.Println(resp)
}

See also, https://docs.aws.amazon.com/goto/WebAPI/kms-2014-11-01/CreateAlias

func (*KMS) CreateAliasWithContext

func (c *KMS) CreateAliasWithContext(ctx aws.Context, input *CreateAliasInput, opts ...request.Option) (*CreateAliasOutput, error)

CreateAliasWithContext is the same as CreateAlias with the addition of the ability to pass a context and additional request options.

See CreateAlias for details on how to use this API operation.

The context must be non-nil and will be used for request cancellation. If the context is nil a panic will occur. In the future the SDK may create sub-contexts for http.Requests. See https://golang.org/pkg/context/ for more information on using Contexts.

func (*KMS) CreateCustomKeyStore

func (c *KMS) CreateCustomKeyStore(input *CreateCustomKeyStoreInput) (*CreateCustomKeyStoreOutput, error)

CreateCustomKeyStore API operation for AWS Key Management Service.

Creates a custom key store (https://docs.aws.amazon.com/kms/latest/developerguide/custom-key-store-overview.html) backed by a key store that you own and manage. When you use a KMS key in a custom key store for a cryptographic operation, the cryptographic operation is actually performed in your key store using your keys. KMS supports CloudHSM key stores (https://docs.aws.amazon.com/kms/latest/developerguide/keystore-cloudhsm.html) backed by an CloudHSM cluster (https://docs.aws.amazon.com/cloudhsm/latest/userguide/clusters.html) and external key stores (https://docs.aws.amazon.com/kms/latest/developerguide/keystore-external.html) backed by an external key store proxy and external key manager outside of Amazon Web Services.

This operation is part of the custom key stores (https://docs.aws.amazon.com/kms/latest/developerguide/custom-key-store-overview.html) feature in KMS, which combines the convenience and extensive integration of KMS with the isolation and control of a key store that you own and manage.

Before you create the custom key store, the required elements must be in place and operational. We recommend that you use the test tools that KMS provides to verify the configuration your external key store proxy. For details about the required elements and verification tests, see Assemble the prerequisites (for CloudHSM key stores) (https://docs.aws.amazon.com/kms/latest/developerguide/create-keystore.html#before-keystore) or Assemble the prerequisites (for external key stores) (https://docs.aws.amazon.com/kms/latest/developerguide/create-xks-keystore.html#xks-requirements) in the Key Management Service Developer Guide.

To create a custom key store, use the following parameters.

  • To create an CloudHSM key store, specify the CustomKeyStoreName, CloudHsmClusterId, KeyStorePassword, and TrustAnchorCertificate. The CustomKeyStoreType parameter is optional for CloudHSM key stores. If you include it, set it to the default value, AWS_CLOUDHSM. For help with failures, see Troubleshooting an CloudHSM key store (https://docs.aws.amazon.com/kms/latest/developerguide/fix-keystore.html) in the Key Management Service Developer Guide.

  • To create an external key store, specify the CustomKeyStoreName and a CustomKeyStoreType of EXTERNAL_KEY_STORE. Also, specify values for XksProxyConnectivity, XksProxyAuthenticationCredential, XksProxyUriEndpoint, and XksProxyUriPath. If your XksProxyConnectivity value is VPC_ENDPOINT_SERVICE, specify the XksProxyVpcEndpointServiceName parameter. For help with failures, see Troubleshooting an external key store (https://docs.aws.amazon.com/kms/latest/developerguide/xks-troubleshooting.html) in the Key Management Service Developer Guide.

For external key stores:

Some external key managers provide a simpler method for creating an external key store. For details, see your external key manager documentation.

When creating an external key store in the KMS console, you can upload a JSON-based proxy configuration file with the desired values. You cannot use a proxy configuration with the CreateCustomKeyStore operation. However, you can use the values in the file to help you determine the correct values for the CreateCustomKeyStore parameters.

When the operation completes successfully, it returns the ID of the new custom key store. Before you can use your new custom key store, you need to use the ConnectCustomKeyStore operation to connect a new CloudHSM key store to its CloudHSM cluster, or to connect a new external key store to the external key store proxy for your external key manager. Even if you are not going to use your custom key store immediately, you might want to connect it to verify that all settings are correct and then disconnect it until you are ready to use it.

For help with failures, see Troubleshooting a custom key store (https://docs.aws.amazon.com/kms/latest/developerguide/fix-keystore.html) in the Key Management Service Developer Guide.

Cross-account use: No. You cannot perform this operation on a custom key store in a different Amazon Web Services account.

Required permissions: kms:CreateCustomKeyStore (https://docs.aws.amazon.com/kms/latest/developerguide/kms-api-permissions-reference.html) (IAM policy).

Related operations:

  • ConnectCustomKeyStore

  • DeleteCustomKeyStore

  • DescribeCustomKeyStores

  • DisconnectCustomKeyStore

  • UpdateCustomKeyStore

Eventual consistency: The KMS API follows an eventual consistency model. For more information, see KMS eventual consistency (https://docs.aws.amazon.com/kms/latest/developerguide/programming-eventual-consistency.html).

Returns awserr.Error for service API and SDK errors. Use runtime type assertions with awserr.Error's Code and Message methods to get detailed information about the error.

See the AWS API reference guide for AWS Key Management Service's API operation CreateCustomKeyStore for usage and error information.

Returned Error Types:

  • CloudHsmClusterInUseException The request was rejected because the specified CloudHSM cluster is already associated with an CloudHSM key store in the account, or it shares a backup history with an CloudHSM key store in the account. Each CloudHSM key store in the account must be associated with a different CloudHSM cluster.

    CloudHSM clusters that share a backup history have the same cluster certificate. To view the cluster certificate of an CloudHSM cluster, use the DescribeClusters (https://docs.aws.amazon.com/cloudhsm/latest/APIReference/API_DescribeClusters.html) operation.

  • CustomKeyStoreNameInUseException The request was rejected because the specified custom key store name is already assigned to another custom key store in the account. Try again with a custom key store name that is unique in the account.

  • CloudHsmClusterNotFoundException The request was rejected because KMS cannot find the CloudHSM cluster with the specified cluster ID. Retry the request with a different cluster ID.

  • InternalException The request was rejected because an internal exception occurred. The request can be retried.

  • CloudHsmClusterNotActiveException The request was rejected because the CloudHSM cluster associated with the CloudHSM key store is not active. Initialize and activate the cluster and try the command again. For detailed instructions, see Getting Started (https://docs.aws.amazon.com/cloudhsm/latest/userguide/getting-started.html) in the CloudHSM User Guide.

  • IncorrectTrustAnchorException The request was rejected because the trust anchor certificate in the request to create an CloudHSM key store is not the trust anchor certificate for the specified CloudHSM cluster.

    When you initialize the CloudHSM cluster (https://docs.aws.amazon.com/cloudhsm/latest/userguide/initialize-cluster.html#sign-csr), you create the trust anchor certificate and save it in the customerCA.crt file.

  • CloudHsmClusterInvalidConfigurationException The request was rejected because the associated CloudHSM cluster did not meet the configuration requirements for an CloudHSM key store.

  • The CloudHSM cluster must be configured with private subnets in at least two different Availability Zones in the Region.

  • The security group for the cluster (https://docs.aws.amazon.com/cloudhsm/latest/userguide/configure-sg.html) (cloudhsm-cluster-<cluster-id>-sg) must include inbound rules and outbound rules that allow TCP traffic on ports 2223-2225. The Source in the inbound rules and the Destination in the outbound rules must match the security group ID. These rules are set by default when you create the CloudHSM cluster. Do not delete or change them. To get information about a particular security group, use the DescribeSecurityGroups (https://docs.aws.amazon.com/AWSEC2/latest/APIReference/API_DescribeSecurityGroups.html) operation.

  • The CloudHSM cluster must contain at least as many HSMs as the operation requires. To add HSMs, use the CloudHSM CreateHsm (https://docs.aws.amazon.com/cloudhsm/latest/APIReference/API_CreateHsm.html) operation. For the CreateCustomKeyStore, UpdateCustomKeyStore, and CreateKey operations, the CloudHSM cluster must have at least two active HSMs, each in a different Availability Zone. For the ConnectCustomKeyStore operation, the CloudHSM must contain at least one active HSM.

    For information about the requirements for an CloudHSM cluster that is associated with an CloudHSM key store, see Assemble the Prerequisites (https://docs.aws.amazon.com/kms/latest/developerguide/create-keystore.html#before-keystore) in the Key Management Service Developer Guide. For information about creating a private subnet for an CloudHSM cluster, see Create a Private Subnet (https://docs.aws.amazon.com/cloudhsm/latest/userguide/create-subnets.html) in the CloudHSM User Guide. For information about cluster security groups, see Configure a Default Security Group (https://docs.aws.amazon.com/cloudhsm/latest/userguide/configure-sg.html) in the CloudHSM User Guide .

  • LimitExceededException The request was rejected because a quota was exceeded. For more information, see Quotas (https://docs.aws.amazon.com/kms/latest/developerguide/limits.html) in the Key Management Service Developer Guide.

  • XksProxyUriInUseException The request was rejected because the concatenation of the XksProxyUriEndpoint and XksProxyUriPath is already associated with another external key store in this Amazon Web Services Region. Each external key store in a Region must use a unique external key store proxy API address.

  • XksProxyUriEndpointInUseException The request was rejected because the XksProxyUriEndpoint is already associated with another external key store in this Amazon Web Services Region. To identify the cause, see the error message that accompanies the exception.

  • XksProxyUriUnreachableException KMS was unable to reach the specified XksProxyUriPath. The path must be reachable before you create the external key store or update its settings.

    This exception is also thrown when the external key store proxy response to a GetHealthStatus request indicates that all external key manager instances are unavailable.

  • XksProxyIncorrectAuthenticationCredentialException The request was rejected because the proxy credentials failed to authenticate to the specified external key store proxy. The specified external key store proxy rejected a status request from KMS due to invalid credentials. This can indicate an error in the credentials or in the identification of the external key store proxy.

  • XksProxyVpcEndpointServiceInUseException The request was rejected because the specified Amazon VPC endpoint service is already associated with another external key store in this Amazon Web Services Region. Each external key store in a Region must use a different Amazon VPC endpoint service.

  • XksProxyVpcEndpointServiceNotFoundException The request was rejected because KMS could not find the specified VPC endpoint service. Use DescribeCustomKeyStores to verify the VPC endpoint service name for the external key store. Also, confirm that the Allow principals list for the VPC endpoint service includes the KMS service principal for the Region, such as cks.kms.us-east-1.amazonaws.com.

  • XksProxyVpcEndpointServiceInvalidConfigurationException The request was rejected because the Amazon VPC endpoint service configuration does not fulfill the requirements for an external key store. To identify the cause, see the error message that accompanies the exception and review the requirements (https://docs.aws.amazon.com/kms/latest/developerguide/vpc-connectivity.html#xks-vpc-requirements) for Amazon VPC endpoint service connectivity for an external key store.

  • XksProxyInvalidResponseException

    KMS cannot interpret the response it received from the external key store proxy. The problem might be a poorly constructed response, but it could also be a transient network issue. If you see this error repeatedly, report it to the proxy vendor.

  • XksProxyInvalidConfigurationException The request was rejected because the external key store proxy is not configured correctly. To identify the cause, see the error message that accompanies the exception.

See also, https://docs.aws.amazon.com/goto/WebAPI/kms-2014-11-01/CreateCustomKeyStore

Example (Shared00)

To create an AWS CloudHSM key store This example creates a custom key store that is associated with an AWS CloudHSM cluster.

Code:

svc := kms.New(session.New())
input := &kms.CreateCustomKeyStoreInput{
    CloudHsmClusterId:      aws.String("cluster-234abcdefABC"),
    CustomKeyStoreName:     aws.String("ExampleKeyStore"),
    KeyStorePassword:       aws.String("kmsPswd"),
    TrustAnchorCertificate: aws.String("<certificate-goes-here>"),
}

result, err := svc.CreateCustomKeyStore(input)
if err != nil {
    if aerr, ok := err.(awserr.Error); ok {
        switch aerr.Code() {
        case kms.ErrCodeCloudHsmClusterInUseException:
            fmt.Println(kms.ErrCodeCloudHsmClusterInUseException, aerr.Error())
        case kms.ErrCodeCustomKeyStoreNameInUseException:
            fmt.Println(kms.ErrCodeCustomKeyStoreNameInUseException, aerr.Error())
        case kms.ErrCodeCloudHsmClusterNotFoundException:
            fmt.Println(kms.ErrCodeCloudHsmClusterNotFoundException, aerr.Error())
        case kms.ErrCodeInternalException:
            fmt.Println(kms.ErrCodeInternalException, aerr.Error())
        case kms.ErrCodeCloudHsmClusterNotActiveException:
            fmt.Println(kms.ErrCodeCloudHsmClusterNotActiveException, aerr.Error())
        case kms.ErrCodeIncorrectTrustAnchorException:
            fmt.Println(kms.ErrCodeIncorrectTrustAnchorException, aerr.Error())
        case kms.ErrCodeCloudHsmClusterInvalidConfigurationException:
            fmt.Println(kms.ErrCodeCloudHsmClusterInvalidConfigurationException, aerr.Error())
        case kms.ErrCodeLimitExceededException:
            fmt.Println(kms.ErrCodeLimitExceededException, aerr.Error())
        case kms.ErrCodeXksProxyUriInUseException:
            fmt.Println(kms.ErrCodeXksProxyUriInUseException, aerr.Error())
        case kms.ErrCodeXksProxyUriEndpointInUseException:
            fmt.Println(kms.ErrCodeXksProxyUriEndpointInUseException, aerr.Error())
        case kms.ErrCodeXksProxyUriUnreachableException:
            fmt.Println(kms.ErrCodeXksProxyUriUnreachableException, aerr.Error())
        case kms.ErrCodeXksProxyIncorrectAuthenticationCredentialException:
            fmt.Println(kms.ErrCodeXksProxyIncorrectAuthenticationCredentialException, aerr.Error())
        case kms.ErrCodeXksProxyVpcEndpointServiceInUseException:
            fmt.Println(kms.ErrCodeXksProxyVpcEndpointServiceInUseException, aerr.Error())
        case kms.ErrCodeXksProxyVpcEndpointServiceNotFoundException:
            fmt.Println(kms.ErrCodeXksProxyVpcEndpointServiceNotFoundException, aerr.Error())
        case kms.ErrCodeXksProxyVpcEndpointServiceInvalidConfigurationException:
            fmt.Println(kms.ErrCodeXksProxyVpcEndpointServiceInvalidConfigurationException, aerr.Error())
        case kms.ErrCodeXksProxyInvalidResponseException:
            fmt.Println(kms.ErrCodeXksProxyInvalidResponseException, aerr.Error())
        case kms.ErrCodeXksProxyInvalidConfigurationException:
            fmt.Println(kms.ErrCodeXksProxyInvalidConfigurationException, aerr.Error())
        default:
            fmt.Println(aerr.Error())
        }
    } else {
        // Print the error, cast err to awserr.Error to get the Code and
        // Message from an error.
        fmt.Println(err.Error())
    }
    return
}

fmt.Println(result)

Example (Shared01)

To create an external key store with VPC endpoint service connectivity This example creates an external key store that uses an Amazon VPC endpoint service to communicate with AWS KMS.

Code:

svc := kms.New(session.New())
input := &kms.CreateCustomKeyStoreInput{
    CustomKeyStoreName: aws.String("ExampleVPCEndpointKeyStore"),
    CustomKeyStoreType: aws.String("EXTERNAL_KEY_STORE"),
    XksProxyAuthenticationCredential: &kms.XksProxyAuthenticationCredentialType{
        AccessKeyId:        aws.String("ABCDE12345670EXAMPLE"),
        RawSecretAccessKey: aws.String("DXjSUawnel2fr6SKC7G25CNxTyWKE5PF9XX6H/u9pSo="),
    },
    XksProxyConnectivity:           aws.String("VPC_ENDPOINT_SERVICE"),
    XksProxyUriEndpoint:            aws.String("https://myproxy-private.xks.example.com"),
    XksProxyUriPath:                aws.String("/example-prefix/kms/xks/v1"),
    XksProxyVpcEndpointServiceName: aws.String("com.amazonaws.vpce.us-east-1.vpce-svc-example1"),
}

result, err := svc.CreateCustomKeyStore(input)
if err != nil {
    if aerr, ok := err.(awserr.Error); ok {
        switch aerr.Code() {
        case kms.ErrCodeCloudHsmClusterInUseException:
            fmt.Println(kms.ErrCodeCloudHsmClusterInUseException, aerr.Error())
        case kms.ErrCodeCustomKeyStoreNameInUseException:
            fmt.Println(kms.ErrCodeCustomKeyStoreNameInUseException, aerr.Error())
        case kms.ErrCodeCloudHsmClusterNotFoundException:
            fmt.Println(kms.ErrCodeCloudHsmClusterNotFoundException, aerr.Error())
        case kms.ErrCodeInternalException:
            fmt.Println(kms.ErrCodeInternalException, aerr.Error())
        case kms.ErrCodeCloudHsmClusterNotActiveException:
            fmt.Println(kms.ErrCodeCloudHsmClusterNotActiveException, aerr.Error())
        case kms.ErrCodeIncorrectTrustAnchorException:
            fmt.Println(kms.ErrCodeIncorrectTrustAnchorException, aerr.Error())
        case kms.ErrCodeCloudHsmClusterInvalidConfigurationException:
            fmt.Println(kms.ErrCodeCloudHsmClusterInvalidConfigurationException, aerr.Error())
        case kms.ErrCodeLimitExceededException:
            fmt.Println(kms.ErrCodeLimitExceededException, aerr.Error())
        case kms.ErrCodeXksProxyUriInUseException:
            fmt.Println(kms.ErrCodeXksProxyUriInUseException, aerr.Error())
        case kms.ErrCodeXksProxyUriEndpointInUseException:
            fmt.Println(kms.ErrCodeXksProxyUriEndpointInUseException, aerr.Error())
        case kms.ErrCodeXksProxyUriUnreachableException:
            fmt.Println(kms.ErrCodeXksProxyUriUnreachableException, aerr.Error())
        case kms.ErrCodeXksProxyIncorrectAuthenticationCredentialException:
            fmt.Println(kms.ErrCodeXksProxyIncorrectAuthenticationCredentialException, aerr.Error())
        case kms.ErrCodeXksProxyVpcEndpointServiceInUseException:
            fmt.Println(kms.ErrCodeXksProxyVpcEndpointServiceInUseException, aerr.Error())
        case kms.ErrCodeXksProxyVpcEndpointServiceNotFoundException:
            fmt.Println(kms.ErrCodeXksProxyVpcEndpointServiceNotFoundException, aerr.Error())
        case kms.ErrCodeXksProxyVpcEndpointServiceInvalidConfigurationException:
            fmt.Println(kms.ErrCodeXksProxyVpcEndpointServiceInvalidConfigurationException, aerr.Error())
        case kms.ErrCodeXksProxyInvalidResponseException:
            fmt.Println(kms.ErrCodeXksProxyInvalidResponseException, aerr.Error())
        case kms.ErrCodeXksProxyInvalidConfigurationException:
            fmt.Println(kms.ErrCodeXksProxyInvalidConfigurationException, aerr.Error())
        default:
            fmt.Println(aerr.Error())
        }
    } else {
        // Print the error, cast err to awserr.Error to get the Code and
        // Message from an error.
        fmt.Println(err.Error())
    }
    return
}

fmt.Println(result)

Example (Shared02)

To create an external key store with public endpoint connectivity This example creates an external key store with public endpoint connectivity.

Code:

svc := kms.New(session.New())
input := &kms.CreateCustomKeyStoreInput{
    CustomKeyStoreName: aws.String("ExamplePublicEndpointKeyStore"),
    CustomKeyStoreType: aws.String("EXTERNAL_KEY_STORE"),
    XksProxyAuthenticationCredential: &kms.XksProxyAuthenticationCredentialType{
        AccessKeyId:        aws.String("ABCDE12345670EXAMPLE"),
        RawSecretAccessKey: aws.String("DXjSUawnel2fr6SKC7G25CNxTyWKE5PF9XX6H/u9pSo="),
    },
    XksProxyConnectivity: aws.String("PUBLIC_ENDPOINT"),
    XksProxyUriEndpoint:  aws.String("https://myproxy.xks.example.com"),
    XksProxyUriPath:      aws.String("/kms/xks/v1"),
}

result, err := svc.CreateCustomKeyStore(input)
if err != nil {
    if aerr, ok := err.(awserr.Error); ok {
        switch aerr.Code() {
        case kms.ErrCodeCloudHsmClusterInUseException:
            fmt.Println(kms.ErrCodeCloudHsmClusterInUseException, aerr.Error())
        case kms.ErrCodeCustomKeyStoreNameInUseException:
            fmt.Println(kms.ErrCodeCustomKeyStoreNameInUseException, aerr.Error())
        case kms.ErrCodeCloudHsmClusterNotFoundException:
            fmt.Println(kms.ErrCodeCloudHsmClusterNotFoundException, aerr.Error())
        case kms.ErrCodeInternalException:
            fmt.Println(kms.ErrCodeInternalException, aerr.Error())
        case kms.ErrCodeCloudHsmClusterNotActiveException:
            fmt.Println(kms.ErrCodeCloudHsmClusterNotActiveException, aerr.Error())
        case kms.ErrCodeIncorrectTrustAnchorException:
            fmt.Println(kms.ErrCodeIncorrectTrustAnchorException, aerr.Error())
        case kms.ErrCodeCloudHsmClusterInvalidConfigurationException:
            fmt.Println(kms.ErrCodeCloudHsmClusterInvalidConfigurationException, aerr.Error())
        case kms.ErrCodeLimitExceededException:
            fmt.Println(kms.ErrCodeLimitExceededException, aerr.Error())
        case kms.ErrCodeXksProxyUriInUseException:
            fmt.Println(kms.ErrCodeXksProxyUriInUseException, aerr.Error())
        case kms.ErrCodeXksProxyUriEndpointInUseException:
            fmt.Println(kms.ErrCodeXksProxyUriEndpointInUseException, aerr.Error())
        case kms.ErrCodeXksProxyUriUnreachableException:
            fmt.Println(kms.ErrCodeXksProxyUriUnreachableException, aerr.Error())
        case kms.ErrCodeXksProxyIncorrectAuthenticationCredentialException:
            fmt.Println(kms.ErrCodeXksProxyIncorrectAuthenticationCredentialException, aerr.Error())
        case kms.ErrCodeXksProxyVpcEndpointServiceInUseException:
            fmt.Println(kms.ErrCodeXksProxyVpcEndpointServiceInUseException, aerr.Error())
        case kms.ErrCodeXksProxyVpcEndpointServiceNotFoundException:
            fmt.Println(kms.ErrCodeXksProxyVpcEndpointServiceNotFoundException, aerr.Error())
        case kms.ErrCodeXksProxyVpcEndpointServiceInvalidConfigurationException:
            fmt.Println(kms.ErrCodeXksProxyVpcEndpointServiceInvalidConfigurationException, aerr.Error())
        case kms.ErrCodeXksProxyInvalidResponseException:
            fmt.Println(kms.ErrCodeXksProxyInvalidResponseException, aerr.Error())
        case kms.ErrCodeXksProxyInvalidConfigurationException:
            fmt.Println(kms.ErrCodeXksProxyInvalidConfigurationException, aerr.Error())
        default:
            fmt.Println(aerr.Error())
        }
    } else {
        // Print the error, cast err to awserr.Error to get the Code and
        // Message from an error.
        fmt.Println(err.Error())
    }
    return
}

fmt.Println(result)

func (*KMS) CreateCustomKeyStoreRequest

func (c *KMS) CreateCustomKeyStoreRequest(input *CreateCustomKeyStoreInput) (req *request.Request, output *CreateCustomKeyStoreOutput)

CreateCustomKeyStoreRequest generates a "aws/request.Request" representing the client's request for the CreateCustomKeyStore operation. The "output" return value will be populated with the request's response once the request completes successfully.

Use "Send" method on the returned Request to send the API call to the service. the "output" return value is not valid until after Send returns without error.

See CreateCustomKeyStore for more information on using the CreateCustomKeyStore API call, and error handling.

This method is useful when you want to inject custom logic or configuration into the SDK's request lifecycle. Such as custom headers, or retry logic.

// Example sending a request using the CreateCustomKeyStoreRequest method.
req, resp := client.CreateCustomKeyStoreRequest(params)

err := req.Send()
if err == nil { // resp is now filled
    fmt.Println(resp)
}

See also, https://docs.aws.amazon.com/goto/WebAPI/kms-2014-11-01/CreateCustomKeyStore

func (*KMS) CreateCustomKeyStoreWithContext

func (c *KMS) CreateCustomKeyStoreWithContext(ctx aws.Context, input *CreateCustomKeyStoreInput, opts ...request.Option) (*CreateCustomKeyStoreOutput, error)

CreateCustomKeyStoreWithContext is the same as CreateCustomKeyStore with the addition of the ability to pass a context and additional request options.

See CreateCustomKeyStore for details on how to use this API operation.

The context must be non-nil and will be used for request cancellation. If the context is nil a panic will occur. In the future the SDK may create sub-contexts for http.Requests. See https://golang.org/pkg/context/ for more information on using Contexts.

func (*KMS) CreateGrant

func (c *KMS) CreateGrant(input *CreateGrantInput) (*CreateGrantOutput, error)

CreateGrant API operation for AWS Key Management Service.

Adds a grant to a KMS key.

A grant is a policy instrument that allows Amazon Web Services principals to use KMS keys in cryptographic operations. It also can allow them to view a KMS key (DescribeKey) and create and manage grants. When authorizing access to a KMS key, grants are considered along with key policies and IAM policies. Grants are often used for temporary permissions because you can create one, use its permissions, and delete it without changing your key policies or IAM policies.

For detailed information about grants, including grant terminology, see Grants in KMS (https://docs.aws.amazon.com/kms/latest/developerguide/grants.html) in the Key Management Service Developer Guide . For examples of working with grants in several programming languages, see Programming grants (https://docs.aws.amazon.com/kms/latest/developerguide/programming-grants.html).

The CreateGrant operation returns a GrantToken and a GrantId.

  • When you create, retire, or revoke a grant, there might be a brief delay, usually less than five minutes, until the grant is available throughout KMS. This state is known as eventual consistency. Once the grant has achieved eventual consistency, the grantee principal can use the permissions in the grant without identifying the grant. However, to use the permissions in the grant immediately, use the GrantToken that CreateGrant returns. For details, see Using a grant token (https://docs.aws.amazon.com/kms/latest/developerguide/grant-manage.html#using-grant-token) in the Key Management Service Developer Guide .

  • The CreateGrant operation also returns a GrantId. You can use the GrantId and a key identifier to identify the grant in the RetireGrant and RevokeGrant operations. To find the grant ID, use the ListGrants or ListRetirableGrants operations.

The KMS key that you use for this operation must be in a compatible key state. For details, see Key states of KMS keys (https://docs.aws.amazon.com/kms/latest/developerguide/key-state.html) in the Key Management Service Developer Guide.

Cross-account use: Yes. To perform this operation on a KMS key in a different Amazon Web Services account, specify the key ARN in the value of the KeyId parameter.

Required permissions: kms:CreateGrant (https://docs.aws.amazon.com/kms/latest/developerguide/kms-api-permissions-reference.html) (key policy)

Related operations:

  • ListGrants

  • ListRetirableGrants

  • RetireGrant

  • RevokeGrant

Eventual consistency: The KMS API follows an eventual consistency model. For more information, see KMS eventual consistency (https://docs.aws.amazon.com/kms/latest/developerguide/programming-eventual-consistency.html).

Returns awserr.Error for service API and SDK errors. Use runtime type assertions with awserr.Error's Code and Message methods to get detailed information about the error.

See the AWS API reference guide for AWS Key Management Service's API operation CreateGrant for usage and error information.

Returned Error Types:

  • NotFoundException The request was rejected because the specified entity or resource could not be found.

  • DisabledException The request was rejected because the specified KMS key is not enabled.

  • DependencyTimeoutException The system timed out while trying to fulfill the request. You can retry the request.

  • InvalidArnException The request was rejected because a specified ARN, or an ARN in a key policy, is not valid.

  • InternalException The request was rejected because an internal exception occurred. The request can be retried.

  • InvalidGrantTokenException The request was rejected because the specified grant token is not valid.

  • LimitExceededException The request was rejected because a quota was exceeded. For more information, see Quotas (https://docs.aws.amazon.com/kms/latest/developerguide/limits.html) in the Key Management Service Developer Guide.

  • InvalidStateException The request was rejected because the state of the specified resource is not valid for this request.

    This exceptions means one of the following:

  • The key state of the KMS key is not compatible with the operation. To find the key state, use the DescribeKey operation. For more information about which key states are compatible with each KMS operation, see Key states of KMS keys (https://docs.aws.amazon.com/kms/latest/developerguide/key-state.html) in the Key Management Service Developer Guide .

  • For cryptographic operations on KMS keys in custom key stores, this exception represents a general failure with many possible causes. To identify the cause, see the error message that accompanies the exception.

  • DryRunOperationException The request was rejected because the DryRun parameter was specified.

See also, https://docs.aws.amazon.com/goto/WebAPI/kms-2014-11-01/CreateGrant

Example (Shared00)

To create a grant The following example creates a grant that allows the specified IAM role to encrypt data with the specified KMS key.

Code:

svc := kms.New(session.New())
input := &kms.CreateGrantInput{
    GranteePrincipal: aws.String("arn:aws:iam::111122223333:role/ExampleRole"),
    KeyId:            aws.String("arn:aws:kms:us-east-2:444455556666:key/1234abcd-12ab-34cd-56ef-1234567890ab"),
    Operations: []*string{
        aws.String("Encrypt"),
        aws.String("Decrypt"),
    },
}

result, err := svc.CreateGrant(input)
if err != nil {
    if aerr, ok := err.(awserr.Error); ok {
        switch aerr.Code() {
        case kms.ErrCodeNotFoundException:
            fmt.Println(kms.ErrCodeNotFoundException, aerr.Error())
        case kms.ErrCodeDisabledException:
            fmt.Println(kms.ErrCodeDisabledException, aerr.Error())
        case kms.ErrCodeDependencyTimeoutException:
            fmt.Println(kms.ErrCodeDependencyTimeoutException, aerr.Error())
        case kms.ErrCodeInvalidArnException:
            fmt.Println(kms.ErrCodeInvalidArnException, aerr.Error())
        case kms.ErrCodeInternalException:
            fmt.Println(kms.ErrCodeInternalException, aerr.Error())
        case kms.ErrCodeInvalidGrantTokenException:
            fmt.Println(kms.ErrCodeInvalidGrantTokenException, aerr.Error())
        case kms.ErrCodeLimitExceededException:
            fmt.Println(kms.ErrCodeLimitExceededException, aerr.Error())
        case kms.ErrCodeInvalidStateException:
            fmt.Println(kms.ErrCodeInvalidStateException, aerr.Error())
        case kms.ErrCodeDryRunOperationException:
            fmt.Println(kms.ErrCodeDryRunOperationException, aerr.Error())
        default:
            fmt.Println(aerr.Error())
        }
    } else {
        // Print the error, cast err to awserr.Error to get the Code and
        // Message from an error.
        fmt.Println(err.Error())
    }
    return
}

fmt.Println(result)

func (*KMS) CreateGrantRequest

func (c *KMS) CreateGrantRequest(input *CreateGrantInput) (req *request.Request, output *CreateGrantOutput)

CreateGrantRequest generates a "aws/request.Request" representing the client's request for the CreateGrant operation. The "output" return value will be populated with the request's response once the request completes successfully.

Use "Send" method on the returned Request to send the API call to the service. the "output" return value is not valid until after Send returns without error.

See CreateGrant for more information on using the CreateGrant API call, and error handling.

This method is useful when you want to inject custom logic or configuration into the SDK's request lifecycle. Such as custom headers, or retry logic.

// Example sending a request using the CreateGrantRequest method.
req, resp := client.CreateGrantRequest(params)

err := req.Send()
if err == nil { // resp is now filled
    fmt.Println(resp)
}

See also, https://docs.aws.amazon.com/goto/WebAPI/kms-2014-11-01/CreateGrant

func (*KMS) CreateGrantWithContext

func (c *KMS) CreateGrantWithContext(ctx aws.Context, input *CreateGrantInput, opts ...request.Option) (*CreateGrantOutput, error)

CreateGrantWithContext is the same as CreateGrant with the addition of the ability to pass a context and additional request options.

See CreateGrant for details on how to use this API operation.

The context must be non-nil and will be used for request cancellation. If the context is nil a panic will occur. In the future the SDK may create sub-contexts for http.Requests. See https://golang.org/pkg/context/ for more information on using Contexts.

func (*KMS) CreateKey

func (c *KMS) CreateKey(input *CreateKeyInput) (*CreateKeyOutput, error)

CreateKey API operation for AWS Key Management Service.

Creates a unique customer managed KMS key (https://docs.aws.amazon.com/kms/latest/developerguide/concepts.html#kms-keys) in your Amazon Web Services account and Region. You can use a KMS key in cryptographic operations, such as encryption and signing. Some Amazon Web Services services let you use KMS keys that you create and manage to protect your service resources.

A KMS key is a logical representation of a cryptographic key. In addition to the key material used in cryptographic operations, a KMS key includes metadata, such as the key ID, key policy, creation date, description, and key state. For details, see Managing keys (https://docs.aws.amazon.com/kms/latest/developerguide/getting-started.html) in the Key Management Service Developer Guide

Use the parameters of CreateKey to specify the type of KMS key, the source of its key material, its key policy, description, tags, and other properties.

KMS has replaced the term customer master key (CMK) with KMS key and KMS key. The concept has not changed. To prevent breaking changes, KMS is keeping some variations of this term.

To create different types of KMS keys, use the following guidance:

Symmetric encryption KMS key

By default, CreateKey creates a symmetric encryption KMS key with key material that KMS generates. This is the basic and most widely used type of KMS key, and provides the best performance.

To create a symmetric encryption KMS key, you don't need to specify any parameters. The default value for KeySpec, SYMMETRIC_DEFAULT, the default value for KeyUsage, ENCRYPT_DECRYPT, and the default value for Origin, AWS_KMS, create a symmetric encryption KMS key with KMS key material.

If you need a key for basic encryption and decryption or you are creating a KMS key to protect your resources in an Amazon Web Services service, create a symmetric encryption KMS key. The key material in a symmetric encryption key never leaves KMS unencrypted. You can use a symmetric encryption KMS key to encrypt and decrypt data up to 4,096 bytes, but they are typically used to generate data keys and data keys pairs. For details, see GenerateDataKey and GenerateDataKeyPair.

Asymmetric KMS keys

To create an asymmetric KMS key, use the KeySpec parameter to specify the type of key material in the KMS key. Then, use the KeyUsage parameter to determine whether the KMS key will be used to encrypt and decrypt or sign and verify. You can't change these properties after the KMS key is created.

Asymmetric KMS keys contain an RSA key pair, Elliptic Curve (ECC) key pair, or an SM2 key pair (China Regions only). The private key in an asymmetric KMS key never leaves KMS unencrypted. However, you can use the GetPublicKey operation to download the public key so it can be used outside of KMS. Each KMS key can have only one key usage. KMS keys with RSA key pairs can be used to encrypt and decrypt data or sign and verify messages (but not both). KMS keys with NIST-recommended ECC key pairs can be used to sign and verify messages or derive shared secrets (but not both). KMS keys with ECC_SECG_P256K1 can be used only to sign and verify messages. KMS keys with SM2 key pairs (China Regions only) can be used to either encrypt and decrypt data, sign and verify messages, or derive shared secrets (you must choose one key usage type). For information about asymmetric KMS keys, see Asymmetric KMS keys (https://docs.aws.amazon.com/kms/latest/developerguide/symmetric-asymmetric.html) in the Key Management Service Developer Guide.

HMAC KMS key

To create an HMAC KMS key, set the KeySpec parameter to a key spec value for HMAC KMS keys. Then set the KeyUsage parameter to GENERATE_VERIFY_MAC. You must set the key usage even though GENERATE_VERIFY_MAC is the only valid key usage value for HMAC KMS keys. You can't change these properties after the KMS key is created.

HMAC KMS keys are symmetric keys that never leave KMS unencrypted. You can use HMAC keys to generate (GenerateMac) and verify (VerifyMac) HMAC codes for messages up to 4096 bytes.

Multi-Region primary keys

Imported key material

To create a multi-Region primary key in the local Amazon Web Services Region, use the MultiRegion parameter with a value of True. To create a multi-Region replica key, that is, a KMS key with the same key ID and key material as a primary key, but in a different Amazon Web Services Region, use the ReplicateKey operation. To change a replica key to a primary key, and its primary key to a replica key, use the UpdatePrimaryRegion operation.

You can create multi-Region KMS keys for all supported KMS key types: symmetric encryption KMS keys, HMAC KMS keys, asymmetric encryption KMS keys, and asymmetric signing KMS keys. You can also create multi-Region keys with imported key material. However, you can't create multi-Region keys in a custom key store.

This operation supports multi-Region keys, an KMS feature that lets you create multiple interoperable KMS keys in different Amazon Web Services Regions. Because these KMS keys have the same key ID, key material, and other metadata, you can use them interchangeably to encrypt data in one Amazon Web Services Region and decrypt it in a different Amazon Web Services Region without re-encrypting the data or making a cross-Region call. For more information about multi-Region keys, see Multi-Region keys in KMS (https://docs.aws.amazon.com/kms/latest/developerguide/multi-region-keys-overview.html) in the Key Management Service Developer Guide.

To import your own key material into a KMS key, begin by creating a KMS key with no key material. To do this, use the Origin parameter of CreateKey with a value of EXTERNAL. Next, use GetParametersForImport operation to get a public key and import token. Use the wrapping public key to encrypt your key material. Then, use ImportKeyMaterial with your import token to import the key material. For step-by-step instructions, see Importing Key Material (https://docs.aws.amazon.com/kms/latest/developerguide/importing-keys.html) in the Key Management Service Developer Guide .

You can import key material into KMS keys of all supported KMS key types: symmetric encryption KMS keys, HMAC KMS keys, asymmetric encryption KMS keys, and asymmetric signing KMS keys. You can also create multi-Region keys with imported key material. However, you can't import key material into a KMS key in a custom key store.

To create a multi-Region primary key with imported key material, use the Origin parameter of CreateKey with a value of EXTERNAL and the MultiRegion parameter with a value of True. To create replicas of the multi-Region primary key, use the ReplicateKey operation. For instructions, see Importing key material into multi-Region keys (https://docs.aws.amazon.com/kms/latest/developerguide/multi-region-keys-import.html). For more information about multi-Region keys, see Multi-Region keys in KMS (https://docs.aws.amazon.com/kms/latest/developerguide/multi-region-keys-overview.html) in the Key Management Service Developer Guide.

Custom key store

A custom key store (https://docs.aws.amazon.com/kms/latest/developerguide/custom-key-store-overview.html) lets you protect your Amazon Web Services resources using keys in a backing key store that you own and manage. When you request a cryptographic operation with a KMS key in a custom key store, the operation is performed in the backing key store using its cryptographic keys.

KMS supports CloudHSM key stores (https://docs.aws.amazon.com/kms/latest/developerguide/keystore-cloudhsm.html) backed by an CloudHSM cluster and external key stores (https://docs.aws.amazon.com/kms/latest/developerguide/keystore-external.html) backed by an external key manager outside of Amazon Web Services. When you create a KMS key in an CloudHSM key store, KMS generates an encryption key in the CloudHSM cluster and associates it with the KMS key. When you create a KMS key in an external key store, you specify an existing encryption key in the external key manager.

Some external key managers provide a simpler method for creating a KMS key in an external key store. For details, see your external key manager documentation.

Before you create a KMS key in a custom key store, the ConnectionState of the key store must be CONNECTED. To connect the custom key store, use the ConnectCustomKeyStore operation. To find the ConnectionState, use the DescribeCustomKeyStores operation.

To create a KMS key in a custom key store, use the CustomKeyStoreId. Use the default KeySpec value, SYMMETRIC_DEFAULT, and the default KeyUsage value, ENCRYPT_DECRYPT to create a symmetric encryption key. No other key type is supported in a custom key store.

To create a KMS key in an CloudHSM key store (https://docs.aws.amazon.com/kms/latest/developerguide/keystore-cloudhsm.html), use the Origin parameter with a value of AWS_CLOUDHSM. The CloudHSM cluster that is associated with the custom key store must have at least two active HSMs in different Availability Zones in the Amazon Web Services Region.

To create a KMS key in an external key store (https://docs.aws.amazon.com/kms/latest/developerguide/keystore-external.html), use the Origin parameter with a value of EXTERNAL_KEY_STORE and an XksKeyId parameter that identifies an existing external key.

Some external key managers provide a simpler method for creating a KMS key in an external key store. For details, see your external key manager documentation.

Cross-account use: No. You cannot use this operation to create a KMS key in a different Amazon Web Services account.

Required permissions: kms:CreateKey (https://docs.aws.amazon.com/kms/latest/developerguide/kms-api-permissions-reference.html) (IAM policy). To use the Tags parameter, kms:TagResource (https://docs.aws.amazon.com/kms/latest/developerguide/kms-api-permissions-reference.html) (IAM policy). For examples and information about related permissions, see Allow a user to create KMS keys (https://docs.aws.amazon.com/kms/latest/developerguide/iam-policies.html#iam-policy-example-create-key) in the Key Management Service Developer Guide.

Related operations:

  • DescribeKey

  • ListKeys

  • ScheduleKeyDeletion

Eventual consistency: The KMS API follows an eventual consistency model. For more information, see KMS eventual consistency (https://docs.aws.amazon.com/kms/latest/developerguide/programming-eventual-consistency.html).

Returns awserr.Error for service API and SDK errors. Use runtime type assertions with awserr.Error's Code and Message methods to get detailed information about the error.

See the AWS API reference guide for AWS Key Management Service's API operation CreateKey for usage and error information.

Returned Error Types:

  • MalformedPolicyDocumentException The request was rejected because the specified policy is not syntactically or semantically correct.

  • DependencyTimeoutException The system timed out while trying to fulfill the request. You can retry the request.

  • InvalidArnException The request was rejected because a specified ARN, or an ARN in a key policy, is not valid.

  • UnsupportedOperationException The request was rejected because a specified parameter is not supported or a specified resource is not valid for this operation.

  • InternalException The request was rejected because an internal exception occurred. The request can be retried.

  • LimitExceededException The request was rejected because a quota was exceeded. For more information, see Quotas (https://docs.aws.amazon.com/kms/latest/developerguide/limits.html) in the Key Management Service Developer Guide.

  • TagException The request was rejected because one or more tags are not valid.

  • CustomKeyStoreNotFoundException The request was rejected because KMS cannot find a custom key store with the specified key store name or ID.

  • CustomKeyStoreInvalidStateException The request was rejected because of the ConnectionState of the custom key store. To get the ConnectionState of a custom key store, use the DescribeCustomKeyStores operation.

    This exception is thrown under the following conditions:

  • You requested the ConnectCustomKeyStore operation on a custom key store with a ConnectionState of DISCONNECTING or FAILED. This operation is valid for all other ConnectionState values. To reconnect a custom key store in a FAILED state, disconnect it (DisconnectCustomKeyStore), then connect it (ConnectCustomKeyStore).

  • You requested the CreateKey operation in a custom key store that is not connected. This operations is valid only when the custom key store ConnectionState is CONNECTED.

  • You requested the DisconnectCustomKeyStore operation on a custom key store with a ConnectionState of DISCONNECTING or DISCONNECTED. This operation is valid for all other ConnectionState values.

  • You requested the UpdateCustomKeyStore or DeleteCustomKeyStore operation on a custom key store that is not disconnected. This operation is valid only when the custom key store ConnectionState is DISCONNECTED.

  • You requested the GenerateRandom operation in an CloudHSM key store that is not connected. This operation is valid only when the CloudHSM key store ConnectionState is CONNECTED.

  • CloudHsmClusterInvalidConfigurationException The request was rejected because the associated CloudHSM cluster did not meet the configuration requirements for an CloudHSM key store.

  • The CloudHSM cluster must be configured with private subnets in at least two different Availability Zones in the Region.

  • The security group for the cluster (https://docs.aws.amazon.com/cloudhsm/latest/userguide/configure-sg.html) (cloudhsm-cluster-<cluster-id>-sg) must include inbound rules and outbound rules that allow TCP traffic on ports 2223-2225. The Source in the inbound rules and the Destination in the outbound rules must match the security group ID. These rules are set by default when you create the CloudHSM cluster. Do not delete or change them. To get information about a particular security group, use the DescribeSecurityGroups (https://docs.aws.amazon.com/AWSEC2/latest/APIReference/API_DescribeSecurityGroups.html) operation.

  • The CloudHSM cluster must contain at least as many HSMs as the operation requires. To add HSMs, use the CloudHSM CreateHsm (https://docs.aws.amazon.com/cloudhsm/latest/APIReference/API_CreateHsm.html) operation. For the CreateCustomKeyStore, UpdateCustomKeyStore, and CreateKey operations, the CloudHSM cluster must have at least two active HSMs, each in a different Availability Zone. For the ConnectCustomKeyStore operation, the CloudHSM must contain at least one active HSM.

    For information about the requirements for an CloudHSM cluster that is associated with an CloudHSM key store, see Assemble the Prerequisites (https://docs.aws.amazon.com/kms/latest/developerguide/create-keystore.html#before-keystore) in the Key Management Service Developer Guide. For information about creating a private subnet for an CloudHSM cluster, see Create a Private Subnet (https://docs.aws.amazon.com/cloudhsm/latest/userguide/create-subnets.html) in the CloudHSM User Guide. For information about cluster security groups, see Configure a Default Security Group (https://docs.aws.amazon.com/cloudhsm/latest/userguide/configure-sg.html) in the CloudHSM User Guide .

  • XksKeyInvalidConfigurationException The request was rejected because the external key specified by the XksKeyId parameter did not meet the configuration requirements for an external key store.

    The external key must be an AES-256 symmetric key that is enabled and performs encryption and decryption.

  • XksKeyAlreadyInUseException The request was rejected because the (XksKeyId) is already associated with another KMS key in this external key store. Each KMS key in an external key store must be associated with a different external key.

  • XksKeyNotFoundException The request was rejected because the external key store proxy could not find the external key. This exception is thrown when the value of the XksKeyId parameter doesn't identify a key in the external key manager associated with the external key proxy.

    Verify that the XksKeyId represents an existing key in the external key manager. Use the key identifier that the external key store proxy uses to identify the key. For details, see the documentation provided with your external key store proxy or key manager.

See also, https://docs.aws.amazon.com/goto/WebAPI/kms-2014-11-01/CreateKey

Example (Shared00)

To create a KMS key The following example creates a symmetric KMS key for encryption and decryption. No parameters are required for this operation.

Code:

svc := kms.New(session.New())
input := &kms.CreateKeyInput{}

result, err := svc.CreateKey(input)
if err != nil {
    if aerr, ok := err.(awserr.Error); ok {
        switch aerr.Code() {
        case kms.ErrCodeMalformedPolicyDocumentException:
            fmt.Println(kms.ErrCodeMalformedPolicyDocumentException, aerr.Error())
        case kms.ErrCodeDependencyTimeoutException:
            fmt.Println(kms.ErrCodeDependencyTimeoutException, aerr.Error())
        case kms.ErrCodeInvalidArnException:
            fmt.Println(kms.ErrCodeInvalidArnException, aerr.Error())
        case kms.ErrCodeUnsupportedOperationException:
            fmt.Println(kms.ErrCodeUnsupportedOperationException, aerr.Error())
        case kms.ErrCodeInternalException:
            fmt.Println(kms.ErrCodeInternalException, aerr.Error())
        case kms.ErrCodeLimitExceededException:
            fmt.Println(kms.ErrCodeLimitExceededException, aerr.Error())
        case kms.ErrCodeTagException:
            fmt.Println(kms.ErrCodeTagException, aerr.Error())
        case kms.ErrCodeCustomKeyStoreNotFoundException:
            fmt.Println(kms.ErrCodeCustomKeyStoreNotFoundException, aerr.Error())
        case kms.ErrCodeCustomKeyStoreInvalidStateException:
            fmt.Println(kms.ErrCodeCustomKeyStoreInvalidStateException, aerr.Error())
        case kms.ErrCodeCloudHsmClusterInvalidConfigurationException:
            fmt.Println(kms.ErrCodeCloudHsmClusterInvalidConfigurationException, aerr.Error())
        case kms.ErrCodeXksKeyInvalidConfigurationException:
            fmt.Println(kms.ErrCodeXksKeyInvalidConfigurationException, aerr.Error())
        case kms.ErrCodeXksKeyAlreadyInUseException:
            fmt.Println(kms.ErrCodeXksKeyAlreadyInUseException, aerr.Error())
        case kms.ErrCodeXksKeyNotFoundException:
            fmt.Println(kms.ErrCodeXksKeyNotFoundException, aerr.Error())
        default:
            fmt.Println(aerr.Error())
        }
    } else {
        // Print the error, cast err to awserr.Error to get the Code and
        // Message from an error.
        fmt.Println(err.Error())
    }
    return
}

fmt.Println(result)

Example (Shared01)

To create an asymmetric RSA KMS key for encryption and decryption This example creates a KMS key that contains an asymmetric RSA key pair for encryption and decryption. The key spec and key usage can't be changed after the key is created.

Code:

svc := kms.New(session.New())
input := &kms.CreateKeyInput{
    KeySpec:  aws.String("RSA_4096"),
    KeyUsage: aws.String("ENCRYPT_DECRYPT"),
}

result, err := svc.CreateKey(input)
if err != nil {
    if aerr, ok := err.(awserr.Error); ok {
        switch aerr.Code() {
        case kms.ErrCodeMalformedPolicyDocumentException:
            fmt.Println(kms.ErrCodeMalformedPolicyDocumentException, aerr.Error())
        case kms.ErrCodeDependencyTimeoutException:
            fmt.Println(kms.ErrCodeDependencyTimeoutException, aerr.Error())
        case kms.ErrCodeInvalidArnException:
            fmt.Println(kms.ErrCodeInvalidArnException, aerr.Error())
        case kms.ErrCodeUnsupportedOperationException:
            fmt.Println(kms.ErrCodeUnsupportedOperationException, aerr.Error())
        case kms.ErrCodeInternalException:
            fmt.Println(kms.ErrCodeInternalException, aerr.Error())
        case kms.ErrCodeLimitExceededException:
            fmt.Println(kms.ErrCodeLimitExceededException, aerr.Error())
        case kms.ErrCodeTagException:
            fmt.Println(kms.ErrCodeTagException, aerr.Error())
        case kms.ErrCodeCustomKeyStoreNotFoundException:
            fmt.Println(kms.ErrCodeCustomKeyStoreNotFoundException, aerr.Error())
        case kms.ErrCodeCustomKeyStoreInvalidStateException:
            fmt.Println(kms.ErrCodeCustomKeyStoreInvalidStateException, aerr.Error())
        case kms.ErrCodeCloudHsmClusterInvalidConfigurationException:
            fmt.Println(kms.ErrCodeCloudHsmClusterInvalidConfigurationException, aerr.Error())
        case kms.ErrCodeXksKeyInvalidConfigurationException:
            fmt.Println(kms.ErrCodeXksKeyInvalidConfigurationException, aerr.Error())
        case kms.ErrCodeXksKeyAlreadyInUseException:
            fmt.Println(kms.ErrCodeXksKeyAlreadyInUseException, aerr.Error())
        case kms.ErrCodeXksKeyNotFoundException:
            fmt.Println(kms.ErrCodeXksKeyNotFoundException, aerr.Error())
        default:
            fmt.Println(aerr.Error())
        }
    } else {
        // Print the error, cast err to awserr.Error to get the Code and
        // Message from an error.
        fmt.Println(err.Error())
    }
    return
}

fmt.Println(result)

Example (Shared02)

To create an asymmetric elliptic curve KMS key for signing and verification This example creates a KMS key that contains an asymmetric elliptic curve (ECC) key pair for signing and verification. The key usage is required even though "SIGN_VERIFY" is the only valid value for ECC KMS keys. The key spec and key usage can't be changed after the key is created.

Code:

svc := kms.New(session.New())
input := &kms.CreateKeyInput{
    KeySpec:  aws.String("ECC_NIST_P521"),
    KeyUsage: aws.String("SIGN_VERIFY"),
}

result, err := svc.CreateKey(input)
if err != nil {
    if aerr, ok := err.(awserr.Error); ok {
        switch aerr.Code() {
        case kms.ErrCodeMalformedPolicyDocumentException:
            fmt.Println(kms.ErrCodeMalformedPolicyDocumentException, aerr.Error())
        case kms.ErrCodeDependencyTimeoutException:
            fmt.Println(kms.ErrCodeDependencyTimeoutException, aerr.Error())
        case kms.ErrCodeInvalidArnException:
            fmt.Println(kms.ErrCodeInvalidArnException, aerr.Error())
        case kms.ErrCodeUnsupportedOperationException:
            fmt.Println(kms.ErrCodeUnsupportedOperationException, aerr.Error())
        case kms.ErrCodeInternalException:
            fmt.Println(kms.ErrCodeInternalException, aerr.Error())
        case kms.ErrCodeLimitExceededException:
            fmt.Println(kms.ErrCodeLimitExceededException, aerr.Error())
        case kms.ErrCodeTagException:
            fmt.Println(kms.ErrCodeTagException, aerr.Error())
        case kms.ErrCodeCustomKeyStoreNotFoundException:
            fmt.Println(kms.ErrCodeCustomKeyStoreNotFoundException, aerr.Error())
        case kms.ErrCodeCustomKeyStoreInvalidStateException:
            fmt.Println(kms.ErrCodeCustomKeyStoreInvalidStateException, aerr.Error())
        case kms.ErrCodeCloudHsmClusterInvalidConfigurationException:
            fmt.Println(kms.ErrCodeCloudHsmClusterInvalidConfigurationException, aerr.Error())
        case kms.ErrCodeXksKeyInvalidConfigurationException:
            fmt.Println(kms.ErrCodeXksKeyInvalidConfigurationException, aerr.Error())
        case kms.ErrCodeXksKeyAlreadyInUseException:
            fmt.Println(kms.ErrCodeXksKeyAlreadyInUseException, aerr.Error())
        case kms.ErrCodeXksKeyNotFoundException:
            fmt.Println(kms.ErrCodeXksKeyNotFoundException, aerr.Error())
        default:
            fmt.Println(aerr.Error())
        }
    } else {
        // Print the error, cast err to awserr.Error to get the Code and
        // Message from an error.
        fmt.Println(err.Error())
    }
    return
}

fmt.Println(result)

Example (Shared03)

To create an HMAC KMS key This example creates a 384-bit symmetric HMAC KMS key. The GENERATE_VERIFY_MAC key usage value is required even though it's the only valid value for HMAC KMS keys. The key spec and key usage can't be changed after the key is created.

Code:

svc := kms.New(session.New())
input := &kms.CreateKeyInput{
    KeySpec:  aws.String("HMAC_384"),
    KeyUsage: aws.String("GENERATE_VERIFY_MAC"),
}

result, err := svc.CreateKey(input)
if err != nil {
    if aerr, ok := err.(awserr.Error); ok {
        switch aerr.Code() {
        case kms.ErrCodeMalformedPolicyDocumentException:
            fmt.Println(kms.ErrCodeMalformedPolicyDocumentException, aerr.Error())
        case kms.ErrCodeDependencyTimeoutException:
            fmt.Println(kms.ErrCodeDependencyTimeoutException, aerr.Error())
        case kms.ErrCodeInvalidArnException:
            fmt.Println(kms.ErrCodeInvalidArnException, aerr.Error())
        case kms.ErrCodeUnsupportedOperationException:
            fmt.Println(kms.ErrCodeUnsupportedOperationException, aerr.Error())
        case kms.ErrCodeInternalException:
            fmt.Println(kms.ErrCodeInternalException, aerr.Error())
        case kms.ErrCodeLimitExceededException:
            fmt.Println(kms.ErrCodeLimitExceededException, aerr.Error())
        case kms.ErrCodeTagException:
            fmt.Println(kms.ErrCodeTagException, aerr.Error())
        case kms.ErrCodeCustomKeyStoreNotFoundException:
            fmt.Println(kms.ErrCodeCustomKeyStoreNotFoundException, aerr.Error())
        case kms.ErrCodeCustomKeyStoreInvalidStateException:
            fmt.Println(kms.ErrCodeCustomKeyStoreInvalidStateException, aerr.Error())
        case kms.ErrCodeCloudHsmClusterInvalidConfigurationException:
            fmt.Println(kms.ErrCodeCloudHsmClusterInvalidConfigurationException, aerr.Error())
        case kms.ErrCodeXksKeyInvalidConfigurationException:
            fmt.Println(kms.ErrCodeXksKeyInvalidConfigurationException, aerr.Error())
        case kms.ErrCodeXksKeyAlreadyInUseException:
            fmt.Println(kms.ErrCodeXksKeyAlreadyInUseException, aerr.Error())
        case kms.ErrCodeXksKeyNotFoundException:
            fmt.Println(kms.ErrCodeXksKeyNotFoundException, aerr.Error())
        default:
            fmt.Println(aerr.Error())
        }
    } else {
        // Print the error, cast err to awserr.Error to get the Code and
        // Message from an error.
        fmt.Println(err.Error())
    }
    return
}

fmt.Println(result)

Example (Shared04)

To create a multi-Region primary KMS key This example creates a multi-Region primary symmetric encryption key. Because the default values for all parameters create a symmetric encryption key, only the MultiRegion parameter is required for this KMS key.

Code:

svc := kms.New(session.New())
input := &kms.CreateKeyInput{
    MultiRegion: aws.Bool(true),
}

result, err := svc.CreateKey(input)
if err != nil {
    if aerr, ok := err.(awserr.Error); ok {
        switch aerr.Code() {
        case kms.ErrCodeMalformedPolicyDocumentException:
            fmt.Println(kms.ErrCodeMalformedPolicyDocumentException, aerr.Error())
        case kms.ErrCodeDependencyTimeoutException:
            fmt.Println(kms.ErrCodeDependencyTimeoutException, aerr.Error())
        case kms.ErrCodeInvalidArnException:
            fmt.Println(kms.ErrCodeInvalidArnException, aerr.Error())
        case kms.ErrCodeUnsupportedOperationException:
            fmt.Println(kms.ErrCodeUnsupportedOperationException, aerr.Error())
        case kms.ErrCodeInternalException:
            fmt.Println(kms.ErrCodeInternalException, aerr.Error())
        case kms.ErrCodeLimitExceededException:
            fmt.Println(kms.ErrCodeLimitExceededException, aerr.Error())
        case kms.ErrCodeTagException:
            fmt.Println(kms.ErrCodeTagException, aerr.Error())
        case kms.ErrCodeCustomKeyStoreNotFoundException:
            fmt.Println(kms.ErrCodeCustomKeyStoreNotFoundException, aerr.Error())
        case kms.ErrCodeCustomKeyStoreInvalidStateException:
            fmt.Println(kms.ErrCodeCustomKeyStoreInvalidStateException, aerr.Error())
        case kms.ErrCodeCloudHsmClusterInvalidConfigurationException:
            fmt.Println(kms.ErrCodeCloudHsmClusterInvalidConfigurationException, aerr.Error())
        case kms.ErrCodeXksKeyInvalidConfigurationException:
            fmt.Println(kms.ErrCodeXksKeyInvalidConfigurationException, aerr.Error())
        case kms.ErrCodeXksKeyAlreadyInUseException:
            fmt.Println(kms.ErrCodeXksKeyAlreadyInUseException, aerr.Error())
        case kms.ErrCodeXksKeyNotFoundException:
            fmt.Println(kms.ErrCodeXksKeyNotFoundException, aerr.Error())
        default:
            fmt.Println(aerr.Error())
        }
    } else {
        // Print the error, cast err to awserr.Error to get the Code and
        // Message from an error.
        fmt.Println(err.Error())
    }
    return
}

fmt.Println(result)

Example (Shared05)

To create a KMS key for imported key material This example creates a symmetric KMS key with no key material. When the operation is complete, you can import your own key material into the KMS key. To create this KMS key, set the Origin parameter to EXTERNAL.

Code:

svc := kms.New(session.New())
input := &kms.CreateKeyInput{
    Origin: aws.String("EXTERNAL"),
}

result, err := svc.CreateKey(input)
if err != nil {
    if aerr, ok := err.(awserr.Error); ok {
        switch aerr.Code() {
        case kms.ErrCodeMalformedPolicyDocumentException:
            fmt.Println(kms.ErrCodeMalformedPolicyDocumentException, aerr.Error())
        case kms.ErrCodeDependencyTimeoutException:
            fmt.Println(kms.ErrCodeDependencyTimeoutException, aerr.Error())
        case kms.ErrCodeInvalidArnException:
            fmt.Println(kms.ErrCodeInvalidArnException, aerr.Error())
        case kms.ErrCodeUnsupportedOperationException:
            fmt.Println(kms.ErrCodeUnsupportedOperationException, aerr.Error())
        case kms.ErrCodeInternalException:
            fmt.Println(kms.ErrCodeInternalException, aerr.Error())
        case kms.ErrCodeLimitExceededException:
            fmt.Println(kms.ErrCodeLimitExceededException, aerr.Error())
        case kms.ErrCodeTagException:
            fmt.Println(kms.ErrCodeTagException, aerr.Error())
        case kms.ErrCodeCustomKeyStoreNotFoundException:
            fmt.Println(kms.ErrCodeCustomKeyStoreNotFoundException, aerr.Error())
        case kms.ErrCodeCustomKeyStoreInvalidStateException:
            fmt.Println(kms.ErrCodeCustomKeyStoreInvalidStateException, aerr.Error())
        case kms.ErrCodeCloudHsmClusterInvalidConfigurationException:
            fmt.Println(kms.ErrCodeCloudHsmClusterInvalidConfigurationException, aerr.Error())
        case kms.ErrCodeXksKeyInvalidConfigurationException:
            fmt.Println(kms.ErrCodeXksKeyInvalidConfigurationException, aerr.Error())
        case kms.ErrCodeXksKeyAlreadyInUseException:
            fmt.Println(kms.ErrCodeXksKeyAlreadyInUseException, aerr.Error())
        case kms.ErrCodeXksKeyNotFoundException:
            fmt.Println(kms.ErrCodeXksKeyNotFoundException, aerr.Error())
        default:
            fmt.Println(aerr.Error())
        }
    } else {
        // Print the error, cast err to awserr.Error to get the Code and
        // Message from an error.
        fmt.Println(err.Error())
    }
    return
}

fmt.Println(result)

Example (Shared06)

To create a KMS key in an AWS CloudHSM key store This example creates a KMS key in the specified AWS CloudHSM key store. The operation creates the KMS key and its metadata in AWS KMS and creates the key material in the AWS CloudHSM cluster associated with the custom key store. This example requires the CustomKeyStoreId and Origin parameters.

Code:

svc := kms.New(session.New())
input := &kms.CreateKeyInput{
    CustomKeyStoreId: aws.String("cks-1234567890abcdef0"),
    Origin:           aws.String("AWS_CLOUDHSM"),
}

result, err := svc.CreateKey(input)
if err != nil {
    if aerr, ok := err.(awserr.Error); ok {
        switch aerr.Code() {
        case kms.ErrCodeMalformedPolicyDocumentException:
            fmt.Println(kms.ErrCodeMalformedPolicyDocumentException, aerr.Error())
        case kms.ErrCodeDependencyTimeoutException:
            fmt.Println(kms.ErrCodeDependencyTimeoutException, aerr.Error())
        case kms.ErrCodeInvalidArnException:
            fmt.Println(kms.ErrCodeInvalidArnException, aerr.Error())
        case kms.ErrCodeUnsupportedOperationException:
            fmt.Println(kms.ErrCodeUnsupportedOperationException, aerr.Error())
        case kms.ErrCodeInternalException:
            fmt.Println(kms.ErrCodeInternalException, aerr.Error())
        case kms.ErrCodeLimitExceededException:
            fmt.Println(kms.ErrCodeLimitExceededException, aerr.Error())
        case kms.ErrCodeTagException:
            fmt.Println(kms.ErrCodeTagException, aerr.Error())
        case kms.ErrCodeCustomKeyStoreNotFoundException:
            fmt.Println(kms.ErrCodeCustomKeyStoreNotFoundException, aerr.Error())
        case kms.ErrCodeCustomKeyStoreInvalidStateException:
            fmt.Println(kms.ErrCodeCustomKeyStoreInvalidStateException, aerr.Error())
        case kms.ErrCodeCloudHsmClusterInvalidConfigurationException:
            fmt.Println(kms.ErrCodeCloudHsmClusterInvalidConfigurationException, aerr.Error())
        case kms.ErrCodeXksKeyInvalidConfigurationException:
            fmt.Println(kms.ErrCodeXksKeyInvalidConfigurationException, aerr.Error())
        case kms.ErrCodeXksKeyAlreadyInUseException:
            fmt.Println(kms.ErrCodeXksKeyAlreadyInUseException, aerr.Error())
        case kms.ErrCodeXksKeyNotFoundException:
            fmt.Println(kms.ErrCodeXksKeyNotFoundException, aerr.Error())
        default:
            fmt.Println(aerr.Error())
        }
    } else {
        // Print the error, cast err to awserr.Error to get the Code and
        // Message from an error.
        fmt.Println(err.Error())
    }
    return
}

fmt.Println(result)

Example (Shared07)

To create a KMS key in an external key store This example creates a KMS key in the specified external key store. It uses the XksKeyId parameter to associate the KMS key with an existing symmetric encryption key in your external key manager. This CustomKeyStoreId, Origin, and XksKeyId parameters are required in this operation.

Code:

svc := kms.New(session.New())
input := &kms.CreateKeyInput{
    CustomKeyStoreId: aws.String("cks-9876543210fedcba9"),
    Origin:           aws.String("EXTERNAL_KEY_STORE"),
    XksKeyId:         aws.String("bb8562717f809024"),
}

result, err := svc.CreateKey(input)
if err != nil {
    if aerr, ok := err.(awserr.Error); ok {
        switch aerr.Code() {
        case kms.ErrCodeMalformedPolicyDocumentException:
            fmt.Println(kms.ErrCodeMalformedPolicyDocumentException, aerr.Error())
        case kms.ErrCodeDependencyTimeoutException:
            fmt.Println(kms.ErrCodeDependencyTimeoutException, aerr.Error())
        case kms.ErrCodeInvalidArnException:
            fmt.Println(kms.ErrCodeInvalidArnException, aerr.Error())
        case kms.ErrCodeUnsupportedOperationException:
            fmt.Println(kms.ErrCodeUnsupportedOperationException, aerr.Error())
        case kms.ErrCodeInternalException:
            fmt.Println(kms.ErrCodeInternalException, aerr.Error())
        case kms.ErrCodeLimitExceededException:
            fmt.Println(kms.ErrCodeLimitExceededException, aerr.Error())
        case kms.ErrCodeTagException:
            fmt.Println(kms.ErrCodeTagException, aerr.Error())
        case kms.ErrCodeCustomKeyStoreNotFoundException:
            fmt.Println(kms.ErrCodeCustomKeyStoreNotFoundException, aerr.Error())
        case kms.ErrCodeCustomKeyStoreInvalidStateException:
            fmt.Println(kms.ErrCodeCustomKeyStoreInvalidStateException, aerr.Error())
        case kms.ErrCodeCloudHsmClusterInvalidConfigurationException:
            fmt.Println(kms.ErrCodeCloudHsmClusterInvalidConfigurationException, aerr.Error())
        case kms.ErrCodeXksKeyInvalidConfigurationException:
            fmt.Println(kms.ErrCodeXksKeyInvalidConfigurationException, aerr.Error())
        case kms.ErrCodeXksKeyAlreadyInUseException:
            fmt.Println(kms.ErrCodeXksKeyAlreadyInUseException, aerr.Error())
        case kms.ErrCodeXksKeyNotFoundException:
            fmt.Println(kms.ErrCodeXksKeyNotFoundException, aerr.Error())
        default:
            fmt.Println(aerr.Error())
        }
    } else {
        // Print the error, cast err to awserr.Error to get the Code and
        // Message from an error.
        fmt.Println(err.Error())
    }
    return
}

fmt.Println(result)

func (*KMS) CreateKeyRequest

func (c *KMS) CreateKeyRequest(input *CreateKeyInput) (req *request.Request, output *CreateKeyOutput)

CreateKeyRequest generates a "aws/request.Request" representing the client's request for the CreateKey operation. The "output" return value will be populated with the request's response once the request completes successfully.

Use "Send" method on the returned Request to send the API call to the service. the "output" return value is not valid until after Send returns without error.

See CreateKey for more information on using the CreateKey API call, and error handling.

This method is useful when you want to inject custom logic or configuration into the SDK's request lifecycle. Such as custom headers, or retry logic.

// Example sending a request using the CreateKeyRequest method.
req, resp := client.CreateKeyRequest(params)

err := req.Send()
if err == nil { // resp is now filled
    fmt.Println(resp)
}

See also, https://docs.aws.amazon.com/goto/WebAPI/kms-2014-11-01/CreateKey

func (*KMS) CreateKeyWithContext

func (c *KMS) CreateKeyWithContext(ctx aws.Context, input *CreateKeyInput, opts ...request.Option) (*CreateKeyOutput, error)

CreateKeyWithContext is the same as CreateKey with the addition of the ability to pass a context and additional request options.

See CreateKey for details on how to use this API operation.

The context must be non-nil and will be used for request cancellation. If the context is nil a panic will occur. In the future the SDK may create sub-contexts for http.Requests. See https://golang.org/pkg/context/ for more information on using Contexts.

func (*KMS) Decrypt

func (c *KMS) Decrypt(input *DecryptInput) (*DecryptOutput, error)

Decrypt API operation for AWS Key Management Service.

Decrypts ciphertext that was encrypted by a KMS key using any of the following operations:

  • Encrypt

  • GenerateDataKey

  • GenerateDataKeyPair

  • GenerateDataKeyWithoutPlaintext

  • GenerateDataKeyPairWithoutPlaintext

You can use this operation to decrypt ciphertext that was encrypted under a symmetric encryption KMS key or an asymmetric encryption KMS key. When the KMS key is asymmetric, you must specify the KMS key and the encryption algorithm that was used to encrypt the ciphertext. For information about asymmetric KMS keys, see Asymmetric KMS keys (https://docs.aws.amazon.com/kms/latest/developerguide/symmetric-asymmetric.html) in the Key Management Service Developer Guide.

The Decrypt operation also decrypts ciphertext that was encrypted outside of KMS by the public key in an KMS asymmetric KMS key. However, it cannot decrypt symmetric ciphertext produced by other libraries, such as the Amazon Web Services Encryption SDK (https://docs.aws.amazon.com/encryption-sdk/latest/developer-guide/) or Amazon S3 client-side encryption (https://docs.aws.amazon.com/AmazonS3/latest/dev/UsingClientSideEncryption.html). These libraries return a ciphertext format that is incompatible with KMS.

If the ciphertext was encrypted under a symmetric encryption KMS key, the KeyId parameter is optional. KMS can get this information from metadata that it adds to the symmetric ciphertext blob. This feature adds durability to your implementation by ensuring that authorized users can decrypt ciphertext decades after it was encrypted, even if they've lost track of the key ID. However, specifying the KMS key is always recommended as a best practice. When you use the KeyId parameter to specify a KMS key, KMS only uses the KMS key you specify. If the ciphertext was encrypted under a different KMS key, the Decrypt operation fails. This practice ensures that you use the KMS key that you intend.

Whenever possible, use key policies to give users permission to call the Decrypt operation on a particular KMS key, instead of using &IAM; policies. Otherwise, you might create an &IAM; policy that gives the user Decrypt permission on all KMS keys. This user could decrypt ciphertext that was encrypted by KMS keys in other accounts if the key policy for the cross-account KMS key permits it. If you must use an IAM policy for Decrypt permissions, limit the user to particular KMS keys or particular trusted accounts. For details, see Best practices for IAM policies (https://docs.aws.amazon.com/kms/latest/developerguide/iam-policies.html#iam-policies-best-practices) in the Key Management Service Developer Guide.

Decrypt also supports Amazon Web Services Nitro Enclaves (https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/nitro-enclave.html), which provide an isolated compute environment in Amazon EC2. To call Decrypt for a Nitro enclave, use the Amazon Web Services Nitro Enclaves SDK (https://docs.aws.amazon.com/enclaves/latest/user/developing-applications.html#sdk) or any Amazon Web Services SDK. Use the Recipient parameter to provide the attestation document for the enclave. Instead of the plaintext data, the response includes the plaintext data encrypted with the public key from the attestation document (CiphertextForRecipient). For information about the interaction between KMS and Amazon Web Services Nitro Enclaves, see How Amazon Web Services Nitro Enclaves uses KMS (https://docs.aws.amazon.com/kms/latest/developerguide/services-nitro-enclaves.html) in the Key Management Service Developer Guide.

The KMS key that you use for this operation must be in a compatible key state. For details, see Key states of KMS keys (https://docs.aws.amazon.com/kms/latest/developerguide/key-state.html) in the Key Management Service Developer Guide.

Cross-account use: Yes. If you use the KeyId parameter to identify a KMS key in a different Amazon Web Services account, specify the key ARN or the alias ARN of the KMS key.

Required permissions: kms:Decrypt (https://docs.aws.amazon.com/kms/latest/developerguide/kms-api-permissions-reference.html) (key policy)

Related operations:

  • Encrypt

  • GenerateDataKey

  • GenerateDataKeyPair

  • ReEncrypt

Eventual consistency: The KMS API follows an eventual consistency model. For more information, see KMS eventual consistency (https://docs.aws.amazon.com/kms/latest/developerguide/programming-eventual-consistency.html).

Returns awserr.Error for service API and SDK errors. Use runtime type assertions with awserr.Error's Code and Message methods to get detailed information about the error.

See the AWS API reference guide for AWS Key Management Service's API operation Decrypt for usage and error information.

Returned Error Types:

  • NotFoundException The request was rejected because the specified entity or resource could not be found.

  • DisabledException The request was rejected because the specified KMS key is not enabled.

  • InvalidCiphertextException From the Decrypt or ReEncrypt operation, the request was rejected because the specified ciphertext, or additional authenticated data incorporated into the ciphertext, such as the encryption context, is corrupted, missing, or otherwise invalid.

    From the ImportKeyMaterial operation, the request was rejected because KMS could not decrypt the encrypted (wrapped) key material.

  • KeyUnavailableException The request was rejected because the specified KMS key was not available. You can retry the request.

  • IncorrectKeyException The request was rejected because the specified KMS key cannot decrypt the data. The KeyId in a Decrypt request and the SourceKeyId in a ReEncrypt request must identify the same KMS key that was used to encrypt the ciphertext.

  • InvalidKeyUsageException The request was rejected for one of the following reasons:

  • The KeyUsage value of the KMS key is incompatible with the API operation.

  • The encryption algorithm or signing algorithm specified for the operation is incompatible with the type of key material in the KMS key (KeySpec).

    For encrypting, decrypting, re-encrypting, and generating data keys, the KeyUsage must be ENCRYPT_DECRYPT. For signing and verifying messages, the KeyUsage must be SIGN_VERIFY. For generating and verifying message authentication codes (MACs), the KeyUsage must be GENERATE_VERIFY_MAC. For deriving key agreement secrets, the KeyUsage must be KEY_AGREEMENT. To find the KeyUsage of a KMS key, use the DescribeKey operation.

    To find the encryption or signing algorithms supported for a particular KMS key, use the DescribeKey operation.

  • DependencyTimeoutException The system timed out while trying to fulfill the request. You can retry the request.

  • InvalidGrantTokenException The request was rejected because the specified grant token is not valid.

  • InternalException The request was rejected because an internal exception occurred. The request can be retried.

  • InvalidStateException The request was rejected because the state of the specified resource is not valid for this request.

    This exceptions means one of the following:

  • The key state of the KMS key is not compatible with the operation. To find the key state, use the DescribeKey operation. For more information about which key states are compatible with each KMS operation, see Key states of KMS keys (https://docs.aws.amazon.com/kms/latest/developerguide/key-state.html) in the Key Management Service Developer Guide .

  • For cryptographic operations on KMS keys in custom key stores, this exception represents a general failure with many possible causes. To identify the cause, see the error message that accompanies the exception.

  • DryRunOperationException The request was rejected because the DryRun parameter was specified.

See also, https://docs.aws.amazon.com/goto/WebAPI/kms-2014-11-01/Decrypt

Example (Shared00)

To decrypt data with a symmetric encryption KMS key The following example decrypts data that was encrypted with a symmetric encryption KMS key. The KeyId is not required when decrypting with a symmetric encryption key, but it is a best practice.

Code:

svc := kms.New(session.New())
input := &kms.DecryptInput{
    CiphertextBlob: []byte("<binary data>"),
    KeyId:          aws.String("arn:aws:kms:us-west-2:111122223333:key/1234abcd-12ab-34cd-56ef-1234567890ab"),
}

result, err := svc.Decrypt(input)
if err != nil {
    if aerr, ok := err.(awserr.Error); ok {
        switch aerr.Code() {
        case kms.ErrCodeNotFoundException:
            fmt.Println(kms.ErrCodeNotFoundException, aerr.Error())
        case kms.ErrCodeDisabledException:
            fmt.Println(kms.ErrCodeDisabledException, aerr.Error())
        case kms.ErrCodeInvalidCiphertextException:
            fmt.Println(kms.ErrCodeInvalidCiphertextException, aerr.Error())
        case kms.ErrCodeKeyUnavailableException:
            fmt.Println(kms.ErrCodeKeyUnavailableException, aerr.Error())
        case kms.ErrCodeIncorrectKeyException:
            fmt.Println(kms.ErrCodeIncorrectKeyException, aerr.Error())
        case kms.ErrCodeInvalidKeyUsageException:
            fmt.Println(kms.ErrCodeInvalidKeyUsageException, aerr.Error())
        case kms.ErrCodeDependencyTimeoutException:
            fmt.Println(kms.ErrCodeDependencyTimeoutException, aerr.Error())
        case kms.ErrCodeInvalidGrantTokenException:
            fmt.Println(kms.ErrCodeInvalidGrantTokenException, aerr.Error())
        case kms.ErrCodeInternalException:
            fmt.Println(kms.ErrCodeInternalException, aerr.Error())
        case kms.ErrCodeInvalidStateException:
            fmt.Println(kms.ErrCodeInvalidStateException, aerr.Error())
        case kms.ErrCodeDryRunOperationException:
            fmt.Println(kms.ErrCodeDryRunOperationException, aerr.Error())
        default:
            fmt.Println(aerr.Error())
        }
    } else {
        // Print the error, cast err to awserr.Error to get the Code and
        // Message from an error.
        fmt.Println(err.Error())
    }
    return
}

fmt.Println(result)

Example (Shared01)

To decrypt data with an asymmetric encryption KMS key The following example decrypts data that was encrypted with an asymmetric encryption KMS key. When the KMS encryption key is asymmetric, you must specify the KMS key ID and the encryption algorithm that was used to encrypt the data.

Code:

svc := kms.New(session.New())
input := &kms.DecryptInput{
    CiphertextBlob:      []byte("<binary data>"),
    EncryptionAlgorithm: aws.String("RSAES_OAEP_SHA_256"),
    KeyId:               aws.String("0987dcba-09fe-87dc-65ba-ab0987654321"),
}

result, err := svc.Decrypt(input)
if err != nil {
    if aerr, ok := err.(awserr.Error); ok {
        switch aerr.Code() {
        case kms.ErrCodeNotFoundException:
            fmt.Println(kms.ErrCodeNotFoundException, aerr.Error())
        case kms.ErrCodeDisabledException:
            fmt.Println(kms.ErrCodeDisabledException, aerr.Error())
        case kms.ErrCodeInvalidCiphertextException:
            fmt.Println(kms.ErrCodeInvalidCiphertextException, aerr.Error())
        case kms.ErrCodeKeyUnavailableException:
            fmt.Println(kms.ErrCodeKeyUnavailableException, aerr.Error())
        case kms.ErrCodeIncorrectKeyException:
            fmt.Println(kms.ErrCodeIncorrectKeyException, aerr.Error())
        case kms.ErrCodeInvalidKeyUsageException:
            fmt.Println(kms.ErrCodeInvalidKeyUsageException, aerr.Error())
        case kms.ErrCodeDependencyTimeoutException:
            fmt.Println(kms.ErrCodeDependencyTimeoutException, aerr.Error())
        case kms.ErrCodeInvalidGrantTokenException:
            fmt.Println(kms.ErrCodeInvalidGrantTokenException, aerr.Error())
        case kms.ErrCodeInternalException:
            fmt.Println(kms.ErrCodeInternalException, aerr.Error())
        case kms.ErrCodeInvalidStateException:
            fmt.Println(kms.ErrCodeInvalidStateException, aerr.Error())
        case kms.ErrCodeDryRunOperationException:
            fmt.Println(kms.ErrCodeDryRunOperationException, aerr.Error())
        default:
            fmt.Println(aerr.Error())
        }
    } else {
        // Print the error, cast err to awserr.Error to get the Code and
        // Message from an error.
        fmt.Println(err.Error())
    }
    return
}

fmt.Println(result)

Example (Shared02)

To decrypt data for a Nitro enclave The following Decrypt example includes the Recipient parameter with a signed attestation document from an AWS Nitro enclave. Instead of returning the decrypted data in plaintext (Plaintext), the operation returns the decrypted data encrypted by the public key from the attestation document (CiphertextForRecipient).

Code:

svc := kms.New(session.New())
input := &kms.DecryptInput{
    CiphertextBlob: []byte("<binary data>"),
    KeyId:          aws.String("arn:aws:kms:us-west-2:111122223333:key/1234abcd-12ab-34cd-56ef-1234567890ab"),
    Recipient: &kms.RecipientInfo{
        AttestationDocument:    []byte("<attestation document>"),
        KeyEncryptionAlgorithm: aws.String("RSAES_OAEP_SHA_256"),
    },
}

result, err := svc.Decrypt(input)
if err != nil {
    if aerr, ok := err.(awserr.Error); ok {
        switch aerr.Code() {
        case kms.ErrCodeNotFoundException:
            fmt.Println(kms.ErrCodeNotFoundException, aerr.Error())
        case kms.ErrCodeDisabledException:
            fmt.Println(kms.ErrCodeDisabledException, aerr.Error())
        case kms.ErrCodeInvalidCiphertextException:
            fmt.Println(kms.ErrCodeInvalidCiphertextException, aerr.Error())
        case kms.ErrCodeKeyUnavailableException:
            fmt.Println(kms.ErrCodeKeyUnavailableException, aerr.Error())
        case kms.ErrCodeIncorrectKeyException:
            fmt.Println(kms.ErrCodeIncorrectKeyException, aerr.Error())
        case kms.ErrCodeInvalidKeyUsageException:
            fmt.Println(kms.ErrCodeInvalidKeyUsageException, aerr.Error())
        case kms.ErrCodeDependencyTimeoutException:
            fmt.Println(kms.ErrCodeDependencyTimeoutException, aerr.Error())
        case kms.ErrCodeInvalidGrantTokenException:
            fmt.Println(kms.ErrCodeInvalidGrantTokenException, aerr.Error())
        case kms.ErrCodeInternalException:
            fmt.Println(kms.ErrCodeInternalException, aerr.Error())
        case kms.ErrCodeInvalidStateException:
            fmt.Println(kms.ErrCodeInvalidStateException, aerr.Error())
        case kms.ErrCodeDryRunOperationException:
            fmt.Println(kms.ErrCodeDryRunOperationException, aerr.Error())
        default:
            fmt.Println(aerr.Error())
        }
    } else {
        // Print the error, cast err to awserr.Error to get the Code and
        // Message from an error.
        fmt.Println(err.Error())
    }
    return
}

fmt.Println(result)

func (*KMS) DecryptRequest

func (c *KMS) DecryptRequest(input *DecryptInput) (req *request.Request, output *DecryptOutput)

DecryptRequest generates a "aws/request.Request" representing the client's request for the Decrypt operation. The "output" return value will be populated with the request's response once the request completes successfully.

Use "Send" method on the returned Request to send the API call to the service. the "output" return value is not valid until after Send returns without error.

See Decrypt for more information on using the Decrypt API call, and error handling.

This method is useful when you want to inject custom logic or configuration into the SDK's request lifecycle. Such as custom headers, or retry logic.

// Example sending a request using the DecryptRequest method.
req, resp := client.DecryptRequest(params)

err := req.Send()
if err == nil { // resp is now filled
    fmt.Println(resp)
}

See also, https://docs.aws.amazon.com/goto/WebAPI/kms-2014-11-01/Decrypt

func (*KMS) DecryptWithContext

func (c *KMS) DecryptWithContext(ctx aws.Context, input *DecryptInput, opts ...request.Option) (*DecryptOutput, error)

DecryptWithContext is the same as Decrypt with the addition of the ability to pass a context and additional request options.

See Decrypt for details on how to use this API operation.

The context must be non-nil and will be used for request cancellation. If the context is nil a panic will occur. In the future the SDK may create sub-contexts for http.Requests. See https://golang.org/pkg/context/ for more information on using Contexts.

func (*KMS) DeleteAlias

func (c *KMS) DeleteAlias(input *DeleteAliasInput) (*DeleteAliasOutput, error)

DeleteAlias API operation for AWS Key Management Service.

Deletes the specified alias.

Adding, deleting, or updating an alias can allow or deny permission to the KMS key. For details, see ABAC for KMS (https://docs.aws.amazon.com/kms/latest/developerguide/abac.html) in the Key Management Service Developer Guide.

Because an alias is not a property of a KMS key, you can delete and change the aliases of a KMS key without affecting the KMS key. Also, aliases do not appear in the response from the DescribeKey operation. To get the aliases of all KMS keys, use the ListAliases operation.

Each KMS key can have multiple aliases. To change the alias of a KMS key, use DeleteAlias to delete the current alias and CreateAlias to create a new alias. To associate an existing alias with a different KMS key, call UpdateAlias.

Cross-account use: No. You cannot perform this operation on an alias in a different Amazon Web Services account.

Required permissions

For details, see Controlling access to aliases (https://docs.aws.amazon.com/kms/latest/developerguide/kms-alias.html#alias-access) in the Key Management Service Developer Guide.

Related operations:

  • CreateAlias

  • ListAliases

  • UpdateAlias

Eventual consistency: The KMS API follows an eventual consistency model. For more information, see KMS eventual consistency (https://docs.aws.amazon.com/kms/latest/developerguide/programming-eventual-consistency.html).

Returns awserr.Error for service API and SDK errors. Use runtime type assertions with awserr.Error's Code and Message methods to get detailed information about the error.

See the AWS API reference guide for AWS Key Management Service's API operation DeleteAlias for usage and error information.

Returned Error Types:

  • DependencyTimeoutException The system timed out while trying to fulfill the request. You can retry the request.

  • NotFoundException The request was rejected because the specified entity or resource could not be found.

  • InternalException The request was rejected because an internal exception occurred. The request can be retried.

  • InvalidStateException The request was rejected because the state of the specified resource is not valid for this request.

    This exceptions means one of the following:

  • The key state of the KMS key is not compatible with the operation. To find the key state, use the DescribeKey operation. For more information about which key states are compatible with each KMS operation, see Key states of KMS keys (https://docs.aws.amazon.com/kms/latest/developerguide/key-state.html) in the Key Management Service Developer Guide .

  • For cryptographic operations on KMS keys in custom key stores, this exception represents a general failure with many possible causes. To identify the cause, see the error message that accompanies the exception.

See also, https://docs.aws.amazon.com/goto/WebAPI/kms-2014-11-01/DeleteAlias

Example (Shared00)

To delete an alias The following example deletes the specified alias.

Code:

svc := kms.New(session.New())
input := &kms.DeleteAliasInput{
    AliasName: aws.String("alias/ExampleAlias"),
}

result, err := svc.DeleteAlias(input)
if err != nil {
    if aerr, ok := err.(awserr.Error); ok {
        switch aerr.Code() {
        case kms.ErrCodeDependencyTimeoutException:
            fmt.Println(kms.ErrCodeDependencyTimeoutException, aerr.Error())
        case kms.ErrCodeNotFoundException:
            fmt.Println(kms.ErrCodeNotFoundException, aerr.Error())
        case kms.ErrCodeInternalException:
            fmt.Println(kms.ErrCodeInternalException, aerr.Error())
        case kms.ErrCodeInvalidStateException:
            fmt.Println(kms.ErrCodeInvalidStateException, aerr.Error())
        default:
            fmt.Println(aerr.Error())
        }
    } else {
        // Print the error, cast err to awserr.Error to get the Code and
        // Message from an error.
        fmt.Println(err.Error())
    }
    return
}

fmt.Println(result)

func (*KMS) DeleteAliasRequest

func (c *KMS) DeleteAliasRequest(input *DeleteAliasInput) (req *request.Request, output *DeleteAliasOutput)

DeleteAliasRequest generates a "aws/request.Request" representing the client's request for the DeleteAlias operation. The "output" return value will be populated with the request's response once the request completes successfully.

Use "Send" method on the returned Request to send the API call to the service. the "output" return value is not valid until after Send returns without error.

See DeleteAlias for more information on using the DeleteAlias API call, and error handling.

This method is useful when you want to inject custom logic or configuration into the SDK's request lifecycle. Such as custom headers, or retry logic.

// Example sending a request using the DeleteAliasRequest method.
req, resp := client.DeleteAliasRequest(params)

err := req.Send()
if err == nil { // resp is now filled
    fmt.Println(resp)
}

See also, https://docs.aws.amazon.com/goto/WebAPI/kms-2014-11-01/DeleteAlias

func (*KMS) DeleteAliasWithContext

func (c *KMS) DeleteAliasWithContext(ctx aws.Context, input *DeleteAliasInput, opts ...request.Option) (*DeleteAliasOutput, error)

DeleteAliasWithContext is the same as DeleteAlias with the addition of the ability to pass a context and additional request options.

See DeleteAlias for details on how to use this API operation.

The context must be non-nil and will be used for request cancellation. If the context is nil a panic will occur. In the future the SDK may create sub-contexts for http.Requests. See https://golang.org/pkg/context/ for more information on using Contexts.

func (*KMS) DeleteCustomKeyStore

func (c *KMS) DeleteCustomKeyStore(input *DeleteCustomKeyStoreInput) (*DeleteCustomKeyStoreOutput, error)

DeleteCustomKeyStore API operation for AWS Key Management Service.

Deletes a custom key store (https://docs.aws.amazon.com/kms/latest/developerguide/custom-key-store-overview.html). This operation does not affect any backing elements of the custom key store. It does not delete the CloudHSM cluster that is associated with an CloudHSM key store, or affect any users or keys in the cluster. For an external key store, it does not affect the external key store proxy, external key manager, or any external keys.

This operation is part of the custom key stores (https://docs.aws.amazon.com/kms/latest/developerguide/custom-key-store-overview.html) feature in KMS, which combines the convenience and extensive integration of KMS with the isolation and control of a key store that you own and manage.

The custom key store that you delete cannot contain any KMS keys (https://docs.aws.amazon.com/kms/latest/developerguide/concepts.html#kms_keys). Before deleting the key store, verify that you will never need to use any of the KMS keys in the key store for any cryptographic operations (https://docs.aws.amazon.com/kms/latest/developerguide/concepts.html#cryptographic-operations). Then, use ScheduleKeyDeletion to delete the KMS keys from the key store. After the required waiting period expires and all KMS keys are deleted from the custom key store, use DisconnectCustomKeyStore to disconnect the key store from KMS. Then, you can delete the custom key store.

For keys in an CloudHSM key store, the ScheduleKeyDeletion operation makes a best effort to delete the key material from the associated cluster. However, you might need to manually delete the orphaned key material (https://docs.aws.amazon.com/kms/latest/developerguide/fix-keystore.html#fix-keystore-orphaned-key) from the cluster and its backups. KMS never creates, manages, or deletes cryptographic keys in the external key manager associated with an external key store. You must manage them using your external key manager tools.

Instead of deleting the custom key store, consider using the DisconnectCustomKeyStore operation to disconnect the custom key store from its backing key store. While the key store is disconnected, you cannot create or use the KMS keys in the key store. But, you do not need to delete KMS keys and you can reconnect a disconnected custom key store at any time.

If the operation succeeds, it returns a JSON object with no properties.

Cross-account use: No. You cannot perform this operation on a custom key store in a different Amazon Web Services account.

Required permissions: kms:DeleteCustomKeyStore (https://docs.aws.amazon.com/kms/latest/developerguide/kms-api-permissions-reference.html) (IAM policy)

Related operations:

  • ConnectCustomKeyStore

  • CreateCustomKeyStore

  • DescribeCustomKeyStores

  • DisconnectCustomKeyStore

  • UpdateCustomKeyStore

Eventual consistency: The KMS API follows an eventual consistency model. For more information, see KMS eventual consistency (https://docs.aws.amazon.com/kms/latest/developerguide/programming-eventual-consistency.html).

Returns awserr.Error for service API and SDK errors. Use runtime type assertions with awserr.Error's Code and Message methods to get detailed information about the error.

See the AWS API reference guide for AWS Key Management Service's API operation DeleteCustomKeyStore for usage and error information.

Returned Error Types:

  • CustomKeyStoreHasCMKsException The request was rejected because the custom key store contains KMS keys. After verifying that you do not need to use the KMS keys, use the ScheduleKeyDeletion operation to delete the KMS keys. After they are deleted, you can delete the custom key store.

  • CustomKeyStoreInvalidStateException The request was rejected because of the ConnectionState of the custom key store. To get the ConnectionState of a custom key store, use the DescribeCustomKeyStores operation.

    This exception is thrown under the following conditions:

  • You requested the ConnectCustomKeyStore operation on a custom key store with a ConnectionState of DISCONNECTING or FAILED. This operation is valid for all other ConnectionState values. To reconnect a custom key store in a FAILED state, disconnect it (DisconnectCustomKeyStore), then connect it (ConnectCustomKeyStore).

  • You requested the CreateKey operation in a custom key store that is not connected. This operations is valid only when the custom key store ConnectionState is CONNECTED.

  • You requested the DisconnectCustomKeyStore operation on a custom key store with a ConnectionState of DISCONNECTING or DISCONNECTED. This operation is valid for all other ConnectionState values.

  • You requested the UpdateCustomKeyStore or DeleteCustomKeyStore operation on a custom key store that is not disconnected. This operation is valid only when the custom key store ConnectionState is DISCONNECTED.

  • You requested the GenerateRandom operation in an CloudHSM key store that is not connected. This operation is valid only when the CloudHSM key store ConnectionState is CONNECTED.

  • CustomKeyStoreNotFoundException The request was rejected because KMS cannot find a custom key store with the specified key store name or ID.

  • InternalException The request was rejected because an internal exception occurred. The request can be retried.

See also, https://docs.aws.amazon.com/goto/WebAPI/kms-2014-11-01/DeleteCustomKeyStore

Example (Shared00)

To delete a custom key store from AWS KMS This example deletes a custom key store from AWS KMS. This operation does not affect the backing key store, such as a CloudHSM cluster, external key store proxy, or your external key manager. This operation doesn't return any data. To verify that the operation was successful, use the DescribeCustomKeyStores operation.

Code:

svc := kms.New(session.New())
input := &kms.DeleteCustomKeyStoreInput{
    CustomKeyStoreId: aws.String("cks-1234567890abcdef0"),
}

result, err := svc.DeleteCustomKeyStore(input)
if err != nil {
    if aerr, ok := err.(awserr.Error); ok {
        switch aerr.Code() {
        case kms.ErrCodeCustomKeyStoreHasCMKsException:
            fmt.Println(kms.ErrCodeCustomKeyStoreHasCMKsException, aerr.Error())
        case kms.ErrCodeCustomKeyStoreInvalidStateException:
            fmt.Println(kms.ErrCodeCustomKeyStoreInvalidStateException, aerr.Error())
        case kms.ErrCodeCustomKeyStoreNotFoundException:
            fmt.Println(kms.ErrCodeCustomKeyStoreNotFoundException, aerr.Error())
        case kms.ErrCodeInternalException:
            fmt.Println(kms.ErrCodeInternalException, aerr.Error())
        default:
            fmt.Println(aerr.Error())
        }
    } else {
        // Print the error, cast err to awserr.Error to get the Code and
        // Message from an error.
        fmt.Println(err.Error())
    }
    return
}

fmt.Println(result)

func (*KMS) DeleteCustomKeyStoreRequest

func (c *KMS) DeleteCustomKeyStoreRequest(input *DeleteCustomKeyStoreInput) (req *request.Request, output *DeleteCustomKeyStoreOutput)

DeleteCustomKeyStoreRequest generates a "aws/request.Request" representing the client's request for the DeleteCustomKeyStore operation. The "output" return value will be populated with the request's response once the request completes successfully.

Use "Send" method on the returned Request to send the API call to the service. the "output" return value is not valid until after Send returns without error.

See DeleteCustomKeyStore for more information on using the DeleteCustomKeyStore API call, and error handling.

This method is useful when you want to inject custom logic or configuration into the SDK's request lifecycle. Such as custom headers, or retry logic.

// Example sending a request using the DeleteCustomKeyStoreRequest method.
req, resp := client.DeleteCustomKeyStoreRequest(params)

err := req.Send()
if err == nil { // resp is now filled
    fmt.Println(resp)
}

See also, https://docs.aws.amazon.com/goto/WebAPI/kms-2014-11-01/DeleteCustomKeyStore

func (*KMS) DeleteCustomKeyStoreWithContext

func (c *KMS) DeleteCustomKeyStoreWithContext(ctx aws.Context, input *DeleteCustomKeyStoreInput, opts ...request.Option) (*DeleteCustomKeyStoreOutput, error)

DeleteCustomKeyStoreWithContext is the same as DeleteCustomKeyStore with the addition of the ability to pass a context and additional request options.

See DeleteCustomKeyStore for details on how to use this API operation.

The context must be non-nil and will be used for request cancellation. If the context is nil a panic will occur. In the future the SDK may create sub-contexts for http.Requests. See https://golang.org/pkg/context/ for more information on using Contexts.

func (*KMS) DeleteImportedKeyMaterial

func (c *KMS) DeleteImportedKeyMaterial(input *DeleteImportedKeyMaterialInput) (*DeleteImportedKeyMaterialOutput, error)

DeleteImportedKeyMaterial API operation for AWS Key Management Service.

Deletes key material that was previously imported. This operation makes the specified KMS key temporarily unusable. To restore the usability of the KMS key, reimport the same key material. For more information about importing key material into KMS, see Importing Key Material (https://docs.aws.amazon.com/kms/latest/developerguide/importing-keys.html) in the Key Management Service Developer Guide.

When the specified KMS key is in the PendingDeletion state, this operation does not change the KMS key's state. Otherwise, it changes the KMS key's state to PendingImport.

The KMS key that you use for this operation must be in a compatible key state. For details, see Key states of KMS keys (https://docs.aws.amazon.com/kms/latest/developerguide/key-state.html) in the Key Management Service Developer Guide.

Cross-account use: No. You cannot perform this operation on a KMS key in a different Amazon Web Services account.

Required permissions: kms:DeleteImportedKeyMaterial (https://docs.aws.amazon.com/kms/latest/developerguide/kms-api-permissions-reference.html) (key policy)

Related operations:

  • GetParametersForImport

  • ImportKeyMaterial

Eventual consistency: The KMS API follows an eventual consistency model. For more information, see KMS eventual consistency (https://docs.aws.amazon.com/kms/latest/developerguide/programming-eventual-consistency.html).

Returns awserr.Error for service API and SDK errors. Use runtime type assertions with awserr.Error's Code and Message methods to get detailed information about the error.

See the AWS API reference guide for AWS Key Management Service's API operation DeleteImportedKeyMaterial for usage and error information.

Returned Error Types:

  • InvalidArnException The request was rejected because a specified ARN, or an ARN in a key policy, is not valid.

  • UnsupportedOperationException The request was rejected because a specified parameter is not supported or a specified resource is not valid for this operation.

  • DependencyTimeoutException The system timed out while trying to fulfill the request. You can retry the request.

  • NotFoundException The request was rejected because the specified entity or resource could not be found.

  • InternalException The request was rejected because an internal exception occurred. The request can be retried.

  • InvalidStateException The request was rejected because the state of the specified resource is not valid for this request.

    This exceptions means one of the following:

  • The key state of the KMS key is not compatible with the operation. To find the key state, use the DescribeKey operation. For more information about which key states are compatible with each KMS operation, see Key states of KMS keys (https://docs.aws.amazon.com/kms/latest/developerguide/key-state.html) in the Key Management Service Developer Guide .

  • For cryptographic operations on KMS keys in custom key stores, this exception represents a general failure with many possible causes. To identify the cause, see the error message that accompanies the exception.

See also, https://docs.aws.amazon.com/goto/WebAPI/kms-2014-11-01/DeleteImportedKeyMaterial

Example (Shared00)

To delete imported key material The following example deletes the imported key material from the specified KMS key.

Code:

svc := kms.New(session.New())
input := &kms.DeleteImportedKeyMaterialInput{
    KeyId: aws.String("1234abcd-12ab-34cd-56ef-1234567890ab"),
}

result, err := svc.DeleteImportedKeyMaterial(input)
if err != nil {
    if aerr, ok := err.(awserr.Error); ok {
        switch aerr.Code() {
        case kms.ErrCodeInvalidArnException:
            fmt.Println(kms.ErrCodeInvalidArnException, aerr.Error())
        case kms.ErrCodeUnsupportedOperationException:
            fmt.Println(kms.ErrCodeUnsupportedOperationException, aerr.Error())
        case kms.ErrCodeDependencyTimeoutException:
            fmt.Println(kms.ErrCodeDependencyTimeoutException, aerr.Error())
        case kms.ErrCodeNotFoundException:
            fmt.Println(kms.ErrCodeNotFoundException, aerr.Error())
        case kms.ErrCodeInternalException:
            fmt.Println(kms.ErrCodeInternalException, aerr.Error())
        case kms.ErrCodeInvalidStateException:
            fmt.Println(kms.ErrCodeInvalidStateException, aerr.Error())
        default:
            fmt.Println(aerr.Error())
        }
    } else {
        // Print the error, cast err to awserr.Error to get the Code and
        // Message from an error.
        fmt.Println(err.Error())
    }
    return
}

fmt.Println(result)

func (*KMS) DeleteImportedKeyMaterialRequest

func (c *KMS) DeleteImportedKeyMaterialRequest(input *DeleteImportedKeyMaterialInput) (req *request.Request, output *DeleteImportedKeyMaterialOutput)

DeleteImportedKeyMaterialRequest generates a "aws/request.Request" representing the client's request for the DeleteImportedKeyMaterial operation. The "output" return value will be populated with the request's response once the request completes successfully.

Use "Send" method on the returned Request to send the API call to the service. the "output" return value is not valid until after Send returns without error.

See DeleteImportedKeyMaterial for more information on using the DeleteImportedKeyMaterial API call, and error handling.

This method is useful when you want to inject custom logic or configuration into the SDK's request lifecycle. Such as custom headers, or retry logic.

// Example sending a request using the DeleteImportedKeyMaterialRequest method.
req, resp := client.DeleteImportedKeyMaterialRequest(params)

err := req.Send()
if err == nil { // resp is now filled
    fmt.Println(resp)
}

See also, https://docs.aws.amazon.com/goto/WebAPI/kms-2014-11-01/DeleteImportedKeyMaterial

func (*KMS) DeleteImportedKeyMaterialWithContext

func (c *KMS) DeleteImportedKeyMaterialWithContext(ctx aws.Context, input *DeleteImportedKeyMaterialInput, opts ...request.Option) (*DeleteImportedKeyMaterialOutput, error)

DeleteImportedKeyMaterialWithContext is the same as DeleteImportedKeyMaterial with the addition of the ability to pass a context and additional request options.

See DeleteImportedKeyMaterial for details on how to use this API operation.

The context must be non-nil and will be used for request cancellation. If the context is nil a panic will occur. In the future the SDK may create sub-contexts for http.Requests. See https://golang.org/pkg/context/ for more information on using Contexts.

func (*KMS) DeriveSharedSecret

func (c *KMS) DeriveSharedSecret(input *DeriveSharedSecretInput) (*DeriveSharedSecretOutput, error)

DeriveSharedSecret API operation for AWS Key Management Service.

Derives a shared secret using a key agreement algorithm.

You must use an asymmetric NIST-recommended elliptic curve (ECC) or SM2 (China Regions only) KMS key pair with a KeyUsage value of KEY_AGREEMENT to call DeriveSharedSecret.

DeriveSharedSecret uses the Elliptic Curve Cryptography Cofactor Diffie-Hellman Primitive (https://nvlpubs.nist.gov/nistpubs/SpecialPublications/NIST.SP.800-56Ar3.pdf#page=60) (ECDH) to establish a key agreement between two peers by deriving a shared secret from their elliptic curve public-private key pairs. You can use the raw shared secret that DeriveSharedSecret returns to derive a symmetric key that can encrypt and decrypt data that is sent between the two peers, or that can generate and verify HMACs. KMS recommends that you follow NIST recommendations for key derivation (https://nvlpubs.nist.gov/nistpubs/SpecialPublications/NIST.SP.800-56Cr2.pdf) when using the raw shared secret to derive a symmetric key.

The following workflow demonstrates how to establish key agreement over an insecure communication channel using DeriveSharedSecret.

Alice calls CreateKey to create an asymmetric KMS key pair with a KeyUsage value of KEY_AGREEMENT.

The asymmetric KMS key must use a NIST-recommended elliptic curve (ECC) or SM2 (China Regions only) key spec.

Bob creates an elliptic curve key pair.

Bob can call CreateKey to create an asymmetric KMS key pair or generate a key pair outside of KMS. Bob's key pair must use the same NIST-recommended elliptic curve (ECC) or SM2 (China Regions ony) curve as Alice.

Alice and Bob exchange their public keys through an insecure communication channel (like the internet).

Use GetPublicKey to download the public key of your asymmetric KMS key pair.

KMS strongly recommends verifying that the public key you receive came from the expected party before using it to derive a shared secret.

Alice calls DeriveSharedSecret.

KMS uses the private key from the KMS key pair generated in Step 1, Bob's public key, and the Elliptic Curve Cryptography Cofactor Diffie-Hellman Primitive to derive the shared secret. The private key in your KMS key pair never leaves KMS unencrypted. DeriveSharedSecret returns the raw shared secret.

Bob uses the Elliptic Curve Cryptography Cofactor Diffie-Hellman Primitive to calculate the same raw secret using his private key and Alice's public key.

To derive a shared secret you must provide a key agreement algorithm, the private key of the caller's asymmetric NIST-recommended elliptic curve or SM2 (China Regions only) KMS key pair, and the public key from your peer's NIST-recommended elliptic curve or SM2 (China Regions only) key pair. The public key can be from another asymmetric KMS key pair or from a key pair generated outside of KMS, but both key pairs must be on the same elliptic curve.

The KMS key that you use for this operation must be in a compatible key state. For details, see Key states of KMS keys (https://docs.aws.amazon.com/kms/latest/developerguide/key-state.html) in the Key Management Service Developer Guide.

Cross-account use: Yes. To perform this operation with a KMS key in a different Amazon Web Services account, specify the key ARN or alias ARN in the value of the KeyId parameter.

Required permissions: kms:DeriveSharedSecret (https://docs.aws.amazon.com/kms/latest/developerguide/kms-api-permissions-reference.html) (key policy)

Related operations:

  • CreateKey

  • GetPublicKey

  • DescribeKey

Eventual consistency: The KMS API follows an eventual consistency model. For more information, see KMS eventual consistency (https://docs.aws.amazon.com/kms/latest/developerguide/programming-eventual-consistency.html).

Returns awserr.Error for service API and SDK errors. Use runtime type assertions with awserr.Error's Code and Message methods to get detailed information about the error.

See the AWS API reference guide for AWS Key Management Service's API operation DeriveSharedSecret for usage and error information.

Returned Error Types:

  • NotFoundException The request was rejected because the specified entity or resource could not be found.

  • DisabledException The request was rejected because the specified KMS key is not enabled.

  • KeyUnavailableException The request was rejected because the specified KMS key was not available. You can retry the request.

  • DependencyTimeoutException The system timed out while trying to fulfill the request. You can retry the request.

  • InvalidGrantTokenException The request was rejected because the specified grant token is not valid.

  • InvalidKeyUsageException The request was rejected for one of the following reasons:

  • The KeyUsage value of the KMS key is incompatible with the API operation.

  • The encryption algorithm or signing algorithm specified for the operation is incompatible with the type of key material in the KMS key (KeySpec).

    For encrypting, decrypting, re-encrypting, and generating data keys, the KeyUsage must be ENCRYPT_DECRYPT. For signing and verifying messages, the KeyUsage must be SIGN_VERIFY. For generating and verifying message authentication codes (MACs), the KeyUsage must be GENERATE_VERIFY_MAC. For deriving key agreement secrets, the KeyUsage must be KEY_AGREEMENT. To find the KeyUsage of a KMS key, use the DescribeKey operation.

    To find the encryption or signing algorithms supported for a particular KMS key, use the DescribeKey operation.

  • InternalException The request was rejected because an internal exception occurred. The request can be retried.

  • InvalidStateException The request was rejected because the state of the specified resource is not valid for this request.

    This exceptions means one of the following:

  • The key state of the KMS key is not compatible with the operation. To find the key state, use the DescribeKey operation. For more information about which key states are compatible with each KMS operation, see Key states of KMS keys (https://docs.aws.amazon.com/kms/latest/developerguide/key-state.html) in the Key Management Service Developer Guide .

  • For cryptographic operations on KMS keys in custom key stores, this exception represents a general failure with many possible causes. To identify the cause, see the error message that accompanies the exception.

  • DryRunOperationException The request was rejected because the DryRun parameter was specified.

See also, https://docs.aws.amazon.com/goto/WebAPI/kms-2014-11-01/DeriveSharedSecret

Example (Shared00)

To derive a shared secret The following example derives a shared secret using a key agreement algorithm.

Code:

svc := kms.New(session.New())
input := &kms.DeriveSharedSecretInput{
    KeyAgreementAlgorithm: aws.String("ECDH"),
    KeyId:                 aws.String("1234abcd-12ab-34cd-56ef-1234567890ab"),
    PublicKey:             []byte("MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAvH3Yj0wbkLEpUl95Cv1cJVjsVNSjwGq3tCLnzXfhVwVvmzGN8pYj3U8nKwgouaHbBWNJYjP5VutbbkKS4Kv4GojwZBJyHN17kmxo8yTjRmjR15SKIQ8cqRA2uaERMLnpztIXdZp232PQPbWGxDyXYJ0aJ5EFSag"),
}

result, err := svc.DeriveSharedSecret(input)
if err != nil {
    if aerr, ok := err.(awserr.Error); ok {
        switch aerr.Code() {
        case kms.ErrCodeNotFoundException:
            fmt.Println(kms.ErrCodeNotFoundException, aerr.Error())
        case kms.ErrCodeDisabledException:
            fmt.Println(kms.ErrCodeDisabledException, aerr.Error())
        case kms.ErrCodeKeyUnavailableException:
            fmt.Println(kms.ErrCodeKeyUnavailableException, aerr.Error())
        case kms.ErrCodeDependencyTimeoutException:
            fmt.Println(kms.ErrCodeDependencyTimeoutException, aerr.Error())
        case kms.ErrCodeInvalidGrantTokenException:
            fmt.Println(kms.ErrCodeInvalidGrantTokenException, aerr.Error())
        case kms.ErrCodeInvalidKeyUsageException:
            fmt.Println(kms.ErrCodeInvalidKeyUsageException, aerr.Error())
        case kms.ErrCodeInternalException:
            fmt.Println(kms.ErrCodeInternalException, aerr.Error())
        case kms.ErrCodeInvalidStateException:
            fmt.Println(kms.ErrCodeInvalidStateException, aerr.Error())
        case kms.ErrCodeDryRunOperationException:
            fmt.Println(kms.ErrCodeDryRunOperationException, aerr.Error())
        default:
            fmt.Println(aerr.Error())
        }
    } else {
        // Print the error, cast err to awserr.Error to get the Code and
        // Message from an error.
        fmt.Println(err.Error())
    }
    return
}

fmt.Println(result)

func (*KMS) DeriveSharedSecretRequest

func (c *KMS) DeriveSharedSecretRequest(input *DeriveSharedSecretInput) (req *request.Request, output *DeriveSharedSecretOutput)

DeriveSharedSecretRequest generates a "aws/request.Request" representing the client's request for the DeriveSharedSecret operation. The "output" return value will be populated with the request's response once the request completes successfully.

Use "Send" method on the returned Request to send the API call to the service. the "output" return value is not valid until after Send returns without error.

See DeriveSharedSecret for more information on using the DeriveSharedSecret API call, and error handling.

This method is useful when you want to inject custom logic or configuration into the SDK's request lifecycle. Such as custom headers, or retry logic.

// Example sending a request using the DeriveSharedSecretRequest method.
req, resp := client.DeriveSharedSecretRequest(params)

err := req.Send()
if err == nil { // resp is now filled
    fmt.Println(resp)
}

See also, https://docs.aws.amazon.com/goto/WebAPI/kms-2014-11-01/DeriveSharedSecret

func (*KMS) DeriveSharedSecretWithContext

func (c *KMS) DeriveSharedSecretWithContext(ctx aws.Context, input *DeriveSharedSecretInput, opts ...request.Option) (*DeriveSharedSecretOutput, error)

DeriveSharedSecretWithContext is the same as DeriveSharedSecret with the addition of the ability to pass a context and additional request options.

See DeriveSharedSecret for details on how to use this API operation.

The context must be non-nil and will be used for request cancellation. If the context is nil a panic will occur. In the future the SDK may create sub-contexts for http.Requests. See https://golang.org/pkg/context/ for more information on using Contexts.

func (*KMS) DescribeCustomKeyStores

func (c *KMS) DescribeCustomKeyStores(input *DescribeCustomKeyStoresInput) (*DescribeCustomKeyStoresOutput, error)

DescribeCustomKeyStores API operation for AWS Key Management Service.

Gets information about custom key stores (https://docs.aws.amazon.com/kms/latest/developerguide/custom-key-store-overview.html) in the account and Region.

This operation is part of the custom key stores (https://docs.aws.amazon.com/kms/latest/developerguide/custom-key-store-overview.html) feature in KMS, which combines the convenience and extensive integration of KMS with the isolation and control of a key store that you own and manage.

By default, this operation returns information about all custom key stores in the account and Region. To get only information about a particular custom key store, use either the CustomKeyStoreName or CustomKeyStoreId parameter (but not both).

To determine whether the custom key store is connected to its CloudHSM cluster or external key store proxy, use the ConnectionState element in the response. If an attempt to connect the custom key store failed, the ConnectionState value is FAILED and the ConnectionErrorCode element in the response indicates the cause of the failure. For help interpreting the ConnectionErrorCode, see CustomKeyStoresListEntry.

Custom key stores have a DISCONNECTED connection state if the key store has never been connected or you used the DisconnectCustomKeyStore operation to disconnect it. Otherwise, the connection state is CONNECTED. If your custom key store connection state is CONNECTED but you are having trouble using it, verify that the backing store is active and available. For an CloudHSM key store, verify that the associated CloudHSM cluster is active and contains the minimum number of HSMs required for the operation, if any. For an external key store, verify that the external key store proxy and its associated external key manager are reachable and enabled.

For help repairing your CloudHSM key store, see the Troubleshooting CloudHSM key stores (https://docs.aws.amazon.com/kms/latest/developerguide/fix-keystore.html). For help repairing your external key store, see the Troubleshooting external key stores (https://docs.aws.amazon.com/kms/latest/developerguide/xks-troubleshooting.html). Both topics are in the Key Management Service Developer Guide.

Cross-account use: No. You cannot perform this operation on a custom key store in a different Amazon Web Services account.

Required permissions: kms:DescribeCustomKeyStores (https://docs.aws.amazon.com/kms/latest/developerguide/kms-api-permissions-reference.html) (IAM policy)

Related operations:

  • ConnectCustomKeyStore

  • CreateCustomKeyStore

  • DeleteCustomKeyStore

  • DisconnectCustomKeyStore

  • UpdateCustomKeyStore

Eventual consistency: The KMS API follows an eventual consistency model. For more information, see KMS eventual consistency (https://docs.aws.amazon.com/kms/latest/developerguide/programming-eventual-consistency.html).

Returns awserr.Error for service API and SDK errors. Use runtime type assertions with awserr.Error's Code and Message methods to get detailed information about the error.

See the AWS API reference guide for AWS Key Management Service's API operation DescribeCustomKeyStores for usage and error information.

Returned Error Types:

  • CustomKeyStoreNotFoundException The request was rejected because KMS cannot find a custom key store with the specified key store name or ID.

  • InvalidMarkerException The request was rejected because the marker that specifies where pagination should next begin is not valid.

  • InternalException The request was rejected because an internal exception occurred. The request can be retried.

See also, https://docs.aws.amazon.com/goto/WebAPI/kms-2014-11-01/DescribeCustomKeyStores

Example (Shared00)

To get detailed information about custom key stores in the account and Region This example gets detailed information about all AWS KMS custom key stores in an AWS account and Region. To get all key stores, do not enter a custom key store name or ID.

Code:

svc := kms.New(session.New())
input := &kms.DescribeCustomKeyStoresInput{}

result, err := svc.DescribeCustomKeyStores(input)
if err != nil {
    if aerr, ok := err.(awserr.Error); ok {
        switch aerr.Code() {
        case kms.ErrCodeCustomKeyStoreNotFoundException:
            fmt.Println(kms.ErrCodeCustomKeyStoreNotFoundException, aerr.Error())
        case kms.ErrCodeInvalidMarkerException:
            fmt.Println(kms.ErrCodeInvalidMarkerException, aerr.Error())
        case kms.ErrCodeInternalException:
            fmt.Println(kms.ErrCodeInternalException, aerr.Error())
        default:
            fmt.Println(aerr.Error())
        }
    } else {
        // Print the error, cast err to awserr.Error to get the Code and
        // Message from an error.
        fmt.Println(err.Error())
    }
    return
}

fmt.Println(result)

Example (Shared01)

To get detailed information about an AWS CloudHSM key store by specifying its friendly name This example gets detailed information about a particular AWS CloudHSM key store by specifying its friendly name. To limit the output to a particular custom key store, provide either the custom key store name or ID.

Code:

svc := kms.New(session.New())
input := &kms.DescribeCustomKeyStoresInput{
    CustomKeyStoreName: aws.String("ExampleKeyStore"),
}

result, err := svc.DescribeCustomKeyStores(input)
if err != nil {
    if aerr, ok := err.(awserr.Error); ok {
        switch aerr.Code() {
        case kms.ErrCodeCustomKeyStoreNotFoundException:
            fmt.Println(kms.ErrCodeCustomKeyStoreNotFoundException, aerr.Error())
        case kms.ErrCodeInvalidMarkerException:
            fmt.Println(kms.ErrCodeInvalidMarkerException, aerr.Error())
        case kms.ErrCodeInternalException:
            fmt.Println(kms.ErrCodeInternalException, aerr.Error())
        default:
            fmt.Println(aerr.Error())
        }
    } else {
        // Print the error, cast err to awserr.Error to get the Code and
        // Message from an error.
        fmt.Println(err.Error())
    }
    return
}

fmt.Println(result)

Example (Shared02)

To get detailed information about an external key store by specifying its ID This example gets detailed information about an external key store by specifying its ID. The example external key store proxy uses public endpoint connectivity.

Code:

svc := kms.New(session.New())
input := &kms.DescribeCustomKeyStoresInput{
    CustomKeyStoreId: aws.String("cks-9876543210fedcba9"),
}

result, err := svc.DescribeCustomKeyStores(input)
if err != nil {
    if aerr, ok := err.(awserr.Error); ok {
        switch aerr.Code() {
        case kms.ErrCodeCustomKeyStoreNotFoundException:
            fmt.Println(kms.ErrCodeCustomKeyStoreNotFoundException, aerr.Error())
        case kms.ErrCodeInvalidMarkerException:
            fmt.Println(kms.ErrCodeInvalidMarkerException, aerr.Error())
        case kms.ErrCodeInternalException:
            fmt.Println(kms.ErrCodeInternalException, aerr.Error())
        default:
            fmt.Println(aerr.Error())
        }
    } else {
        // Print the error, cast err to awserr.Error to get the Code and
        // Message from an error.
        fmt.Println(err.Error())
    }
    return
}

fmt.Println(result)

Example (Shared03)

To get detailed information about an external key store VPC endpoint connectivity by specifying its friendly name This example gets detailed information about a particular external key store by specifying its friendly name. To limit the output to a particular custom key store, provide either the custom key store name or ID. The proxy URI path for this external key store includes an optional prefix. Also, because this example external key store uses VPC endpoint connectivity, the response includes the associated VPC endpoint service name.

Code:

svc := kms.New(session.New())
input := &kms.DescribeCustomKeyStoresInput{
    CustomKeyStoreName: aws.String("VPCExternalKeystore"),
}

result, err := svc.DescribeCustomKeyStores(input)
if err != nil {
    if aerr, ok := err.(awserr.Error); ok {
        switch aerr.Code() {
        case kms.ErrCodeCustomKeyStoreNotFoundException:
            fmt.Println(kms.ErrCodeCustomKeyStoreNotFoundException, aerr.Error())
        case kms.ErrCodeInvalidMarkerException:
            fmt.Println(kms.ErrCodeInvalidMarkerException, aerr.Error())
        case kms.ErrCodeInternalException:
            fmt.Println(kms.ErrCodeInternalException, aerr.Error())
        default:
            fmt.Println(aerr.Error())
        }
    } else {
        // Print the error, cast err to awserr.Error to get the Code and
        // Message from an error.
        fmt.Println(err.Error())
    }
    return
}

fmt.Println(result)

func (*KMS) DescribeCustomKeyStoresPages

func (c *KMS) DescribeCustomKeyStoresPages(input *DescribeCustomKeyStoresInput, fn func(*DescribeCustomKeyStoresOutput, bool) bool) error

DescribeCustomKeyStoresPages iterates over the pages of a DescribeCustomKeyStores operation, calling the "fn" function with the response data for each page. To stop iterating, return false from the fn function.

See DescribeCustomKeyStores method for more information on how to use this operation.

Note: This operation can generate multiple requests to a service.

// Example iterating over at most 3 pages of a DescribeCustomKeyStores operation.
pageNum := 0
err := client.DescribeCustomKeyStoresPages(params,
    func(page *kms.DescribeCustomKeyStoresOutput, lastPage bool) bool {
        pageNum++
        fmt.Println(page)
        return pageNum <= 3
    })

func (*KMS) DescribeCustomKeyStoresPagesWithContext

func (c *KMS) DescribeCustomKeyStoresPagesWithContext(ctx aws.Context, input *DescribeCustomKeyStoresInput, fn func(*DescribeCustomKeyStoresOutput, bool) bool, opts ...request.Option) error

DescribeCustomKeyStoresPagesWithContext same as DescribeCustomKeyStoresPages except it takes a Context and allows setting request options on the pages.

The context must be non-nil and will be used for request cancellation. If the context is nil a panic will occur. In the future the SDK may create sub-contexts for http.Requests. See https://golang.org/pkg/context/ for more information on using Contexts.

func (*KMS) DescribeCustomKeyStoresRequest

func (c *KMS) DescribeCustomKeyStoresRequest(input *DescribeCustomKeyStoresInput) (req *request.Request, output *DescribeCustomKeyStoresOutput)

DescribeCustomKeyStoresRequest generates a "aws/request.Request" representing the client's request for the DescribeCustomKeyStores operation. The "output" return value will be populated with the request's response once the request completes successfully.

Use "Send" method on the returned Request to send the API call to the service. the "output" return value is not valid until after Send returns without error.

See DescribeCustomKeyStores for more information on using the DescribeCustomKeyStores API call, and error handling.

This method is useful when you want to inject custom logic or configuration into the SDK's request lifecycle. Such as custom headers, or retry logic.

// Example sending a request using the DescribeCustomKeyStoresRequest method.
req, resp := client.DescribeCustomKeyStoresRequest(params)

err := req.Send()
if err == nil { // resp is now filled
    fmt.Println(resp)
}

See also, https://docs.aws.amazon.com/goto/WebAPI/kms-2014-11-01/DescribeCustomKeyStores

func (*KMS) DescribeCustomKeyStoresWithContext

func (c *KMS) DescribeCustomKeyStoresWithContext(ctx aws.Context, input *DescribeCustomKeyStoresInput, opts ...request.Option) (*DescribeCustomKeyStoresOutput, error)

DescribeCustomKeyStoresWithContext is the same as DescribeCustomKeyStores with the addition of the ability to pass a context and additional request options.

See DescribeCustomKeyStores for details on how to use this API operation.

The context must be non-nil and will be used for request cancellation. If the context is nil a panic will occur. In the future the SDK may create sub-contexts for http.Requests. See https://golang.org/pkg/context/ for more information on using Contexts.

func (*KMS) DescribeKey

func (c *KMS) DescribeKey(input *DescribeKeyInput) (*DescribeKeyOutput, error)

DescribeKey API operation for AWS Key Management Service.

Provides detailed information about a KMS key. You can run DescribeKey on a customer managed key (https://docs.aws.amazon.com/kms/latest/developerguide/concepts.html#customer-cmk) or an Amazon Web Services managed key (https://docs.aws.amazon.com/kms/latest/developerguide/concepts.html#aws-managed-cmk).

This detailed information includes the key ARN, creation date (and deletion date, if applicable), the key state, and the origin and expiration date (if any) of the key material. It includes fields, like KeySpec, that help you distinguish different types of KMS keys. It also displays the key usage (encryption, signing, or generating and verifying MACs) and the algorithms that the KMS key supports.

For multi-Region keys (https://docs.aws.amazon.com/kms/latest/developerguide/multi-region-keys-overview.html), DescribeKey displays the primary key and all related replica keys. For KMS keys in CloudHSM key stores (https://docs.aws.amazon.com/kms/latest/developerguide/keystore-cloudhsm.html), it includes information about the key store, such as the key store ID and the CloudHSM cluster ID. For KMS keys in external key stores (https://docs.aws.amazon.com/kms/latest/developerguide/keystore-external.html), it includes the custom key store ID and the ID of the external key.

DescribeKey does not return the following information:

  • Aliases associated with the KMS key. To get this information, use ListAliases.

  • Whether automatic key rotation is enabled on the KMS key. To get this information, use GetKeyRotationStatus. Also, some key states prevent a KMS key from being automatically rotated. For details, see How Automatic Key Rotation Works (https://docs.aws.amazon.com/kms/latest/developerguide/rotate-keys.html#rotate-keys-how-it-works) in the Key Management Service Developer Guide.

  • Tags on the KMS key. To get this information, use ListResourceTags.

  • Key policies and grants on the KMS key. To get this information, use GetKeyPolicy and ListGrants.

In general, DescribeKey is a non-mutating operation. It returns data about KMS keys, but doesn't change them. However, Amazon Web Services services use DescribeKey to create Amazon Web Services managed keys (https://docs.aws.amazon.com/kms/latest/developerguide/concepts.html#aws-managed-cmk) from a predefined Amazon Web Services alias with no key ID.

Cross-account use: Yes. To perform this operation with a KMS key in a different Amazon Web Services account, specify the key ARN or alias ARN in the value of the KeyId parameter.

Required permissions: kms:DescribeKey (https://docs.aws.amazon.com/kms/latest/developerguide/kms-api-permissions-reference.html) (key policy)

Related operations:

  • GetKeyPolicy

  • GetKeyRotationStatus

  • ListAliases

  • ListGrants

  • ListKeys

  • ListResourceTags

  • ListRetirableGrants

Eventual consistency: The KMS API follows an eventual consistency model. For more information, see KMS eventual consistency (https://docs.aws.amazon.com/kms/latest/developerguide/programming-eventual-consistency.html).

Returns awserr.Error for service API and SDK errors. Use runtime type assertions with awserr.Error's Code and Message methods to get detailed information about the error.

See the AWS API reference guide for AWS Key Management Service's API operation DescribeKey for usage and error information.

Returned Error Types:

  • NotFoundException The request was rejected because the specified entity or resource could not be found.

  • InvalidArnException The request was rejected because a specified ARN, or an ARN in a key policy, is not valid.

  • DependencyTimeoutException The system timed out while trying to fulfill the request. You can retry the request.

  • InternalException The request was rejected because an internal exception occurred. The request can be retried.

See also, https://docs.aws.amazon.com/goto/WebAPI/kms-2014-11-01/DescribeKey

Example (Shared00)

To get details about a KMS key The following example gets metadata for a symmetric encryption KMS key.

Code:

svc := kms.New(session.New())
input := &kms.DescribeKeyInput{
    KeyId: aws.String("1234abcd-12ab-34cd-56ef-1234567890ab"),
}

result, err := svc.DescribeKey(input)
if err != nil {
    if aerr, ok := err.(awserr.Error); ok {
        switch aerr.Code() {
        case kms.ErrCodeNotFoundException:
            fmt.Println(kms.ErrCodeNotFoundException, aerr.Error())
        case kms.ErrCodeInvalidArnException:
            fmt.Println(kms.ErrCodeInvalidArnException, aerr.Error())
        case kms.ErrCodeDependencyTimeoutException:
            fmt.Println(kms.ErrCodeDependencyTimeoutException, aerr.Error())
        case kms.ErrCodeInternalException:
            fmt.Println(kms.ErrCodeInternalException, aerr.Error())
        default:
            fmt.Println(aerr.Error())
        }
    } else {
        // Print the error, cast err to awserr.Error to get the Code and
        // Message from an error.
        fmt.Println(err.Error())
    }
    return
}

fmt.Println(result)

Example (Shared01)

To get details about an RSA asymmetric KMS key The following example gets metadata for an asymmetric RSA KMS key used for signing and verification.

Code:

svc := kms.New(session.New())
input := &kms.DescribeKeyInput{
    KeyId: aws.String("1234abcd-12ab-34cd-56ef-1234567890ab"),
}

result, err := svc.DescribeKey(input)
if err != nil {
    if aerr, ok := err.(awserr.Error); ok {
        switch aerr.Code() {
        case kms.ErrCodeNotFoundException:
            fmt.Println(kms.ErrCodeNotFoundException, aerr.Error())
        case kms.ErrCodeInvalidArnException:
            fmt.Println(kms.ErrCodeInvalidArnException, aerr.Error())
        case kms.ErrCodeDependencyTimeoutException:
            fmt.Println(kms.ErrCodeDependencyTimeoutException, aerr.Error())
        case kms.ErrCodeInternalException:
            fmt.Println(kms.ErrCodeInternalException, aerr.Error())
        default:
            fmt.Println(aerr.Error())
        }
    } else {
        // Print the error, cast err to awserr.Error to get the Code and
        // Message from an error.
        fmt.Println(err.Error())
    }
    return
}

fmt.Println(result)

Example (Shared02)

To get details about a multi-Region key The following example gets metadata for a multi-Region replica key. This multi-Region key is a symmetric encryption key. DescribeKey returns information about the primary key and all of its replicas.

Code:

svc := kms.New(session.New())
input := &kms.DescribeKeyInput{
    KeyId: aws.String("arn:aws:kms:ap-northeast-1:111122223333:key/mrk-1234abcd12ab34cd56ef1234567890ab"),
}

result, err := svc.DescribeKey(input)
if err != nil {
    if aerr, ok := err.(awserr.Error); ok {
        switch aerr.Code() {
        case kms.ErrCodeNotFoundException:
            fmt.Println(kms.ErrCodeNotFoundException, aerr.Error())
        case kms.ErrCodeInvalidArnException:
            fmt.Println(kms.ErrCodeInvalidArnException, aerr.Error())
        case kms.ErrCodeDependencyTimeoutException:
            fmt.Println(kms.ErrCodeDependencyTimeoutException, aerr.Error())
        case kms.ErrCodeInternalException:
            fmt.Println(kms.ErrCodeInternalException, aerr.Error())
        default:
            fmt.Println(aerr.Error())
        }
    } else {
        // Print the error, cast err to awserr.Error to get the Code and
        // Message from an error.
        fmt.Println(err.Error())
    }
    return
}

fmt.Println(result)

Example (Shared03)

To get details about an HMAC KMS key The following example gets the metadata of an HMAC KMS key.

Code:

svc := kms.New(session.New())
input := &kms.DescribeKeyInput{
    KeyId: aws.String("arn:aws:kms:us-west-2:111122223333:key/1234abcd-12ab-34cd-56ef-1234567890ab"),
}

result, err := svc.DescribeKey(input)
if err != nil {
    if aerr, ok := err.(awserr.Error); ok {
        switch aerr.Code() {
        case kms.ErrCodeNotFoundException:
            fmt.Println(kms.ErrCodeNotFoundException, aerr.Error())
        case kms.ErrCodeInvalidArnException:
            fmt.Println(kms.ErrCodeInvalidArnException, aerr.Error())
        case kms.ErrCodeDependencyTimeoutException:
            fmt.Println(kms.ErrCodeDependencyTimeoutException, aerr.Error())
        case kms.ErrCodeInternalException:
            fmt.Println(kms.ErrCodeInternalException, aerr.Error())
        default:
            fmt.Println(aerr.Error())
        }
    } else {
        // Print the error, cast err to awserr.Error to get the Code and
        // Message from an error.
        fmt.Println(err.Error())
    }
    return
}

fmt.Println(result)

Example (Shared04)

To get details about a KMS key in an AWS CloudHSM key store The following example gets the metadata of a KMS key in an AWS CloudHSM key store.

Code:

svc := kms.New(session.New())
input := &kms.DescribeKeyInput{
    KeyId: aws.String("arn:aws:kms:us-west-2:111122223333:key/1234abcd-12ab-34cd-56ef-1234567890ab"),
}

result, err := svc.DescribeKey(input)
if err != nil {
    if aerr, ok := err.(awserr.Error); ok {
        switch aerr.Code() {
        case kms.ErrCodeNotFoundException:
            fmt.Println(kms.ErrCodeNotFoundException, aerr.Error())
        case kms.ErrCodeInvalidArnException:
            fmt.Println(kms.ErrCodeInvalidArnException, aerr.Error())
        case kms.ErrCodeDependencyTimeoutException:
            fmt.Println(kms.ErrCodeDependencyTimeoutException, aerr.Error())
        case kms.ErrCodeInternalException:
            fmt.Println(kms.ErrCodeInternalException, aerr.Error())
        default:
            fmt.Println(aerr.Error())
        }
    } else {
        // Print the error, cast err to awserr.Error to get the Code and
        // Message from an error.
        fmt.Println(err.Error())
    }
    return
}

fmt.Println(result)

Example (Shared05)

To get details about a KMS key in an external key store The following example gets the metadata of a KMS key in an external key store.

Code:

svc := kms.New(session.New())
input := &kms.DescribeKeyInput{
    KeyId: aws.String("arn:aws:kms:us-west-2:111122223333:key/1234abcd-12ab-34cd-56ef-1234567890ab"),
}

result, err := svc.DescribeKey(input)
if err != nil {
    if aerr, ok := err.(awserr.Error); ok {
        switch aerr.Code() {
        case kms.ErrCodeNotFoundException:
            fmt.Println(kms.ErrCodeNotFoundException, aerr.Error())
        case kms.ErrCodeInvalidArnException:
            fmt.Println(kms.ErrCodeInvalidArnException, aerr.Error())
        case kms.ErrCodeDependencyTimeoutException:
            fmt.Println(kms.ErrCodeDependencyTimeoutException, aerr.Error())
        case kms.ErrCodeInternalException:
            fmt.Println(kms.ErrCodeInternalException, aerr.Error())
        default:
            fmt.Println(aerr.Error())
        }
    } else {
        // Print the error, cast err to awserr.Error to get the Code and
        // Message from an error.
        fmt.Println(err.Error())
    }
    return
}

fmt.Println(result)

func (*KMS) DescribeKeyRequest

func (c *KMS) DescribeKeyRequest(input *DescribeKeyInput) (req *request.Request, output *DescribeKeyOutput)

DescribeKeyRequest generates a "aws/request.Request" representing the client's request for the DescribeKey operation. The "output" return value will be populated with the request's response once the request completes successfully.

Use "Send" method on the returned Request to send the API call to the service. the "output" return value is not valid until after Send returns without error.

See DescribeKey for more information on using the DescribeKey API call, and error handling.

This method is useful when you want to inject custom logic or configuration into the SDK's request lifecycle. Such as custom headers, or retry logic.

// Example sending a request using the DescribeKeyRequest method.
req, resp := client.DescribeKeyRequest(params)

err := req.Send()
if err == nil { // resp is now filled
    fmt.Println(resp)
}

See also, https://docs.aws.amazon.com/goto/WebAPI/kms-2014-11-01/DescribeKey

func (*KMS) DescribeKeyWithContext

func (c *KMS) DescribeKeyWithContext(ctx aws.Context, input *DescribeKeyInput, opts ...request.Option) (*DescribeKeyOutput, error)

DescribeKeyWithContext is the same as DescribeKey with the addition of the ability to pass a context and additional request options.

See DescribeKey for details on how to use this API operation.

The context must be non-nil and will be used for request cancellation. If the context is nil a panic will occur. In the future the SDK may create sub-contexts for http.Requests. See https://golang.org/pkg/context/ for more information on using Contexts.

func (*KMS) DisableKey

func (c *KMS) DisableKey(input *DisableKeyInput) (*DisableKeyOutput, error)

DisableKey API operation for AWS Key Management Service.

Sets the state of a KMS key to disabled. This change temporarily prevents use of the KMS key for cryptographic operations (https://docs.aws.amazon.com/kms/latest/developerguide/concepts.html#cryptographic-operations).

For more information about how key state affects the use of a KMS key, see Key states of KMS keys (https://docs.aws.amazon.com/kms/latest/developerguide/key-state.html) in the Key Management Service Developer Guide .

The KMS key that you use for this operation must be in a compatible key state. For details, see Key states of KMS keys (https://docs.aws.amazon.com/kms/latest/developerguide/key-state.html) in the Key Management Service Developer Guide.

Cross-account use: No. You cannot perform this operation on a KMS key in a different Amazon Web Services account.

Required permissions: kms:DisableKey (https://docs.aws.amazon.com/kms/latest/developerguide/kms-api-permissions-reference.html) (key policy)

Related operations: EnableKey

Eventual consistency: The KMS API follows an eventual consistency model. For more information, see KMS eventual consistency (https://docs.aws.amazon.com/kms/latest/developerguide/programming-eventual-consistency.html).

Returns awserr.Error for service API and SDK errors. Use runtime type assertions with awserr.Error's Code and Message methods to get detailed information about the error.

See the AWS API reference guide for AWS Key Management Service's API operation DisableKey for usage and error information.

Returned Error Types:

  • NotFoundException The request was rejected because the specified entity or resource could not be found.

  • InvalidArnException The request was rejected because a specified ARN, or an ARN in a key policy, is not valid.

  • DependencyTimeoutException The system timed out while trying to fulfill the request. You can retry the request.

  • InternalException The request was rejected because an internal exception occurred. The request can be retried.

  • InvalidStateException The request was rejected because the state of the specified resource is not valid for this request.

    This exceptions means one of the following:

  • The key state of the KMS key is not compatible with the operation. To find the key state, use the DescribeKey operation. For more information about which key states are compatible with each KMS operation, see Key states of KMS keys (https://docs.aws.amazon.com/kms/latest/developerguide/key-state.html) in the Key Management Service Developer Guide .

  • For cryptographic operations on KMS keys in custom key stores, this exception represents a general failure with many possible causes. To identify the cause, see the error message that accompanies the exception.

See also, https://docs.aws.amazon.com/goto/WebAPI/kms-2014-11-01/DisableKey

Example (Shared00)

To disable a KMS key The following example disables the specified KMS key.

Code:

svc := kms.New(session.New())
input := &kms.DisableKeyInput{
    KeyId: aws.String("1234abcd-12ab-34cd-56ef-1234567890ab"),
}

result, err := svc.DisableKey(input)
if err != nil {
    if aerr, ok := err.(awserr.Error); ok {
        switch aerr.Code() {
        case kms.ErrCodeNotFoundException:
            fmt.Println(kms.ErrCodeNotFoundException, aerr.Error())
        case kms.ErrCodeInvalidArnException:
            fmt.Println(kms.ErrCodeInvalidArnException, aerr.Error())
        case kms.ErrCodeDependencyTimeoutException:
            fmt.Println(kms.ErrCodeDependencyTimeoutException, aerr.Error())
        case kms.ErrCodeInternalException:
            fmt.Println(kms.ErrCodeInternalException, aerr.Error())
        case kms.ErrCodeInvalidStateException:
            fmt.Println(kms.ErrCodeInvalidStateException, aerr.Error())
        default:
            fmt.Println(aerr.Error())
        }
    } else {
        // Print the error, cast err to awserr.Error to get the Code and
        // Message from an error.
        fmt.Println(err.Error())
    }
    return
}

fmt.Println(result)

func (*KMS) DisableKeyRequest

func (c *KMS) DisableKeyRequest(input *DisableKeyInput) (req *request.Request, output *DisableKeyOutput)

DisableKeyRequest generates a "aws/request.Request" representing the client's request for the DisableKey operation. The "output" return value will be populated with the request's response once the request completes successfully.

Use "Send" method on the returned Request to send the API call to the service. the "output" return value is not valid until after Send returns without error.

See DisableKey for more information on using the DisableKey API call, and error handling.

This method is useful when you want to inject custom logic or configuration into the SDK's request lifecycle. Such as custom headers, or retry logic.

// Example sending a request using the DisableKeyRequest method.
req, resp := client.DisableKeyRequest(params)

err := req.Send()
if err == nil { // resp is now filled
    fmt.Println(resp)
}

See also, https://docs.aws.amazon.com/goto/WebAPI/kms-2014-11-01/DisableKey

func (*KMS) DisableKeyRotation

func (c *KMS) DisableKeyRotation(input *DisableKeyRotationInput) (*DisableKeyRotationOutput, error)

DisableKeyRotation API operation for AWS Key Management Service.

Disables automatic rotation of the key material (https://docs.aws.amazon.com/kms/latest/developerguide/rotate-keys.html) of the specified symmetric encryption KMS key.

Automatic key rotation is supported only on symmetric encryption KMS keys. You cannot enable automatic rotation of asymmetric KMS keys (https://docs.aws.amazon.com/kms/latest/developerguide/symmetric-asymmetric.html), HMAC KMS keys (https://docs.aws.amazon.com/kms/latest/developerguide/hmac.html), KMS keys with imported key material (https://docs.aws.amazon.com/kms/latest/developerguide/importing-keys.html), or KMS keys in a custom key store (https://docs.aws.amazon.com/kms/latest/developerguide/custom-key-store-overview.html). To enable or disable automatic rotation of a set of related multi-Region keys (https://docs.aws.amazon.com/kms/latest/developerguide/multi-region-keys-manage.html#multi-region-rotate), set the property on the primary key.

You can enable (EnableKeyRotation) and disable automatic rotation of the key material in customer managed KMS keys (https://docs.aws.amazon.com/kms/latest/developerguide/concepts.html#customer-cmk). Key material rotation of Amazon Web Services managed KMS keys (https://docs.aws.amazon.com/kms/latest/developerguide/concepts.html#aws-managed-cmk) is not configurable. KMS always rotates the key material for every year. Rotation of Amazon Web Services owned KMS keys (https://docs.aws.amazon.com/kms/latest/developerguide/concepts.html#aws-owned-cmk) varies.

In May 2022, KMS changed the rotation schedule for Amazon Web Services managed keys from every three years to every year. For details, see EnableKeyRotation.

The KMS key that you use for this operation must be in a compatible key state. For details, see Key states of KMS keys (https://docs.aws.amazon.com/kms/latest/developerguide/key-state.html) in the Key Management Service Developer Guide.

Cross-account use: No. You cannot perform this operation on a KMS key in a different Amazon Web Services account.

Required permissions: kms:DisableKeyRotation (https://docs.aws.amazon.com/kms/latest/developerguide/kms-api-permissions-reference.html) (key policy)

Related operations:

  • EnableKeyRotation

  • GetKeyRotationStatus

  • ListKeyRotations

  • RotateKeyOnDemand

Eventual consistency: The KMS API follows an eventual consistency model. For more information, see KMS eventual consistency (https://docs.aws.amazon.com/kms/latest/developerguide/programming-eventual-consistency.html).

Returns awserr.Error for service API and SDK errors. Use runtime type assertions with awserr.Error's Code and Message methods to get detailed information about the error.

See the AWS API reference guide for AWS Key Management Service's API operation DisableKeyRotation for usage and error information.

Returned Error Types:

  • NotFoundException The request was rejected because the specified entity or resource could not be found.

  • DisabledException The request was rejected because the specified KMS key is not enabled.

  • InvalidArnException The request was rejected because a specified ARN, or an ARN in a key policy, is not valid.

  • DependencyTimeoutException The system timed out while trying to fulfill the request. You can retry the request.

  • InternalException The request was rejected because an internal exception occurred. The request can be retried.

  • InvalidStateException The request was rejected because the state of the specified resource is not valid for this request.

    This exceptions means one of the following:

  • The key state of the KMS key is not compatible with the operation. To find the key state, use the DescribeKey operation. For more information about which key states are compatible with each KMS operation, see Key states of KMS keys (https://docs.aws.amazon.com/kms/latest/developerguide/key-state.html) in the Key Management Service Developer Guide .

  • For cryptographic operations on KMS keys in custom key stores, this exception represents a general failure with many possible causes. To identify the cause, see the error message that accompanies the exception.

  • UnsupportedOperationException The request was rejected because a specified parameter is not supported or a specified resource is not valid for this operation.

See also, https://docs.aws.amazon.com/goto/WebAPI/kms-2014-11-01/DisableKeyRotation

Example (Shared00)

To disable automatic rotation of key material The following example disables automatic annual rotation of the key material for the specified KMS key.

Code:

svc := kms.New(session.New())
input := &kms.DisableKeyRotationInput{
    KeyId: aws.String("1234abcd-12ab-34cd-56ef-1234567890ab"),
}

result, err := svc.DisableKeyRotation(input)
if err != nil {
    if aerr, ok := err.(awserr.Error); ok {
        switch aerr.Code() {
        case kms.ErrCodeNotFoundException:
            fmt.Println(kms.ErrCodeNotFoundException, aerr.Error())
        case kms.ErrCodeDisabledException:
            fmt.Println(kms.ErrCodeDisabledException, aerr.Error())
        case kms.ErrCodeInvalidArnException:
            fmt.Println(kms.ErrCodeInvalidArnException, aerr.Error())
        case kms.ErrCodeDependencyTimeoutException:
            fmt.Println(kms.ErrCodeDependencyTimeoutException, aerr.Error())
        case kms.ErrCodeInternalException:
            fmt.Println(kms.ErrCodeInternalException, aerr.Error())
        case kms.ErrCodeInvalidStateException:
            fmt.Println(kms.ErrCodeInvalidStateException, aerr.Error())
        case kms.ErrCodeUnsupportedOperationException:
            fmt.Println(kms.ErrCodeUnsupportedOperationException, aerr.Error())
        default:
            fmt.Println(aerr.Error())
        }
    } else {
        // Print the error, cast err to awserr.Error to get the Code and
        // Message from an error.
        fmt.Println(err.Error())
    }
    return
}

fmt.Println(result)

func (*KMS) DisableKeyRotationRequest

func (c *KMS) DisableKeyRotationRequest(input *DisableKeyRotationInput) (req *request.Request, output *DisableKeyRotationOutput)

DisableKeyRotationRequest generates a "aws/request.Request" representing the client's request for the DisableKeyRotation operation. The "output" return value will be populated with the request's response once the request completes successfully.

Use "Send" method on the returned Request to send the API call to the service. the "output" return value is not valid until after Send returns without error.

See DisableKeyRotation for more information on using the DisableKeyRotation API call, and error handling.

This method is useful when you want to inject custom logic or configuration into the SDK's request lifecycle. Such as custom headers, or retry logic.

// Example sending a request using the DisableKeyRotationRequest method.
req, resp := client.DisableKeyRotationRequest(params)

err := req.Send()
if err == nil { // resp is now filled
    fmt.Println(resp)
}

See also, https://docs.aws.amazon.com/goto/WebAPI/kms-2014-11-01/DisableKeyRotation

func (*KMS) DisableKeyRotationWithContext

func (c *KMS) DisableKeyRotationWithContext(ctx aws.Context, input *DisableKeyRotationInput, opts ...request.Option) (*DisableKeyRotationOutput, error)

DisableKeyRotationWithContext is the same as DisableKeyRotation with the addition of the ability to pass a context and additional request options.

See DisableKeyRotation for details on how to use this API operation.

The context must be non-nil and will be used for request cancellation. If the context is nil a panic will occur. In the future the SDK may create sub-contexts for http.Requests. See https://golang.org/pkg/context/ for more information on using Contexts.

func (*KMS) DisableKeyWithContext

func (c *KMS) DisableKeyWithContext(ctx aws.Context, input *DisableKeyInput, opts ...request.Option) (*DisableKeyOutput, error)

DisableKeyWithContext is the same as DisableKey with the addition of the ability to pass a context and additional request options.

See DisableKey for details on how to use this API operation.

The context must be non-nil and will be used for request cancellation. If the context is nil a panic will occur. In the future the SDK may create sub-contexts for http.Requests. See https://golang.org/pkg/context/ for more information on using Contexts.

func (*KMS) DisconnectCustomKeyStore

func (c *KMS) DisconnectCustomKeyStore(input *DisconnectCustomKeyStoreInput) (*DisconnectCustomKeyStoreOutput, error)

DisconnectCustomKeyStore API operation for AWS Key Management Service.

Disconnects the custom key store (https://docs.aws.amazon.com/kms/latest/developerguide/custom-key-store-overview.html) from its backing key store. This operation disconnects an CloudHSM key store from its associated CloudHSM cluster or disconnects an external key store from the external key store proxy that communicates with your external key manager.

This operation is part of the custom key stores (https://docs.aws.amazon.com/kms/latest/developerguide/custom-key-store-overview.html) feature in KMS, which combines the convenience and extensive integration of KMS with the isolation and control of a key store that you own and manage.

While a custom key store is disconnected, you can manage the custom key store and its KMS keys, but you cannot create or use its KMS keys. You can reconnect the custom key store at any time.

While a custom key store is disconnected, all attempts to create KMS keys in the custom key store or to use existing KMS keys in cryptographic operations (https://docs.aws.amazon.com/kms/latest/developerguide/concepts.html#cryptographic-operations) will fail. This action can prevent users from storing and accessing sensitive data.

When you disconnect a custom key store, its ConnectionState changes to Disconnected. To find the connection state of a custom key store, use the DescribeCustomKeyStores operation. To reconnect a custom key store, use the ConnectCustomKeyStore operation.

If the operation succeeds, it returns a JSON object with no properties.

Cross-account use: No. You cannot perform this operation on a custom key store in a different Amazon Web Services account.

Required permissions: kms:DisconnectCustomKeyStore (https://docs.aws.amazon.com/kms/latest/developerguide/kms-api-permissions-reference.html) (IAM policy)

Related operations:

  • ConnectCustomKeyStore

  • CreateCustomKeyStore

  • DeleteCustomKeyStore

  • DescribeCustomKeyStores

  • UpdateCustomKeyStore

Eventual consistency: The KMS API follows an eventual consistency model. For more information, see KMS eventual consistency (https://docs.aws.amazon.com/kms/latest/developerguide/programming-eventual-consistency.html).

Returns awserr.Error for service API and SDK errors. Use runtime type assertions with awserr.Error's Code and Message methods to get detailed information about the error.

See the AWS API reference guide for AWS Key Management Service's API operation DisconnectCustomKeyStore for usage and error information.

Returned Error Types:

  • CustomKeyStoreInvalidStateException The request was rejected because of the ConnectionState of the custom key store. To get the ConnectionState of a custom key store, use the DescribeCustomKeyStores operation.

    This exception is thrown under the following conditions:

  • You requested the ConnectCustomKeyStore operation on a custom key store with a ConnectionState of DISCONNECTING or FAILED. This operation is valid for all other ConnectionState values. To reconnect a custom key store in a FAILED state, disconnect it (DisconnectCustomKeyStore), then connect it (ConnectCustomKeyStore).

  • You requested the CreateKey operation in a custom key store that is not connected. This operations is valid only when the custom key store ConnectionState is CONNECTED.

  • You requested the DisconnectCustomKeyStore operation on a custom key store with a ConnectionState of DISCONNECTING or DISCONNECTED. This operation is valid for all other ConnectionState values.

  • You requested the UpdateCustomKeyStore or DeleteCustomKeyStore operation on a custom key store that is not disconnected. This operation is valid only when the custom key store ConnectionState is DISCONNECTED.

  • You requested the GenerateRandom operation in an CloudHSM key store that is not connected. This operation is valid only when the CloudHSM key store ConnectionState is CONNECTED.

  • CustomKeyStoreNotFoundException The request was rejected because KMS cannot find a custom key store with the specified key store name or ID.

  • InternalException The request was rejected because an internal exception occurred. The request can be retried.

See also, https://docs.aws.amazon.com/goto/WebAPI/kms-2014-11-01/DisconnectCustomKeyStore

Example (Shared00)

To disconnect a custom key store from its CloudHSM cluster This example disconnects an AWS KMS custom key store from its backing key store. For an AWS CloudHSM key store, it disconnects the key store from its AWS CloudHSM cluster. For an external key store, it disconnects the key store from the external key store proxy that communicates with your external key manager. This operation doesn't return any data. To verify that the custom key store is disconnected, use the <code>DescribeCustomKeyStores</code> operation.

Code:

svc := kms.New(session.New())
input := &kms.DisconnectCustomKeyStoreInput{
    CustomKeyStoreId: aws.String("cks-1234567890abcdef0"),
}

result, err := svc.DisconnectCustomKeyStore(input)
if err != nil {
    if aerr, ok := err.(awserr.Error); ok {
        switch aerr.Code() {
        case kms.ErrCodeCustomKeyStoreInvalidStateException:
            fmt.Println(kms.ErrCodeCustomKeyStoreInvalidStateException, aerr.Error())
        case kms.ErrCodeCustomKeyStoreNotFoundException:
            fmt.Println(kms.ErrCodeCustomKeyStoreNotFoundException, aerr.Error())
        case kms.ErrCodeInternalException:
            fmt.Println(kms.ErrCodeInternalException, aerr.Error())
        default:
            fmt.Println(aerr.Error())
        }
    } else {
        // Print the error, cast err to awserr.Error to get the Code and
        // Message from an error.
        fmt.Println(err.Error())
    }
    return
}

fmt.Println(result)

func (*KMS) DisconnectCustomKeyStoreRequest

func (c *KMS) DisconnectCustomKeyStoreRequest(input *DisconnectCustomKeyStoreInput) (req *request.Request, output *DisconnectCustomKeyStoreOutput)

DisconnectCustomKeyStoreRequest generates a "aws/request.Request" representing the client's request for the DisconnectCustomKeyStore operation. The "output" return value will be populated with the request's response once the request completes successfully.

Use "Send" method on the returned Request to send the API call to the service. the "output" return value is not valid until after Send returns without error.

See DisconnectCustomKeyStore for more information on using the DisconnectCustomKeyStore API call, and error handling.

This method is useful when you want to inject custom logic or configuration into the SDK's request lifecycle. Such as custom headers, or retry logic.

// Example sending a request using the DisconnectCustomKeyStoreRequest method.
req, resp := client.DisconnectCustomKeyStoreRequest(params)

err := req.Send()
if err == nil { // resp is now filled
    fmt.Println(resp)
}

See also, https://docs.aws.amazon.com/goto/WebAPI/kms-2014-11-01/DisconnectCustomKeyStore

func (*KMS) DisconnectCustomKeyStoreWithContext

func (c *KMS) DisconnectCustomKeyStoreWithContext(ctx aws.Context, input *DisconnectCustomKeyStoreInput, opts ...request.Option) (*DisconnectCustomKeyStoreOutput, error)

DisconnectCustomKeyStoreWithContext is the same as DisconnectCustomKeyStore with the addition of the ability to pass a context and additional request options.

See DisconnectCustomKeyStore for details on how to use this API operation.

The context must be non-nil and will be used for request cancellation. If the context is nil a panic will occur. In the future the SDK may create sub-contexts for http.Requests. See https://golang.org/pkg/context/ for more information on using Contexts.

func (*KMS) EnableKey

func (c *KMS) EnableKey(input *EnableKeyInput) (*EnableKeyOutput, error)

EnableKey API operation for AWS Key Management Service.

Sets the key state of a KMS key to enabled. This allows you to use the KMS key for cryptographic operations (https://docs.aws.amazon.com/kms/latest/developerguide/concepts.html#cryptographic-operations).

The KMS key that you use for this operation must be in a compatible key state. For details, see Key states of KMS keys (https://docs.aws.amazon.com/kms/latest/developerguide/key-state.html) in the Key Management Service Developer Guide.

Cross-account use: No. You cannot perform this operation on a KMS key in a different Amazon Web Services account.

Required permissions: kms:EnableKey (https://docs.aws.amazon.com/kms/latest/developerguide/kms-api-permissions-reference.html) (key policy)

Related operations: DisableKey

Eventual consistency: The KMS API follows an eventual consistency model. For more information, see KMS eventual consistency (https://docs.aws.amazon.com/kms/latest/developerguide/programming-eventual-consistency.html).

Returns awserr.Error for service API and SDK errors. Use runtime type assertions with awserr.Error's Code and Message methods to get detailed information about the error.

See the AWS API reference guide for AWS Key Management Service's API operation EnableKey for usage and error information.

Returned Error Types:

  • NotFoundException The request was rejected because the specified entity or resource could not be found.

  • InvalidArnException The request was rejected because a specified ARN, or an ARN in a key policy, is not valid.

  • DependencyTimeoutException The system timed out while trying to fulfill the request. You can retry the request.

  • InternalException The request was rejected because an internal exception occurred. The request can be retried.

  • LimitExceededException The request was rejected because a quota was exceeded. For more information, see Quotas (https://docs.aws.amazon.com/kms/latest/developerguide/limits.html) in the Key Management Service Developer Guide.

  • InvalidStateException The request was rejected because the state of the specified resource is not valid for this request.

    This exceptions means one of the following:

  • The key state of the KMS key is not compatible with the operation. To find the key state, use the DescribeKey operation. For more information about which key states are compatible with each KMS operation, see Key states of KMS keys (https://docs.aws.amazon.com/kms/latest/developerguide/key-state.html) in the Key Management Service Developer Guide .

  • For cryptographic operations on KMS keys in custom key stores, this exception represents a general failure with many possible causes. To identify the cause, see the error message that accompanies the exception.

See also, https://docs.aws.amazon.com/goto/WebAPI/kms-2014-11-01/EnableKey

Example (Shared00)

To enable a KMS key The following example enables the specified KMS key.

Code:

svc := kms.New(session.New())
input := &kms.EnableKeyInput{
    KeyId: aws.String("1234abcd-12ab-34cd-56ef-1234567890ab"),
}

result, err := svc.EnableKey(input)
if err != nil {
    if aerr, ok := err.(awserr.Error); ok {
        switch aerr.Code() {
        case kms.ErrCodeNotFoundException:
            fmt.Println(kms.ErrCodeNotFoundException, aerr.Error())
        case kms.ErrCodeInvalidArnException:
            fmt.Println(kms.ErrCodeInvalidArnException, aerr.Error())
        case kms.ErrCodeDependencyTimeoutException:
            fmt.Println(kms.ErrCodeDependencyTimeoutException, aerr.Error())
        case kms.ErrCodeInternalException:
            fmt.Println(kms.ErrCodeInternalException, aerr.Error())
        case kms.ErrCodeLimitExceededException:
            fmt.Println(kms.ErrCodeLimitExceededException, aerr.Error())
        case kms.ErrCodeInvalidStateException:
            fmt.Println(kms.ErrCodeInvalidStateException, aerr.Error())
        default:
            fmt.Println(aerr.Error())
        }
    } else {
        // Print the error, cast err to awserr.Error to get the Code and
        // Message from an error.
        fmt.Println(err.Error())
    }
    return
}

fmt.Println(result)

func (*KMS) EnableKeyRequest

func (c *KMS) EnableKeyRequest(input *EnableKeyInput) (req *request.Request, output *EnableKeyOutput)

EnableKeyRequest generates a "aws/request.Request" representing the client's request for the EnableKey operation. The "output" return value will be populated with the request's response once the request completes successfully.

Use "Send" method on the returned Request to send the API call to the service. the "output" return value is not valid until after Send returns without error.

See EnableKey for more information on using the EnableKey API call, and error handling.

This method is useful when you want to inject custom logic or configuration into the SDK's request lifecycle. Such as custom headers, or retry logic.

// Example sending a request using the EnableKeyRequest method.
req, resp := client.EnableKeyRequest(params)

err := req.Send()
if err == nil { // resp is now filled
    fmt.Println(resp)
}

See also, https://docs.aws.amazon.com/goto/WebAPI/kms-2014-11-01/EnableKey

func (*KMS) EnableKeyRotation

func (c *KMS) EnableKeyRotation(input *EnableKeyRotationInput) (*EnableKeyRotationOutput, error)

EnableKeyRotation API operation for AWS Key Management Service.

Enables automatic rotation of the key material (https://docs.aws.amazon.com/kms/latest/developerguide/rotate-keys.html#rotating-keys-enable-disable) of the specified symmetric encryption KMS key.

By default, when you enable automatic rotation of a customer managed KMS key (https://docs.aws.amazon.com/kms/latest/developerguide/concepts.html#customer-cmk), KMS rotates the key material of the KMS key one year (approximately 365 days) from the enable date and every year thereafter. You can use the optional RotationPeriodInDays parameter to specify a custom rotation period when you enable key rotation, or you can use RotationPeriodInDays to modify the rotation period of a key that you previously enabled automatic key rotation on.

You can monitor rotation of the key material for your KMS keys in CloudTrail and Amazon CloudWatch. To disable rotation of the key material in a customer managed KMS key, use the DisableKeyRotation operation. You can use the GetKeyRotationStatus operation to identify any in progress rotations. You can use the ListKeyRotations operation to view the details of completed rotations.

Automatic key rotation is supported only on symmetric encryption KMS keys (https://docs.aws.amazon.com/kms/latest/developerguide/concepts.html#symmetric-cmks). You cannot enable automatic rotation of asymmetric KMS keys (https://docs.aws.amazon.com/kms/latest/developerguide/symmetric-asymmetric.html), HMAC KMS keys (https://docs.aws.amazon.com/kms/latest/developerguide/hmac.html), KMS keys with imported key material (https://docs.aws.amazon.com/kms/latest/developerguide/importing-keys.html), or KMS keys in a custom key store (https://docs.aws.amazon.com/kms/latest/developerguide/custom-key-store-overview.html). To enable or disable automatic rotation of a set of related multi-Region keys (https://docs.aws.amazon.com/kms/latest/developerguide/multi-region-keys-manage.html#multi-region-rotate), set the property on the primary key.

You cannot enable or disable automatic rotation of Amazon Web Services managed KMS keys (https://docs.aws.amazon.com/kms/latest/developerguide/concepts.html#aws-managed-cmk). KMS always rotates the key material of Amazon Web Services managed keys every year. Rotation of Amazon Web Services owned KMS keys (https://docs.aws.amazon.com/kms/latest/developerguide/concepts.html#aws-owned-cmk) is managed by the Amazon Web Services service that owns the key.

In May 2022, KMS changed the rotation schedule for Amazon Web Services managed keys from every three years (approximately 1,095 days) to every year (approximately 365 days).

New Amazon Web Services managed keys are automatically rotated one year after they are created, and approximately every year thereafter.

Existing Amazon Web Services managed keys are automatically rotated one year after their most recent rotation, and every year thereafter.

The KMS key that you use for this operation must be in a compatible key state. For details, see Key states of KMS keys (https://docs.aws.amazon.com/kms/latest/developerguide/key-state.html) in the Key Management Service Developer Guide.

Cross-account use: No. You cannot perform this operation on a KMS key in a different Amazon Web Services account.

Required permissions: kms:EnableKeyRotation (https://docs.aws.amazon.com/kms/latest/developerguide/kms-api-permissions-reference.html) (key policy)

Related operations:

  • DisableKeyRotation

  • GetKeyRotationStatus

  • ListKeyRotations

  • RotateKeyOnDemand You can perform on-demand (RotateKeyOnDemand) rotation of the key material in customer managed KMS keys, regardless of whether or not automatic key rotation is enabled.

Eventual consistency: The KMS API follows an eventual consistency model. For more information, see KMS eventual consistency (https://docs.aws.amazon.com/kms/latest/developerguide/programming-eventual-consistency.html).

Returns awserr.Error for service API and SDK errors. Use runtime type assertions with awserr.Error's Code and Message methods to get detailed information about the error.

See the AWS API reference guide for AWS Key Management Service's API operation EnableKeyRotation for usage and error information.

Returned Error Types:

  • NotFoundException The request was rejected because the specified entity or resource could not be found.

  • DisabledException The request was rejected because the specified KMS key is not enabled.

  • InvalidArnException The request was rejected because a specified ARN, or an ARN in a key policy, is not valid.

  • DependencyTimeoutException The system timed out while trying to fulfill the request. You can retry the request.

  • InternalException The request was rejected because an internal exception occurred. The request can be retried.

  • InvalidStateException The request was rejected because the state of the specified resource is not valid for this request.

    This exceptions means one of the following:

  • The key state of the KMS key is not compatible with the operation. To find the key state, use the DescribeKey operation. For more information about which key states are compatible with each KMS operation, see Key states of KMS keys (https://docs.aws.amazon.com/kms/latest/developerguide/key-state.html) in the Key Management Service Developer Guide .

  • For cryptographic operations on KMS keys in custom key stores, this exception represents a general failure with many possible causes. To identify the cause, see the error message that accompanies the exception.

  • UnsupportedOperationException The request was rejected because a specified parameter is not supported or a specified resource is not valid for this operation.

See also, https://docs.aws.amazon.com/goto/WebAPI/kms-2014-11-01/EnableKeyRotation

Example (Shared00)

To enable automatic rotation of key material The following example enables automatic rotation with a rotation period of 365 days for the specified KMS key.

Code:

svc := kms.New(session.New())
input := &kms.EnableKeyRotationInput{
    KeyId:                aws.String("1234abcd-12ab-34cd-56ef-1234567890ab"),
    RotationPeriodInDays: aws.Int64(365),
}

result, err := svc.EnableKeyRotation(input)
if err != nil {
    if aerr, ok := err.(awserr.Error); ok {
        switch aerr.Code() {
        case kms.ErrCodeNotFoundException:
            fmt.Println(kms.ErrCodeNotFoundException, aerr.Error())
        case kms.ErrCodeDisabledException:
            fmt.Println(kms.ErrCodeDisabledException, aerr.Error())
        case kms.ErrCodeInvalidArnException:
            fmt.Println(kms.ErrCodeInvalidArnException, aerr.Error())
        case kms.ErrCodeDependencyTimeoutException:
            fmt.Println(kms.ErrCodeDependencyTimeoutException, aerr.Error())
        case kms.ErrCodeInternalException:
            fmt.Println(kms.ErrCodeInternalException, aerr.Error())
        case kms.ErrCodeInvalidStateException:
            fmt.Println(kms.ErrCodeInvalidStateException, aerr.Error())
        case kms.ErrCodeUnsupportedOperationException:
            fmt.Println(kms.ErrCodeUnsupportedOperationException, aerr.Error())
        default:
            fmt.Println(aerr.Error())
        }
    } else {
        // Print the error, cast err to awserr.Error to get the Code and
        // Message from an error.
        fmt.Println(err.Error())
    }
    return
}

fmt.Println(result)

func (*KMS) EnableKeyRotationRequest

func (c *KMS) EnableKeyRotationRequest(input *EnableKeyRotationInput) (req *request.Request, output *EnableKeyRotationOutput)

EnableKeyRotationRequest generates a "aws/request.Request" representing the client's request for the EnableKeyRotation operation. The "output" return value will be populated with the request's response once the request completes successfully.

Use "Send" method on the returned Request to send the API call to the service. the "output" return value is not valid until after Send returns without error.

See EnableKeyRotation for more information on using the EnableKeyRotation API call, and error handling.

This method is useful when you want to inject custom logic or configuration into the SDK's request lifecycle. Such as custom headers, or retry logic.

// Example sending a request using the EnableKeyRotationRequest method.
req, resp := client.EnableKeyRotationRequest(params)

err := req.Send()
if err == nil { // resp is now filled
    fmt.Println(resp)
}

See also, https://docs.aws.amazon.com/goto/WebAPI/kms-2014-11-01/EnableKeyRotation

func (*KMS) EnableKeyRotationWithContext

func (c *KMS) EnableKeyRotationWithContext(ctx aws.Context, input *EnableKeyRotationInput, opts ...request.Option) (*EnableKeyRotationOutput, error)

EnableKeyRotationWithContext is the same as EnableKeyRotation with the addition of the ability to pass a context and additional request options.

See EnableKeyRotation for details on how to use this API operation.

The context must be non-nil and will be used for request cancellation. If the context is nil a panic will occur. In the future the SDK may create sub-contexts for http.Requests. See https://golang.org/pkg/context/ for more information on using Contexts.

func (*KMS) EnableKeyWithContext

func (c *KMS) EnableKeyWithContext(ctx aws.Context, input *EnableKeyInput, opts ...request.Option) (*EnableKeyOutput, error)

EnableKeyWithContext is the same as EnableKey with the addition of the ability to pass a context and additional request options.

See EnableKey for details on how to use this API operation.

The context must be non-nil and will be used for request cancellation. If the context is nil a panic will occur. In the future the SDK may create sub-contexts for http.Requests. See https://golang.org/pkg/context/ for more information on using Contexts.

func (*KMS) Encrypt

func (c *KMS) Encrypt(input *EncryptInput) (*EncryptOutput, error)

Encrypt API operation for AWS Key Management Service.

Encrypts plaintext of up to 4,096 bytes using a KMS key. You can use a symmetric or asymmetric KMS key with a KeyUsage of ENCRYPT_DECRYPT.

You can use this operation to encrypt small amounts of arbitrary data, such as a personal identifier or database password, or other sensitive information. You don't need to use the Encrypt operation to encrypt a data key. The GenerateDataKey and GenerateDataKeyPair operations return a plaintext data key and an encrypted copy of that data key.

If you use a symmetric encryption KMS key, you can use an encryption context to add additional security to your encryption operation. If you specify an EncryptionContext when encrypting data, you must specify the same encryption context (a case-sensitive exact match) when decrypting the data. Otherwise, the request to decrypt fails with an InvalidCiphertextException. For more information, see Encryption Context (https://docs.aws.amazon.com/kms/latest/developerguide/concepts.html#encrypt_context) in the Key Management Service Developer Guide.

If you specify an asymmetric KMS key, you must also specify the encryption algorithm. The algorithm must be compatible with the KMS key spec.

When you use an asymmetric KMS key to encrypt or reencrypt data, be sure to record the KMS key and encryption algorithm that you choose. You will be required to provide the same KMS key and encryption algorithm when you decrypt the data. If the KMS key and algorithm do not match the values used to encrypt the data, the decrypt operation fails.

You are not required to supply the key ID and encryption algorithm when you decrypt with symmetric encryption KMS keys because KMS stores this information in the ciphertext blob. KMS cannot store metadata in ciphertext generated with asymmetric keys. The standard format for asymmetric key ciphertext does not include configurable fields.

The maximum size of the data that you can encrypt varies with the type of KMS key and the encryption algorithm that you choose.

  • Symmetric encryption KMS keys SYMMETRIC_DEFAULT: 4096 bytes

  • RSA_2048 RSAES_OAEP_SHA_1: 214 bytes RSAES_OAEP_SHA_256: 190 bytes

  • RSA_3072 RSAES_OAEP_SHA_1: 342 bytes RSAES_OAEP_SHA_256: 318 bytes

  • RSA_4096 RSAES_OAEP_SHA_1: 470 bytes RSAES_OAEP_SHA_256: 446 bytes

  • SM2PKE: 1024 bytes (China Regions only)

The KMS key that you use for this operation must be in a compatible key state. For details, see Key states of KMS keys (https://docs.aws.amazon.com/kms/latest/developerguide/key-state.html) in the Key Management Service Developer Guide.

Cross-account use: Yes. To perform this operation with a KMS key in a different Amazon Web Services account, specify the key ARN or alias ARN in the value of the KeyId parameter.

Required permissions: kms:Encrypt (https://docs.aws.amazon.com/kms/latest/developerguide/kms-api-permissions-reference.html) (key policy)

Related operations:

  • Decrypt

  • GenerateDataKey

  • GenerateDataKeyPair

Eventual consistency: The KMS API follows an eventual consistency model. For more information, see KMS eventual consistency (https://docs.aws.amazon.com/kms/latest/developerguide/programming-eventual-consistency.html).

Returns awserr.Error for service API and SDK errors. Use runtime type assertions with awserr.Error's Code and Message methods to get detailed information about the error.

See the AWS API reference guide for AWS Key Management Service's API operation Encrypt for usage and error information.

Returned Error Types:

  • NotFoundException The request was rejected because the specified entity or resource could not be found.

  • DisabledException The request was rejected because the specified KMS key is not enabled.

  • KeyUnavailableException The request was rejected because the specified KMS key was not available. You can retry the request.

  • DependencyTimeoutException The system timed out while trying to fulfill the request. You can retry the request.

  • InvalidKeyUsageException The request was rejected for one of the following reasons:

  • The KeyUsage value of the KMS key is incompatible with the API operation.

  • The encryption algorithm or signing algorithm specified for the operation is incompatible with the type of key material in the KMS key (KeySpec).

    For encrypting, decrypting, re-encrypting, and generating data keys, the KeyUsage must be ENCRYPT_DECRYPT. For signing and verifying messages, the KeyUsage must be SIGN_VERIFY. For generating and verifying message authentication codes (MACs), the KeyUsage must be GENERATE_VERIFY_MAC. For deriving key agreement secrets, the KeyUsage must be KEY_AGREEMENT. To find the KeyUsage of a KMS key, use the DescribeKey operation.

    To find the encryption or signing algorithms supported for a particular KMS key, use the DescribeKey operation.

  • InvalidGrantTokenException The request was rejected because the specified grant token is not valid.

  • InternalException The request was rejected because an internal exception occurred. The request can be retried.

  • InvalidStateException The request was rejected because the state of the specified resource is not valid for this request.

    This exceptions means one of the following:

  • The key state of the KMS key is not compatible with the operation. To find the key state, use the DescribeKey operation. For more information about which key states are compatible with each KMS operation, see Key states of KMS keys (https://docs.aws.amazon.com/kms/latest/developerguide/key-state.html) in the Key Management Service Developer Guide .

  • For cryptographic operations on KMS keys in custom key stores, this exception represents a general failure with many possible causes. To identify the cause, see the error message that accompanies the exception.

  • DryRunOperationException The request was rejected because the DryRun parameter was specified.

See also, https://docs.aws.amazon.com/goto/WebAPI/kms-2014-11-01/Encrypt

Example (Shared00)

To encrypt data with a symmetric encryption KMS key The following example encrypts data with the specified symmetric encryption KMS key.

Code:

svc := kms.New(session.New())
input := &kms.EncryptInput{
    KeyId:     aws.String("1234abcd-12ab-34cd-56ef-1234567890ab"),
    Plaintext: []byte("<binary data>"),
}

result, err := svc.Encrypt(input)
if err != nil {
    if aerr, ok := err.(awserr.Error); ok {
        switch aerr.Code() {
        case kms.ErrCodeNotFoundException:
            fmt.Println(kms.ErrCodeNotFoundException, aerr.Error())
        case kms.ErrCodeDisabledException:
            fmt.Println(kms.ErrCodeDisabledException, aerr.Error())
        case kms.ErrCodeKeyUnavailableException:
            fmt.Println(kms.ErrCodeKeyUnavailableException, aerr.Error())
        case kms.ErrCodeDependencyTimeoutException:
            fmt.Println(kms.ErrCodeDependencyTimeoutException, aerr.Error())
        case kms.ErrCodeInvalidKeyUsageException:
            fmt.Println(kms.ErrCodeInvalidKeyUsageException, aerr.Error())
        case kms.ErrCodeInvalidGrantTokenException:
            fmt.Println(kms.ErrCodeInvalidGrantTokenException, aerr.Error())
        case kms.ErrCodeInternalException:
            fmt.Println(kms.ErrCodeInternalException, aerr.Error())
        case kms.ErrCodeInvalidStateException:
            fmt.Println(kms.ErrCodeInvalidStateException, aerr.Error())
        case kms.ErrCodeDryRunOperationException:
            fmt.Println(kms.ErrCodeDryRunOperationException, aerr.Error())
        default:
            fmt.Println(aerr.Error())
        }
    } else {
        // Print the error, cast err to awserr.Error to get the Code and
        // Message from an error.
        fmt.Println(err.Error())
    }
    return
}

fmt.Println(result)

Example (Shared01)

To encrypt data with an asymmetric encryption KMS key The following example encrypts data with the specified RSA asymmetric KMS key. When you encrypt with an asymmetric key, you must specify the encryption algorithm.

Code:

svc := kms.New(session.New())
input := &kms.EncryptInput{
    EncryptionAlgorithm: aws.String("RSAES_OAEP_SHA_256"),
    KeyId:               aws.String("0987dcba-09fe-87dc-65ba-ab0987654321"),
    Plaintext:           []byte("<binary data>"),
}

result, err := svc.Encrypt(input)
if err != nil {
    if aerr, ok := err.(awserr.Error); ok {
        switch aerr.Code() {
        case kms.ErrCodeNotFoundException:
            fmt.Println(kms.ErrCodeNotFoundException, aerr.Error())
        case kms.ErrCodeDisabledException:
            fmt.Println(kms.ErrCodeDisabledException, aerr.Error())
        case kms.ErrCodeKeyUnavailableException:
            fmt.Println(kms.ErrCodeKeyUnavailableException, aerr.Error())
        case kms.ErrCodeDependencyTimeoutException:
            fmt.Println(kms.ErrCodeDependencyTimeoutException, aerr.Error())
        case kms.ErrCodeInvalidKeyUsageException:
            fmt.Println(kms.ErrCodeInvalidKeyUsageException, aerr.Error())
        case kms.ErrCodeInvalidGrantTokenException:
            fmt.Println(kms.ErrCodeInvalidGrantTokenException, aerr.Error())
        case kms.ErrCodeInternalException:
            fmt.Println(kms.ErrCodeInternalException, aerr.Error())
        case kms.ErrCodeInvalidStateException:
            fmt.Println(kms.ErrCodeInvalidStateException, aerr.Error())
        case kms.ErrCodeDryRunOperationException:
            fmt.Println(kms.ErrCodeDryRunOperationException, aerr.Error())
        default:
            fmt.Println(aerr.Error())
        }
    } else {
        // Print the error, cast err to awserr.Error to get the Code and
        // Message from an error.
        fmt.Println(err.Error())
    }
    return
}

fmt.Println(result)

func (*KMS) EncryptRequest

func (c *KMS) EncryptRequest(input *EncryptInput) (req *request.Request, output *EncryptOutput)

EncryptRequest generates a "aws/request.Request" representing the client's request for the Encrypt operation. The "output" return value will be populated with the request's response once the request completes successfully.

Use "Send" method on the returned Request to send the API call to the service. the "output" return value is not valid until after Send returns without error.

See Encrypt for more information on using the Encrypt API call, and error handling.

This method is useful when you want to inject custom logic or configuration into the SDK's request lifecycle. Such as custom headers, or retry logic.

// Example sending a request using the EncryptRequest method.
req, resp := client.EncryptRequest(params)

err := req.Send()
if err == nil { // resp is now filled
    fmt.Println(resp)
}

See also, https://docs.aws.amazon.com/goto/WebAPI/kms-2014-11-01/Encrypt

func (*KMS) EncryptWithContext

func (c *KMS) EncryptWithContext(ctx aws.Context, input *EncryptInput, opts ...request.Option) (*EncryptOutput, error)

EncryptWithContext is the same as Encrypt with the addition of the ability to pass a context and additional request options.

See Encrypt for details on how to use this API operation.

The context must be non-nil and will be used for request cancellation. If the context is nil a panic will occur. In the future the SDK may create sub-contexts for http.Requests. See https://golang.org/pkg/context/ for more information on using Contexts.

func (*KMS) GenerateDataKey

func (c *KMS) GenerateDataKey(input *GenerateDataKeyInput) (*GenerateDataKeyOutput, error)

GenerateDataKey API operation for AWS Key Management Service.

Returns a unique symmetric data key for use outside of KMS. This operation returns a plaintext copy of the data key and a copy that is encrypted under a symmetric encryption KMS key that you specify. The bytes in the plaintext key are random; they are not related to the caller or the KMS key. You can use the plaintext key to encrypt your data outside of KMS and store the encrypted data key with the encrypted data.

To generate a data key, specify the symmetric encryption KMS key that will be used to encrypt the data key. You cannot use an asymmetric KMS key to encrypt data keys. To get the type of your KMS key, use the DescribeKey operation.

You must also specify the length of the data key. Use either the KeySpec or NumberOfBytes parameters (but not both). For 128-bit and 256-bit data keys, use the KeySpec parameter.

To generate a 128-bit SM4 data key (China Regions only), specify a KeySpec value of AES_128 or a NumberOfBytes value of 16. The symmetric encryption key used in China Regions to encrypt your data key is an SM4 encryption key.

To get only an encrypted copy of the data key, use GenerateDataKeyWithoutPlaintext. To generate an asymmetric data key pair, use the GenerateDataKeyPair or GenerateDataKeyPairWithoutPlaintext operation. To get a cryptographically secure random byte string, use GenerateRandom.

You can use an optional encryption context to add additional security to the encryption operation. If you specify an EncryptionContext, you must specify the same encryption context (a case-sensitive exact match) when decrypting the encrypted data key. Otherwise, the request to decrypt fails with an InvalidCiphertextException. For more information, see Encryption Context (https://docs.aws.amazon.com/kms/latest/developerguide/concepts.html#encrypt_context) in the Key Management Service Developer Guide.

GenerateDataKey also supports Amazon Web Services Nitro Enclaves (https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/nitro-enclave.html), which provide an isolated compute environment in Amazon EC2. To call GenerateDataKey for an Amazon Web Services Nitro enclave, use the Amazon Web Services Nitro Enclaves SDK (https://docs.aws.amazon.com/enclaves/latest/user/developing-applications.html#sdk) or any Amazon Web Services SDK. Use the Recipient parameter to provide the attestation document for the enclave. GenerateDataKey returns a copy of the data key encrypted under the specified KMS key, as usual. But instead of a plaintext copy of the data key, the response includes a copy of the data key encrypted under the public key from the attestation document (CiphertextForRecipient). For information about the interaction between KMS and Amazon Web Services Nitro Enclaves, see How Amazon Web Services Nitro Enclaves uses KMS (https://docs.aws.amazon.com/kms/latest/developerguide/services-nitro-enclaves.html) in the Key Management Service Developer Guide..

The KMS key that you use for this operation must be in a compatible key state. For details, see Key states of KMS keys (https://docs.aws.amazon.com/kms/latest/developerguide/key-state.html) in the Key Management Service Developer Guide.

How to use your data key

We recommend that you use the following pattern to encrypt data locally in your application. You can write your own code or use a client-side encryption library, such as the Amazon Web Services Encryption SDK (https://docs.aws.amazon.com/encryption-sdk/latest/developer-guide/), the Amazon DynamoDB Encryption Client (https://docs.aws.amazon.com/dynamodb-encryption-client/latest/devguide/), or Amazon S3 client-side encryption (https://docs.aws.amazon.com/AmazonS3/latest/dev/UsingClientSideEncryption.html) to do these tasks for you.

To encrypt data outside of KMS:

Use the GenerateDataKey operation to get a data key.

Use the plaintext data key (in the Plaintext field of the response) to encrypt your data outside of KMS. Then erase the plaintext data key from memory.

Store the encrypted data key (in the CiphertextBlob field of the response) with the encrypted data.

To decrypt data outside of KMS:

Use the Decrypt operation to decrypt the encrypted data key. The operation returns a plaintext copy of the data key.

Use the plaintext data key to decrypt data outside of KMS, then erase the plaintext data key from memory.

Cross-account use: Yes. To perform this operation with a KMS key in a different Amazon Web Services account, specify the key ARN or alias ARN in the value of the KeyId parameter.

Required permissions: kms:GenerateDataKey (https://docs.aws.amazon.com/kms/latest/developerguide/kms-api-permissions-reference.html) (key policy)

Related operations:

  • Decrypt

  • Encrypt

  • GenerateDataKeyPair

  • GenerateDataKeyPairWithoutPlaintext

  • GenerateDataKeyWithoutPlaintext

Eventual consistency: The KMS API follows an eventual consistency model. For more information, see KMS eventual consistency (https://docs.aws.amazon.com/kms/latest/developerguide/programming-eventual-consistency.html).

Returns awserr.Error for service API and SDK errors. Use runtime type assertions with awserr.Error's Code and Message methods to get detailed information about the error.

See the AWS API reference guide for AWS Key Management Service's API operation GenerateDataKey for usage and error information.

Returned Error Types:

  • NotFoundException The request was rejected because the specified entity or resource could not be found.

  • DisabledException The request was rejected because the specified KMS key is not enabled.

  • KeyUnavailableException The request was rejected because the specified KMS key was not available. You can retry the request.

  • DependencyTimeoutException The system timed out while trying to fulfill the request. You can retry the request.

  • InvalidKeyUsageException The request was rejected for one of the following reasons:

  • The KeyUsage value of the KMS key is incompatible with the API operation.

  • The encryption algorithm or signing algorithm specified for the operation is incompatible with the type of key material in the KMS key (KeySpec).

    For encrypting, decrypting, re-encrypting, and generating data keys, the KeyUsage must be ENCRYPT_DECRYPT. For signing and verifying messages, the KeyUsage must be SIGN_VERIFY. For generating and verifying message authentication codes (MACs), the KeyUsage must be GENERATE_VERIFY_MAC. For deriving key agreement secrets, the KeyUsage must be KEY_AGREEMENT. To find the KeyUsage of a KMS key, use the DescribeKey operation.

    To find the encryption or signing algorithms supported for a particular KMS key, use the DescribeKey operation.

  • InvalidGrantTokenException The request was rejected because the specified grant token is not valid.

  • InternalException The request was rejected because an internal exception occurred. The request can be retried.

  • InvalidStateException The request was rejected because the state of the specified resource is not valid for this request.

    This exceptions means one of the following:

  • The key state of the KMS key is not compatible with the operation. To find the key state, use the DescribeKey operation. For more information about which key states are compatible with each KMS operation, see Key states of KMS keys (https://docs.aws.amazon.com/kms/latest/developerguide/key-state.html) in the Key Management Service Developer Guide .

  • For cryptographic operations on KMS keys in custom key stores, this exception represents a general failure with many possible causes. To identify the cause, see the error message that accompanies the exception.

  • DryRunOperationException The request was rejected because the DryRun parameter was specified.

See also, https://docs.aws.amazon.com/goto/WebAPI/kms-2014-11-01/GenerateDataKey

Example (Shared00)

To generate a data key The following example generates a 256-bit symmetric data encryption key (data key) in two formats. One is the unencrypted (plainext) data key, and the other is the data key encrypted with the specified KMS key.

Code:

svc := kms.New(session.New())
input := &kms.GenerateDataKeyInput{
    KeyId:   aws.String("alias/ExampleAlias"),
    KeySpec: aws.String("AES_256"),
}

result, err := svc.GenerateDataKey(input)
if err != nil {
    if aerr, ok := err.(awserr.Error); ok {
        switch aerr.Code() {
        case kms.ErrCodeNotFoundException:
            fmt.Println(kms.ErrCodeNotFoundException, aerr.Error())
        case kms.ErrCodeDisabledException:
            fmt.Println(kms.ErrCodeDisabledException, aerr.Error())
        case kms.ErrCodeKeyUnavailableException:
            fmt.Println(kms.ErrCodeKeyUnavailableException, aerr.Error())
        case kms.ErrCodeDependencyTimeoutException:
            fmt.Println(kms.ErrCodeDependencyTimeoutException, aerr.Error())
        case kms.ErrCodeInvalidKeyUsageException:
            fmt.Println(kms.ErrCodeInvalidKeyUsageException, aerr.Error())
        case kms.ErrCodeInvalidGrantTokenException:
            fmt.Println(kms.ErrCodeInvalidGrantTokenException, aerr.Error())
        case kms.ErrCodeInternalException:
            fmt.Println(kms.ErrCodeInternalException, aerr.Error())
        case kms.ErrCodeInvalidStateException:
            fmt.Println(kms.ErrCodeInvalidStateException, aerr.Error())
        case kms.ErrCodeDryRunOperationException:
            fmt.Println(kms.ErrCodeDryRunOperationException, aerr.Error())
        default:
            fmt.Println(aerr.Error())
        }
    } else {
        // Print the error, cast err to awserr.Error to get the Code and
        // Message from an error.
        fmt.Println(err.Error())
    }
    return
}

fmt.Println(result)

Example (Shared01)

To generate a data key pair for a Nitro enclave The following example includes the Recipient parameter with a signed attestation document from an AWS Nitro enclave. Instead of returning a copy of the data key encrypted by the KMS key and a plaintext copy of the data key, GenerateDataKey returns one copy of the data key encrypted by the KMS key (CiphertextBlob) and one copy of the data key encrypted by the public key from the attestation document (CiphertextForRecipient). The operation doesn't return a plaintext data key.

Code:

svc := kms.New(session.New())
input := &kms.GenerateDataKeyInput{
    KeyId:   aws.String("arn:aws:kms:us-east-2:111122223333:key/1234abcd-12ab-34cd-56ef-1234567890ab"),
    KeySpec: aws.String("AES_256"),
    Recipient: &kms.RecipientInfo{
        AttestationDocument:    []byte("<attestation document>"),
        KeyEncryptionAlgorithm: aws.String("RSAES_OAEP_SHA_256"),
    },
}

result, err := svc.GenerateDataKey(input)
if err != nil {
    if aerr, ok := err.(awserr.Error); ok {
        switch aerr.Code() {
        case kms.ErrCodeNotFoundException:
            fmt.Println(kms.ErrCodeNotFoundException, aerr.Error())
        case kms.ErrCodeDisabledException:
            fmt.Println(kms.ErrCodeDisabledException, aerr.Error())
        case kms.ErrCodeKeyUnavailableException:
            fmt.Println(kms.ErrCodeKeyUnavailableException, aerr.Error())
        case kms.ErrCodeDependencyTimeoutException:
            fmt.Println(kms.ErrCodeDependencyTimeoutException, aerr.Error())
        case kms.ErrCodeInvalidKeyUsageException:
            fmt.Println(kms.ErrCodeInvalidKeyUsageException, aerr.Error())
        case kms.ErrCodeInvalidGrantTokenException:
            fmt.Println(kms.ErrCodeInvalidGrantTokenException, aerr.Error())
        case kms.ErrCodeInternalException:
            fmt.Println(kms.ErrCodeInternalException, aerr.Error())
        case kms.ErrCodeInvalidStateException:
            fmt.Println(kms.ErrCodeInvalidStateException, aerr.Error())
        case kms.ErrCodeDryRunOperationException:
            fmt.Println(kms.ErrCodeDryRunOperationException, aerr.Error())
        default:
            fmt.Println(aerr.Error())
        }
    } else {
        // Print the error, cast err to awserr.Error to get the Code and
        // Message from an error.
        fmt.Println(err.Error())
    }
    return
}

fmt.Println(result)

func (*KMS) GenerateDataKeyPair

func (c *KMS) GenerateDataKeyPair(input *GenerateDataKeyPairInput) (*GenerateDataKeyPairOutput, error)

GenerateDataKeyPair API operation for AWS Key Management Service.

Returns a unique asymmetric data key pair for use outside of KMS. This operation returns a plaintext public key, a plaintext private key, and a copy of the private key that is encrypted under the symmetric encryption KMS key you specify. You can use the data key pair to perform asymmetric cryptography and implement digital signatures outside of KMS. The bytes in the keys are random; they are not related to the caller or to the KMS key that is used to encrypt the private key.

You can use the public key that GenerateDataKeyPair returns to encrypt data or verify a signature outside of KMS. Then, store the encrypted private key with the data. When you are ready to decrypt data or sign a message, you can use the Decrypt operation to decrypt the encrypted private key.

To generate a data key pair, you must specify a symmetric encryption KMS key to encrypt the private key in a data key pair. You cannot use an asymmetric KMS key or a KMS key in a custom key store. To get the type and origin of your KMS key, use the DescribeKey operation.

Use the KeyPairSpec parameter to choose an RSA or Elliptic Curve (ECC) data key pair. In China Regions, you can also choose an SM2 data key pair. KMS recommends that you use ECC key pairs for signing, and use RSA and SM2 key pairs for either encryption or signing, but not both. However, KMS cannot enforce any restrictions on the use of data key pairs outside of KMS.

If you are using the data key pair to encrypt data, or for any operation where you don't immediately need a private key, consider using the GenerateDataKeyPairWithoutPlaintext operation. GenerateDataKeyPairWithoutPlaintext returns a plaintext public key and an encrypted private key, but omits the plaintext private key that you need only to decrypt ciphertext or sign a message. Later, when you need to decrypt the data or sign a message, use the Decrypt operation to decrypt the encrypted private key in the data key pair.

GenerateDataKeyPair returns a unique data key pair for each request. The bytes in the keys are random; they are not related to the caller or the KMS key that is used to encrypt the private key. The public key is a DER-encoded X.509 SubjectPublicKeyInfo, as specified in RFC 5280 (https://tools.ietf.org/html/rfc5280). The private key is a DER-encoded PKCS8 PrivateKeyInfo, as specified in RFC 5958 (https://tools.ietf.org/html/rfc5958).

GenerateDataKeyPair also supports Amazon Web Services Nitro Enclaves (https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/nitro-enclave.html), which provide an isolated compute environment in Amazon EC2. To call GenerateDataKeyPair for an Amazon Web Services Nitro enclave, use the Amazon Web Services Nitro Enclaves SDK (https://docs.aws.amazon.com/enclaves/latest/user/developing-applications.html#sdk) or any Amazon Web Services SDK. Use the Recipient parameter to provide the attestation document for the enclave. GenerateDataKeyPair returns the public data key and a copy of the private data key encrypted under the specified KMS key, as usual. But instead of a plaintext copy of the private data key (PrivateKeyPlaintext), the response includes a copy of the private data key encrypted under the public key from the attestation document (CiphertextForRecipient). For information about the interaction between KMS and Amazon Web Services Nitro Enclaves, see How Amazon Web Services Nitro Enclaves uses KMS (https://docs.aws.amazon.com/kms/latest/developerguide/services-nitro-enclaves.html) in the Key Management Service Developer Guide..

You can use an optional encryption context to add additional security to the encryption operation. If you specify an EncryptionContext, you must specify the same encryption context (a case-sensitive exact match) when decrypting the encrypted data key. Otherwise, the request to decrypt fails with an InvalidCiphertextException. For more information, see Encryption Context (https://docs.aws.amazon.com/kms/latest/developerguide/concepts.html#encrypt_context) in the Key Management Service Developer Guide.

The KMS key that you use for this operation must be in a compatible key state. For details, see Key states of KMS keys (https://docs.aws.amazon.com/kms/latest/developerguide/key-state.html) in the Key Management Service Developer Guide.

Cross-account use: Yes. To perform this operation with a KMS key in a different Amazon Web Services account, specify the key ARN or alias ARN in the value of the KeyId parameter.

Required permissions: kms:GenerateDataKeyPair (https://docs.aws.amazon.com/kms/latest/developerguide/kms-api-permissions-reference.html) (key policy)

Related operations:

  • Decrypt

  • Encrypt

  • GenerateDataKey

  • GenerateDataKeyPairWithoutPlaintext

  • GenerateDataKeyWithoutPlaintext

Eventual consistency: The KMS API follows an eventual consistency model. For more information, see KMS eventual consistency (https://docs.aws.amazon.com/kms/latest/developerguide/programming-eventual-consistency.html).

Returns awserr.Error for service API and SDK errors. Use runtime type assertions with awserr.Error's Code and Message methods to get detailed information about the error.

See the AWS API reference guide for AWS Key Management Service's API operation GenerateDataKeyPair for usage and error information.

Returned Error Types:

  • NotFoundException The request was rejected because the specified entity or resource could not be found.

  • DisabledException The request was rejected because the specified KMS key is not enabled.

  • KeyUnavailableException The request was rejected because the specified KMS key was not available. You can retry the request.

  • DependencyTimeoutException The system timed out while trying to fulfill the request. You can retry the request.

  • InvalidKeyUsageException The request was rejected for one of the following reasons:

  • The KeyUsage value of the KMS key is incompatible with the API operation.

  • The encryption algorithm or signing algorithm specified for the operation is incompatible with the type of key material in the KMS key (KeySpec).

    For encrypting, decrypting, re-encrypting, and generating data keys, the KeyUsage must be ENCRYPT_DECRYPT. For signing and verifying messages, the KeyUsage must be SIGN_VERIFY. For generating and verifying message authentication codes (MACs), the KeyUsage must be GENERATE_VERIFY_MAC. For deriving key agreement secrets, the KeyUsage must be KEY_AGREEMENT. To find the KeyUsage of a KMS key, use the DescribeKey operation.

    To find the encryption or signing algorithms supported for a particular KMS key, use the DescribeKey operation.

  • InvalidGrantTokenException The request was rejected because the specified grant token is not valid.

  • InternalException The request was rejected because an internal exception occurred. The request can be retried.

  • InvalidStateException The request was rejected because the state of the specified resource is not valid for this request.

    This exceptions means one of the following:

  • The key state of the KMS key is not compatible with the operation. To find the key state, use the DescribeKey operation. For more information about which key states are compatible with each KMS operation, see Key states of KMS keys (https://docs.aws.amazon.com/kms/latest/developerguide/key-state.html) in the Key Management Service Developer Guide .

  • For cryptographic operations on KMS keys in custom key stores, this exception represents a general failure with many possible causes. To identify the cause, see the error message that accompanies the exception.

  • UnsupportedOperationException The request was rejected because a specified parameter is not supported or a specified resource is not valid for this operation.

  • DryRunOperationException The request was rejected because the DryRun parameter was specified.

See also, https://docs.aws.amazon.com/goto/WebAPI/kms-2014-11-01/GenerateDataKeyPair

Example (Shared00)

To generate an RSA key pair for encryption and decryption This example generates an RSA data key pair for encryption and decryption. The operation returns a plaintext public key and private key, and a copy of the private key that is encrypted under a symmetric encryption KMS key that you specify.

Code:

svc := kms.New(session.New())
input := &kms.GenerateDataKeyPairInput{
    KeyId:       aws.String("arn:aws:kms:us-west-2:111122223333:key/1234abcd-12ab-34cd-56ef-1234567890ab"),
    KeyPairSpec: aws.String("RSA_3072"),
}

result, err := svc.GenerateDataKeyPair(input)
if err != nil {
    if aerr, ok := err.(awserr.Error); ok {
        switch aerr.Code() {
        case kms.ErrCodeNotFoundException:
            fmt.Println(kms.ErrCodeNotFoundException, aerr.Error())
        case kms.ErrCodeDisabledException:
            fmt.Println(kms.ErrCodeDisabledException, aerr.Error())
        case kms.ErrCodeKeyUnavailableException:
            fmt.Println(kms.ErrCodeKeyUnavailableException, aerr.Error())
        case kms.ErrCodeDependencyTimeoutException:
            fmt.Println(kms.ErrCodeDependencyTimeoutException, aerr.Error())
        case kms.ErrCodeInvalidKeyUsageException:
            fmt.Println(kms.ErrCodeInvalidKeyUsageException, aerr.Error())
        case kms.ErrCodeInvalidGrantTokenException:
            fmt.Println(kms.ErrCodeInvalidGrantTokenException, aerr.Error())
        case kms.ErrCodeInternalException:
            fmt.Println(kms.ErrCodeInternalException, aerr.Error())
        case kms.ErrCodeInvalidStateException:
            fmt.Println(kms.ErrCodeInvalidStateException, aerr.Error())
        case kms.ErrCodeUnsupportedOperationException:
            fmt.Println(kms.ErrCodeUnsupportedOperationException, aerr.Error())
        case kms.ErrCodeDryRunOperationException:
            fmt.Println(kms.ErrCodeDryRunOperationException, aerr.Error())
        default:
            fmt.Println(aerr.Error())
        }
    } else {
        // Print the error, cast err to awserr.Error to get the Code and
        // Message from an error.
        fmt.Println(err.Error())
    }
    return
}

fmt.Println(result)

Example (Shared01)

To generate a data key pair for a Nitro enclave The following example includes the Recipient parameter with a signed attestation document from an AWS Nitro enclave. Instead of returning a plaintext copy of the private data key, GenerateDataKeyPair returns a copy of the private data key encrypted by the public key from the attestation document (CiphertextForRecipient). It returns the public data key (PublicKey) and a copy of private data key encrypted under the specified KMS key (PrivateKeyCiphertextBlob), as usual, but plaintext private data key field (PrivateKeyPlaintext) is null or empty.

Code:

svc := kms.New(session.New())
input := &kms.GenerateDataKeyPairInput{
    KeyId:       aws.String("arn:aws:kms:us-east-2:111122223333:key/1234abcd-12ab-34cd-56ef-1234567890ab"),
    KeyPairSpec: aws.String("RSA_3072"),
    Recipient: &kms.RecipientInfo{
        AttestationDocument:    []byte("<attestation document>"),
        KeyEncryptionAlgorithm: aws.String("RSAES_OAEP_SHA_256"),
    },
}

result, err := svc.GenerateDataKeyPair(input)
if err != nil {
    if aerr, ok := err.(awserr.Error); ok {
        switch aerr.Code() {
        case kms.ErrCodeNotFoundException:
            fmt.Println(kms.ErrCodeNotFoundException, aerr.Error())
        case kms.ErrCodeDisabledException:
            fmt.Println(kms.ErrCodeDisabledException, aerr.Error())
        case kms.ErrCodeKeyUnavailableException:
            fmt.Println(kms.ErrCodeKeyUnavailableException, aerr.Error())
        case kms.ErrCodeDependencyTimeoutException:
            fmt.Println(kms.ErrCodeDependencyTimeoutException, aerr.Error())
        case kms.ErrCodeInvalidKeyUsageException:
            fmt.Println(kms.ErrCodeInvalidKeyUsageException, aerr.Error())
        case kms.ErrCodeInvalidGrantTokenException:
            fmt.Println(kms.ErrCodeInvalidGrantTokenException, aerr.Error())
        case kms.ErrCodeInternalException:
            fmt.Println(kms.ErrCodeInternalException, aerr.Error())
        case kms.ErrCodeInvalidStateException:
            fmt.Println(kms.ErrCodeInvalidStateException, aerr.Error())
        case kms.ErrCodeUnsupportedOperationException:
            fmt.Println(kms.ErrCodeUnsupportedOperationException, aerr.Error())
        case kms.ErrCodeDryRunOperationException:
            fmt.Println(kms.ErrCodeDryRunOperationException, aerr.Error())
        default:
            fmt.Println(aerr.Error())
        }
    } else {
        // Print the error, cast err to awserr.Error to get the Code and
        // Message from an error.
        fmt.Println(err.Error())
    }
    return
}

fmt.Println(result)

func (*KMS) GenerateDataKeyPairRequest

func (c *KMS) GenerateDataKeyPairRequest(input *GenerateDataKeyPairInput) (req *request.Request, output *GenerateDataKeyPairOutput)

GenerateDataKeyPairRequest generates a "aws/request.Request" representing the client's request for the GenerateDataKeyPair operation. The "output" return value will be populated with the request's response once the request completes successfully.

Use "Send" method on the returned Request to send the API call to the service. the "output" return value is not valid until after Send returns without error.

See GenerateDataKeyPair for more information on using the GenerateDataKeyPair API call, and error handling.

This method is useful when you want to inject custom logic or configuration into the SDK's request lifecycle. Such as custom headers, or retry logic.

// Example sending a request using the GenerateDataKeyPairRequest method.
req, resp := client.GenerateDataKeyPairRequest(params)

err := req.Send()
if err == nil { // resp is now filled
    fmt.Println(resp)
}

See also, https://docs.aws.amazon.com/goto/WebAPI/kms-2014-11-01/GenerateDataKeyPair

func (*KMS) GenerateDataKeyPairWithContext

func (c *KMS) GenerateDataKeyPairWithContext(ctx aws.Context, input *GenerateDataKeyPairInput, opts ...request.Option) (*GenerateDataKeyPairOutput, error)

GenerateDataKeyPairWithContext is the same as GenerateDataKeyPair with the addition of the ability to pass a context and additional request options.

See GenerateDataKeyPair for details on how to use this API operation.

The context must be non-nil and will be used for request cancellation. If the context is nil a panic will occur. In the future the SDK may create sub-contexts for http.Requests. See https://golang.org/pkg/context/ for more information on using Contexts.

func (*KMS) GenerateDataKeyPairWithoutPlaintext

func (c *KMS) GenerateDataKeyPairWithoutPlaintext(input *GenerateDataKeyPairWithoutPlaintextInput) (*GenerateDataKeyPairWithoutPlaintextOutput, error)

GenerateDataKeyPairWithoutPlaintext API operation for AWS Key Management Service.

Returns a unique asymmetric data key pair for use outside of KMS. This operation returns a plaintext public key and a copy of the private key that is encrypted under the symmetric encryption KMS key you specify. Unlike GenerateDataKeyPair, this operation does not return a plaintext private key. The bytes in the keys are random; they are not related to the caller or to the KMS key that is used to encrypt the private key.

You can use the public key that GenerateDataKeyPairWithoutPlaintext returns to encrypt data or verify a signature outside of KMS. Then, store the encrypted private key with the data. When you are ready to decrypt data or sign a message, you can use the Decrypt operation to decrypt the encrypted private key.

To generate a data key pair, you must specify a symmetric encryption KMS key to encrypt the private key in a data key pair. You cannot use an asymmetric KMS key or a KMS key in a custom key store. To get the type and origin of your KMS key, use the DescribeKey operation.

Use the KeyPairSpec parameter to choose an RSA or Elliptic Curve (ECC) data key pair. In China Regions, you can also choose an SM2 data key pair. KMS recommends that you use ECC key pairs for signing, and use RSA and SM2 key pairs for either encryption or signing, but not both. However, KMS cannot enforce any restrictions on the use of data key pairs outside of KMS.

GenerateDataKeyPairWithoutPlaintext returns a unique data key pair for each request. The bytes in the key are not related to the caller or KMS key that is used to encrypt the private key. The public key is a DER-encoded X.509 SubjectPublicKeyInfo, as specified in RFC 5280 (https://tools.ietf.org/html/rfc5280).

You can use an optional encryption context to add additional security to the encryption operation. If you specify an EncryptionContext, you must specify the same encryption context (a case-sensitive exact match) when decrypting the encrypted data key. Otherwise, the request to decrypt fails with an InvalidCiphertextException. For more information, see Encryption Context (https://docs.aws.amazon.com/kms/latest/developerguide/concepts.html#encrypt_context) in the Key Management Service Developer Guide.

The KMS key that you use for this operation must be in a compatible key state. For details, see Key states of KMS keys (https://docs.aws.amazon.com/kms/latest/developerguide/key-state.html) in the Key Management Service Developer Guide.

Cross-account use: Yes. To perform this operation with a KMS key in a different Amazon Web Services account, specify the key ARN or alias ARN in the value of the KeyId parameter.

Required permissions: kms:GenerateDataKeyPairWithoutPlaintext (https://docs.aws.amazon.com/kms/latest/developerguide/kms-api-permissions-reference.html) (key policy)

Related operations:

  • Decrypt

  • Encrypt

  • GenerateDataKey

  • GenerateDataKeyPair

  • GenerateDataKeyWithoutPlaintext

Eventual consistency: The KMS API follows an eventual consistency model. For more information, see KMS eventual consistency (https://docs.aws.amazon.com/kms/latest/developerguide/programming-eventual-consistency.html).

Returns awserr.Error for service API and SDK errors. Use runtime type assertions with awserr.Error's Code and Message methods to get detailed information about the error.

See the AWS API reference guide for AWS Key Management Service's API operation GenerateDataKeyPairWithoutPlaintext for usage and error information.

Returned Error Types:

  • NotFoundException The request was rejected because the specified entity or resource could not be found.

  • DisabledException The request was rejected because the specified KMS key is not enabled.

  • KeyUnavailableException The request was rejected because the specified KMS key was not available. You can retry the request.

  • DependencyTimeoutException The system timed out while trying to fulfill the request. You can retry the request.

  • InvalidKeyUsageException The request was rejected for one of the following reasons:

  • The KeyUsage value of the KMS key is incompatible with the API operation.

  • The encryption algorithm or signing algorithm specified for the operation is incompatible with the type of key material in the KMS key (KeySpec).

    For encrypting, decrypting, re-encrypting, and generating data keys, the KeyUsage must be ENCRYPT_DECRYPT. For signing and verifying messages, the KeyUsage must be SIGN_VERIFY. For generating and verifying message authentication codes (MACs), the KeyUsage must be GENERATE_VERIFY_MAC. For deriving key agreement secrets, the KeyUsage must be KEY_AGREEMENT. To find the KeyUsage of a KMS key, use the DescribeKey operation.

    To find the encryption or signing algorithms supported for a particular KMS key, use the DescribeKey operation.

  • InvalidGrantTokenException The request was rejected because the specified grant token is not valid.

  • InternalException The request was rejected because an internal exception occurred. The request can be retried.

  • InvalidStateException The request was rejected because the state of the specified resource is not valid for this request.

    This exceptions means one of the following:

  • The key state of the KMS key is not compatible with the operation. To find the key state, use the DescribeKey operation. For more information about which key states are compatible with each KMS operation, see Key states of KMS keys (https://docs.aws.amazon.com/kms/latest/developerguide/key-state.html) in the Key Management Service Developer Guide .

  • For cryptographic operations on KMS keys in custom key stores, this exception represents a general failure with many possible causes. To identify the cause, see the error message that accompanies the exception.

  • UnsupportedOperationException The request was rejected because a specified parameter is not supported or a specified resource is not valid for this operation.

  • DryRunOperationException The request was rejected because the DryRun parameter was specified.

See also, https://docs.aws.amazon.com/goto/WebAPI/kms-2014-11-01/GenerateDataKeyPairWithoutPlaintext

Example (Shared00)

To generate an asymmetric data key pair without a plaintext key This example returns an asymmetric elliptic curve (ECC) data key pair. The private key is encrypted under the symmetric encryption KMS key that you specify. This operation doesn't return a plaintext (unencrypted) private key.

Code:

svc := kms.New(session.New())
input := &kms.GenerateDataKeyPairWithoutPlaintextInput{
    KeyId:       aws.String("arn:aws:kms:us-west-2:111122223333:key/1234abcd-12ab-34cd-56ef-1234567890ab"),
    KeyPairSpec: aws.String("ECC_NIST_P521"),
}

result, err := svc.GenerateDataKeyPairWithoutPlaintext(input)
if err != nil {
    if aerr, ok := err.(awserr.Error); ok {
        switch aerr.Code() {
        case kms.ErrCodeNotFoundException:
            fmt.Println(kms.ErrCodeNotFoundException, aerr.Error())
        case kms.ErrCodeDisabledException:
            fmt.Println(kms.ErrCodeDisabledException, aerr.Error())
        case kms.ErrCodeKeyUnavailableException:
            fmt.Println(kms.ErrCodeKeyUnavailableException, aerr.Error())
        case kms.ErrCodeDependencyTimeoutException:
            fmt.Println(kms.ErrCodeDependencyTimeoutException, aerr.Error())
        case kms.ErrCodeInvalidKeyUsageException:
            fmt.Println(kms.ErrCodeInvalidKeyUsageException, aerr.Error())
        case kms.ErrCodeInvalidGrantTokenException:
            fmt.Println(kms.ErrCodeInvalidGrantTokenException, aerr.Error())
        case kms.ErrCodeInternalException:
            fmt.Println(kms.ErrCodeInternalException, aerr.Error())
        case kms.ErrCodeInvalidStateException:
            fmt.Println(kms.ErrCodeInvalidStateException, aerr.Error())
        case kms.ErrCodeUnsupportedOperationException:
            fmt.Println(kms.ErrCodeUnsupportedOperationException, aerr.Error())
        case kms.ErrCodeDryRunOperationException:
            fmt.Println(kms.ErrCodeDryRunOperationException, aerr.Error())
        default:
            fmt.Println(aerr.Error())
        }
    } else {
        // Print the error, cast err to awserr.Error to get the Code and
        // Message from an error.
        fmt.Println(err.Error())
    }
    return
}

fmt.Println(result)

func (*KMS) GenerateDataKeyPairWithoutPlaintextRequest

func (c *KMS) GenerateDataKeyPairWithoutPlaintextRequest(input *GenerateDataKeyPairWithoutPlaintextInput) (req *request.Request, output *GenerateDataKeyPairWithoutPlaintextOutput)

GenerateDataKeyPairWithoutPlaintextRequest generates a "aws/request.Request" representing the client's request for the GenerateDataKeyPairWithoutPlaintext operation. The "output" return value will be populated with the request's response once the request completes successfully.

Use "Send" method on the returned Request to send the API call to the service. the "output" return value is not valid until after Send returns without error.

See GenerateDataKeyPairWithoutPlaintext for more information on using the GenerateDataKeyPairWithoutPlaintext API call, and error handling.

This method is useful when you want to inject custom logic or configuration into the SDK's request lifecycle. Such as custom headers, or retry logic.

// Example sending a request using the GenerateDataKeyPairWithoutPlaintextRequest method.
req, resp := client.GenerateDataKeyPairWithoutPlaintextRequest(params)

err := req.Send()
if err == nil { // resp is now filled
    fmt.Println(resp)
}

See also, https://docs.aws.amazon.com/goto/WebAPI/kms-2014-11-01/GenerateDataKeyPairWithoutPlaintext

func (*KMS) GenerateDataKeyPairWithoutPlaintextWithContext

func (c *KMS) GenerateDataKeyPairWithoutPlaintextWithContext(ctx aws.Context, input *GenerateDataKeyPairWithoutPlaintextInput, opts ...request.Option) (*GenerateDataKeyPairWithoutPlaintextOutput, error)

GenerateDataKeyPairWithoutPlaintextWithContext is the same as GenerateDataKeyPairWithoutPlaintext with the addition of the ability to pass a context and additional request options.

See GenerateDataKeyPairWithoutPlaintext for details on how to use this API operation.

The context must be non-nil and will be used for request cancellation. If the context is nil a panic will occur. In the future the SDK may create sub-contexts for http.Requests. See https://golang.org/pkg/context/ for more information on using Contexts.

func (*KMS) GenerateDataKeyRequest

func (c *KMS) GenerateDataKeyRequest(input *GenerateDataKeyInput) (req *request.Request, output *GenerateDataKeyOutput)

GenerateDataKeyRequest generates a "aws/request.Request" representing the client's request for the GenerateDataKey operation. The "output" return value will be populated with the request's response once the request completes successfully.

Use "Send" method on the returned Request to send the API call to the service. the "output" return value is not valid until after Send returns without error.

See GenerateDataKey for more information on using the GenerateDataKey API call, and error handling.

This method is useful when you want to inject custom logic or configuration into the SDK's request lifecycle. Such as custom headers, or retry logic.

// Example sending a request using the GenerateDataKeyRequest method.
req, resp := client.GenerateDataKeyRequest(params)

err := req.Send()
if err == nil { // resp is now filled
    fmt.Println(resp)
}

See also, https://docs.aws.amazon.com/goto/WebAPI/kms-2014-11-01/GenerateDataKey

func (*KMS) GenerateDataKeyWithContext

func (c *KMS) GenerateDataKeyWithContext(ctx aws.Context, input *GenerateDataKeyInput, opts ...request.Option) (*GenerateDataKeyOutput, error)

GenerateDataKeyWithContext is the same as GenerateDataKey with the addition of the ability to pass a context and additional request options.

See GenerateDataKey for details on how to use this API operation.

The context must be non-nil and will be used for request cancellation. If the context is nil a panic will occur. In the future the SDK may create sub-contexts for http.Requests. See https://golang.org/pkg/context/ for more information on using Contexts.

func (*KMS) GenerateDataKeyWithoutPlaintext

func (c *KMS) GenerateDataKeyWithoutPlaintext(input *GenerateDataKeyWithoutPlaintextInput) (*GenerateDataKeyWithoutPlaintextOutput, error)

GenerateDataKeyWithoutPlaintext API operation for AWS Key Management Service.

Returns a unique symmetric data key for use outside of KMS. This operation returns a data key that is encrypted under a symmetric encryption KMS key that you specify. The bytes in the key are random; they are not related to the caller or to the KMS key.

GenerateDataKeyWithoutPlaintext is identical to the GenerateDataKey operation except that it does not return a plaintext copy of the data key.

This operation is useful for systems that need to encrypt data at some point, but not immediately. When you need to encrypt the data, you call the Decrypt operation on the encrypted copy of the key.

It's also useful in distributed systems with different levels of trust. For example, you might store encrypted data in containers. One component of your system creates new containers and stores an encrypted data key with each container. Then, a different component puts the data into the containers. That component first decrypts the data key, uses the plaintext data key to encrypt data, puts the encrypted data into the container, and then destroys the plaintext data key. In this system, the component that creates the containers never sees the plaintext data key.

To request an asymmetric data key pair, use the GenerateDataKeyPair or GenerateDataKeyPairWithoutPlaintext operations.

To generate a data key, you must specify the symmetric encryption KMS key that is used to encrypt the data key. You cannot use an asymmetric KMS key or a key in a custom key store to generate a data key. To get the type of your KMS key, use the DescribeKey operation.

You must also specify the length of the data key. Use either the KeySpec or NumberOfBytes parameters (but not both). For 128-bit and 256-bit data keys, use the KeySpec parameter.

To generate an SM4 data key (China Regions only), specify a KeySpec value of AES_128 or NumberOfBytes value of 16. The symmetric encryption key used in China Regions to encrypt your data key is an SM4 encryption key.

If the operation succeeds, you will find the encrypted copy of the data key in the CiphertextBlob field.

You can use an optional encryption context to add additional security to the encryption operation. If you specify an EncryptionContext, you must specify the same encryption context (a case-sensitive exact match) when decrypting the encrypted data key. Otherwise, the request to decrypt fails with an InvalidCiphertextException. For more information, see Encryption Context (https://docs.aws.amazon.com/kms/latest/developerguide/concepts.html#encrypt_context) in the Key Management Service Developer Guide.

The KMS key that you use for this operation must be in a compatible key state. For details, see Key states of KMS keys (https://docs.aws.amazon.com/kms/latest/developerguide/key-state.html) in the Key Management Service Developer Guide.

Cross-account use: Yes. To perform this operation with a KMS key in a different Amazon Web Services account, specify the key ARN or alias ARN in the value of the KeyId parameter.

Required permissions: kms:GenerateDataKeyWithoutPlaintext (https://docs.aws.amazon.com/kms/latest/developerguide/kms-api-permissions-reference.html) (key policy)

Related operations:

  • Decrypt

  • Encrypt

  • GenerateDataKey

  • GenerateDataKeyPair

  • GenerateDataKeyPairWithoutPlaintext

Eventual consistency: The KMS API follows an eventual consistency model. For more information, see KMS eventual consistency (https://docs.aws.amazon.com/kms/latest/developerguide/programming-eventual-consistency.html).

Returns awserr.Error for service API and SDK errors. Use runtime type assertions with awserr.Error's Code and Message methods to get detailed information about the error.

See the AWS API reference guide for AWS Key Management Service's API operation GenerateDataKeyWithoutPlaintext for usage and error information.

Returned Error Types:

  • NotFoundException The request was rejected because the specified entity or resource could not be found.

  • DisabledException The request was rejected because the specified KMS key is not enabled.

  • KeyUnavailableException The request was rejected because the specified KMS key was not available. You can retry the request.

  • DependencyTimeoutException The system timed out while trying to fulfill the request. You can retry the request.

  • InvalidKeyUsageException The request was rejected for one of the following reasons:

  • The KeyUsage value of the KMS key is incompatible with the API operation.

  • The encryption algorithm or signing algorithm specified for the operation is incompatible with the type of key material in the KMS key (KeySpec).

    For encrypting, decrypting, re-encrypting, and generating data keys, the KeyUsage must be ENCRYPT_DECRYPT. For signing and verifying messages, the KeyUsage must be SIGN_VERIFY. For generating and verifying message authentication codes (MACs), the KeyUsage must be GENERATE_VERIFY_MAC. For deriving key agreement secrets, the KeyUsage must be KEY_AGREEMENT. To find the KeyUsage of a KMS key, use the DescribeKey operation.

    To find the encryption or signing algorithms supported for a particular KMS key, use the DescribeKey operation.

  • InvalidGrantTokenException The request was rejected because the specified grant token is not valid.

  • InternalException The request was rejected because an internal exception occurred. The request can be retried.

  • InvalidStateException The request was rejected because the state of the specified resource is not valid for this request.

    This exceptions means one of the following:

  • The key state of the KMS key is not compatible with the operation. To find the key state, use the DescribeKey operation. For more information about which key states are compatible with each KMS operation, see Key states of KMS keys (https://docs.aws.amazon.com/kms/latest/developerguide/key-state.html) in the Key Management Service Developer Guide .

  • For cryptographic operations on KMS keys in custom key stores, this exception represents a general failure with many possible causes. To identify the cause, see the error message that accompanies the exception.

  • DryRunOperationException The request was rejected because the DryRun parameter was specified.

See also, https://docs.aws.amazon.com/goto/WebAPI/kms-2014-11-01/GenerateDataKeyWithoutPlaintext

Example (Shared00)

To generate an encrypted data key The following example generates an encrypted copy of a 256-bit symmetric data encryption key (data key). The data key is encrypted with the specified KMS key.

Code:

svc := kms.New(session.New())
input := &kms.GenerateDataKeyWithoutPlaintextInput{
    KeyId:   aws.String("alias/ExampleAlias"),
    KeySpec: aws.String("AES_256"),
}

result, err := svc.GenerateDataKeyWithoutPlaintext(input)
if err != nil {
    if aerr, ok := err.(awserr.Error); ok {
        switch aerr.Code() {
        case kms.ErrCodeNotFoundException:
            fmt.Println(kms.ErrCodeNotFoundException, aerr.Error())
        case kms.ErrCodeDisabledException:
            fmt.Println(kms.ErrCodeDisabledException, aerr.Error())
        case kms.ErrCodeKeyUnavailableException:
            fmt.Println(kms.ErrCodeKeyUnavailableException, aerr.Error())
        case kms.ErrCodeDependencyTimeoutException:
            fmt.Println(kms.ErrCodeDependencyTimeoutException, aerr.Error())
        case kms.ErrCodeInvalidKeyUsageException:
            fmt.Println(kms.ErrCodeInvalidKeyUsageException, aerr.Error())
        case kms.ErrCodeInvalidGrantTokenException:
            fmt.Println(kms.ErrCodeInvalidGrantTokenException, aerr.Error())
        case kms.ErrCodeInternalException:
            fmt.Println(kms.ErrCodeInternalException, aerr.Error())
        case kms.ErrCodeInvalidStateException:
            fmt.Println(kms.ErrCodeInvalidStateException, aerr.Error())
        case kms.ErrCodeDryRunOperationException:
            fmt.Println(kms.ErrCodeDryRunOperationException, aerr.Error())
        default:
            fmt.Println(aerr.Error())
        }
    } else {
        // Print the error, cast err to awserr.Error to get the Code and
        // Message from an error.
        fmt.Println(err.Error())
    }
    return
}

fmt.Println(result)

func (*KMS) GenerateDataKeyWithoutPlaintextRequest

func (c *KMS) GenerateDataKeyWithoutPlaintextRequest(input *GenerateDataKeyWithoutPlaintextInput) (req *request.Request, output *GenerateDataKeyWithoutPlaintextOutput)

GenerateDataKeyWithoutPlaintextRequest generates a "aws/request.Request" representing the client's request for the GenerateDataKeyWithoutPlaintext operation. The "output" return value will be populated with the request's response once the request completes successfully.

Use "Send" method on the returned Request to send the API call to the service. the "output" return value is not valid until after Send returns without error.

See GenerateDataKeyWithoutPlaintext for more information on using the GenerateDataKeyWithoutPlaintext API call, and error handling.

This method is useful when you want to inject custom logic or configuration into the SDK's request lifecycle. Such as custom headers, or retry logic.

// Example sending a request using the GenerateDataKeyWithoutPlaintextRequest method.
req, resp := client.GenerateDataKeyWithoutPlaintextRequest(params)

err := req.Send()
if err == nil { // resp is now filled
    fmt.Println(resp)
}

See also, https://docs.aws.amazon.com/goto/WebAPI/kms-2014-11-01/GenerateDataKeyWithoutPlaintext

func (*KMS) GenerateDataKeyWithoutPlaintextWithContext

func (c *KMS) GenerateDataKeyWithoutPlaintextWithContext(ctx aws.Context, input *GenerateDataKeyWithoutPlaintextInput, opts ...request.Option) (*GenerateDataKeyWithoutPlaintextOutput, error)

GenerateDataKeyWithoutPlaintextWithContext is the same as GenerateDataKeyWithoutPlaintext with the addition of the ability to pass a context and additional request options.

See GenerateDataKeyWithoutPlaintext for details on how to use this API operation.

The context must be non-nil and will be used for request cancellation. If the cont