Skip to content

KMS ​

Parity grade: A · SDK aws-sdk-go-v2/service/kms@v1.61.4 · last audited 2026-10-11 (d1ed0e39b)

Category: Security · View PARITY.md on GitHub · All Services

In-memory KMS with symmetric, asymmetric and HMAC keys, aliases, grants, rotation, key import and custom key stores.

Quick start ​

bash
export AWS_ENDPOINT_URL=http://localhost:8000

KEY=$(aws kms create-key --description "My key" --query KeyMetadata.KeyId --output text)
aws kms create-alias --alias-name alias/my-key --target-key-id "$KEY"
aws kms encrypt --key-id alias/my-key --plaintext "SGVsbG8=" \
    --query CiphertextBlob --output text
aws kms generate-data-key --key-id alias/my-key --key-spec AES_256
aws kms enable-key-rotation --key-id "$KEY"

Supported operations ​

AreaOperations
KeysCreateKey, DescribeKey, ListKeys, EnableKey, DisableKey, ScheduleKeyDeletion, CancelKeyDeletion, UpdateKeyDescription, ReplicateKey, UpdatePrimaryRegion, GetKeyLastUsage
CryptoEncrypt, Decrypt, ReEncrypt, GenerateDataKey, GenerateDataKeyWithoutPlaintext, GenerateDataKeyPair, GenerateDataKeyPairWithoutPlaintext, GenerateRandom, Sign, Verify, GetPublicKey, DeriveSharedSecret, GenerateMac, VerifyMac
RotationEnableKeyRotation, DisableKeyRotation, GetKeyRotationStatus, RotateKeyOnDemand, ListKeyRotations
Key materialGetParametersForImport, ImportKeyMaterial, DeleteImportedKeyMaterial
AliasesCreateAlias, UpdateAlias, DeleteAlias, ListAliases
GrantsCreateGrant, ListGrants, ListRetirableGrants, RetireGrant, RevokeGrant
Key policyPutKeyPolicy, GetKeyPolicy, ListKeyPolicies
TagsTagResource, UntagResource, ListResourceTags
Custom key storesCreateCustomKeyStore, UpdateCustomKeyStore, DeleteCustomKeyStore, DescribeCustomKeyStores, ConnectCustomKeyStore, DisconnectCustomKeyStore

Behaviour ​

  • AWS managed keys (alias/aws/s3, alias/aws/dynamodb, ...) are created on first reference, as on AWS.
  • ScheduleKeyDeletion enforces the 7-30 day window. A janitor purges keys past their deletion date and runs automatic rotations that are due.

Configuration ​

EnvDefaultPurpose
KMS_JANITOR_INTERVAL1mJanitor tick

Differences from AWS ​

WARNING

IAM enforcement (--enforce-iam) evaluates identity and key policies only. Grants are not an authorization source there, so a grantee with no policy allow is denied.

  • External key store proxies are never contacted. The Xks* and VPC endpoint service errors are not produced.
  • ListKeyRotations omits multi-generation key-material fields.

Parity & Coverage ​

MetricValue
PARITY entries audited54 (54 ok)
Feature families4 (4 ok)
Known gaps1
Structural gaps (can't be emulated)1
Deferred items1
Resource leaksfixed

Known Gaps ​

  • Grants as an authorization source in IAM policy evaluation: the iam EnforcementMiddleware (services/iam/middleware.go:87 enforceIAMPolicy) evaluates identity and key policies only and does not consult KMS grants, so a grantee with no policy allow is denied there; IAM/resource-policy evaluation is out of scope (gopherstack-tnqy.6). Tokens presented to Encrypt/Decrypt/GenerateDataKey* are validated for existence, TTL, operations and constraints (grants.go:235).

Structural Gaps ​

These do not block an A grade — no implementation could produce real data here because the underlying data source cannot exist in an emulator.

  • External key store proxies are never contacted: XksProxyUriUnreachable/IncorrectAuthenticationCredential/InvalidResponse, XksKeyNotFound/XksKeyInvalidConfiguration for the external key itself, and VPC endpoint service existence checks need a real proxy or VPC.

Deferred Items ​

  • Custom key store cryptographic connection/HSM simulation: ConnectCustomKeyStore is a pure state-machine transition (verified: no CloudHSM cluster or XKS proxy I/O in custom_key_stores.go); real HSM/XKS connectivity needs an external HSM/key-manager to talk to, which is out of scope for an in-memory emulator.

Audited Operations ​

54 audited operations
OperationWireErrorsStatePersist
CreateKeyfixedfixedokok
DescribeKeyokfixedokok
ListKeysfixedokokok
Encryptokfixedokok
Decryptokfixedokok
ReEncryptokokokok
GenerateDataKeyokokokok
GenerateDataKeyWithoutPlaintextokokokok
GenerateDataKeyPairfixedokokok
GenerateDataKeyPairWithoutPlaintextfixedokokok
Signfixedokokok
Verifyfixedokokok
GetPublicKeyfixedokokok
GenerateMacfixedokokok
VerifyMacfixedokokok
DeriveSharedSecretfixedokokok
GenerateRandomokokokn/a
CreateAliasokokokok
UpdateAliasokokokok
DeleteAliasokokokok
ListAliasesokokokok
EnableKeyRotationokokokok
DisableKeyRotationokokokok
GetKeyRotationStatusokfixedokok
RotateKeyOnDemandokokokok
ListKeyRotationsokokokok
DisableKeyokokokok
EnableKeyokokokok
ScheduleKeyDeletionokokokok
CancelKeyDeletionokokokok
CreateGrantfixedfixedfixedok
ListGrantsokokfixedok
RevokeGrantokokfixedok
RetireGrantokokfixedok
ListRetirableGrantsfixedokfixedok
PutKeyPolicyokokfixedok
GetKeyPolicyokokfixedok
ListKeyPoliciesokokokn/a
GetParametersForImportokokokok
ImportKeyMaterialokokokok
DeleteImportedKeyMaterialokokokok
ReplicateKeyfixedokokok
UpdateKeyDescriptionokokokok
UpdatePrimaryRegionokokokok
CreateCustomKeyStoreokokokok
DeleteCustomKeyStoreokfixedfixedok
DescribeCustomKeyStoresokokokok
ConnectCustomKeyStoreokokokok
DisconnectCustomKeyStoreokokokok
UpdateCustomKeyStoreokokokok
GetKeyLastUsagefixedokokn/a
TagResourceokokokfixed
UntagResourceokokokfixed
ListResourceTagsokokokfixed

Audited Feature Families ​

Feature FamilyStatus
crypto_coreok
error_classificationfixed
key_state_machineok
multi_regionok

Released under the MIT License.