@@ -457,60 +457,60 @@ module AwsKmsKeyring {
457
457
&& AlgorithmSuites. GetEncryptKeyLength (input.materials.algorithmSuite) as nat == |res. value. materials. plaintextDataKey. value|
458
458
&& var LastDecrypt := Last (client.History.Decrypt);
459
459
&& LastDecrypt. output. Success?
460
- && (
461
- exists edk
462
- // , returnedEncryptionAlgorithm
463
- | edk in input. encryptedDataKeys
464
- ::
465
- // = aws-encryption-sdk-specification/framework/aws-kms/aws-kms-keyring.md#ondecrypt
466
- // = type=implication
467
- // # - Its provider ID MUST exactly match the value “aws-kms”.
468
- && var maybeWrappedMaterial :=
469
- EdkWrapping. GetProviderWrappedMaterial (edk.ciphertext, input.materials.algorithmSuite);
470
- && maybeWrappedMaterial. Success?
471
- && edk. keyProviderId == PROVIDER_ID
472
- && KMS. IsValid_CiphertextType (maybeWrappedMaterial.value)
473
- // = aws-encryption-sdk-specification/framework/aws-kms/aws-kms-keyring.md#ondecrypt
474
- // = type=implication
475
- // # When calling [AWS KMS Decrypt]
476
- // # (https://docs.aws.amazon.com/kms/latest/APIReference/API_Decrypt.html),
477
- // # the keyring MUST call with a request constructed
478
- // # as follows:
479
- && KMS. DecryptRequest (
480
- //= aws-encryption-sdk-specification/framework/aws-kms/aws-kms-keyring.md#ondecrypt
481
- //= type=implication
482
- //# - `KeyId` MUST be the configured AWS KMS key identifier.
483
- KeyId := Some(awsKmsKey),
484
- // = aws-encryption-sdk-specification/framework/aws-kms/aws-kms-keyring.md#ondecrypt
485
- // = type=implication
486
- // # - `CiphertextBlob` MUST be the [encrypted data key ciphertext]
487
- // # (../structures.md#ciphertext).
488
- CiphertextBlob := maybeWrappedMaterial. value,
489
- // = aws-encryption-sdk-specification/framework/aws-kms/aws-kms-keyring.md#ondecrypt
490
- // = type=implication
491
- // # - `EncryptionContext` MUST be the [encryption context]
492
- // # (../structures.md#encryption-context) included in the input
493
- // # [decryption materials](../structures.md#decryption-materials).
494
- EncryptionContext := Some (maybeStringifiedEncCtx.value),
495
- // = aws-encryption-sdk-specification/framework/aws-kms/aws-kms-keyring.md#ondecrypt
496
- // = type=implication
497
- // # - `GrantTokens` MUST be this keyring's [grant tokens]
498
- // # (https://docs.aws.amazon.com/kms/latest/developerguide/concepts.html#grant_token).
499
- GrantTokens := Some (grantTokens),
500
- EncryptionAlgorithm := None
501
- )
502
- // = aws-encryption-sdk-specification/framework/aws-kms/aws-kms-keyring.md#ondecrypt
503
- // = type=implication
504
- // # To attempt to decrypt a particular [encrypted data key]
505
- // # (../structures.md#encrypted-data-key), OnDecrypt MUST call [AWS KMS
506
- // # Decrypt](https://docs.aws.amazon.com/kms/latest/APIReference/API_Decrypt.html)
507
- // # with the configured AWS KMS client.
508
- == LastDecrypt. input
509
- // = aws-encryption-sdk-specification/framework/aws-kms/aws-kms-keyring.md#ondecrypt
510
- // = type=implication
511
- // # - The `KeyId` field in the response MUST equal the configured AWS
512
- // # KMS key identifier.
513
- && LastDecrypt. output. value. KeyId == Some (awsKmsKey)
460
+ && OkForDecrypt (awsKmsArn, awsKmsKey) . Pass?
461
+ && ( exists edk
462
+ // , returnedEncryptionAlgorithm
463
+ | edk in input. encryptedDataKeys
464
+ ::
465
+ // = aws-encryption-sdk-specification/framework/aws-kms/aws-kms-keyring.md#ondecrypt
466
+ // = type=implication
467
+ // # - Its provider ID MUST exactly match the value “aws-kms”.
468
+ && var maybeWrappedMaterial :=
469
+ EdkWrapping. GetProviderWrappedMaterial (edk.ciphertext, input.materials.algorithmSuite);
470
+ && maybeWrappedMaterial. Success?
471
+ && edk. keyProviderId == PROVIDER_ID
472
+ && KMS. IsValid_CiphertextType (maybeWrappedMaterial.value)
473
+ // = aws-encryption-sdk-specification/framework/aws-kms/aws-kms-keyring.md#ondecrypt
474
+ // = type=implication
475
+ // # When calling [AWS KMS Decrypt]
476
+ // # (https://docs.aws.amazon.com/kms/latest/APIReference/API_Decrypt.html),
477
+ // # the keyring MUST call with a request constructed
478
+ // # as follows:
479
+ && KMS. DecryptRequest (
480
+ //= aws-encryption-sdk-specification/framework/aws-kms/aws-kms-keyring.md#ondecrypt
481
+ //= type=implication
482
+ //# - `KeyId` MUST be the configured AWS KMS key identifier.
483
+ KeyId := Some(awsKmsKey),
484
+ // = aws-encryption-sdk-specification/framework/aws-kms/aws-kms-keyring.md#ondecrypt
485
+ // = type=implication
486
+ // # - `CiphertextBlob` MUST be the [encrypted data key ciphertext]
487
+ // # (../structures.md#ciphertext).
488
+ CiphertextBlob := maybeWrappedMaterial. value,
489
+ // = aws-encryption-sdk-specification/framework/aws-kms/aws-kms-keyring.md#ondecrypt
490
+ // = type=implication
491
+ // # - `EncryptionContext` MUST be the [encryption context]
492
+ // # (../structures.md#encryption-context) included in the input
493
+ // # [decryption materials](../structures.md#decryption-materials).
494
+ EncryptionContext := Some (maybeStringifiedEncCtx.value),
495
+ // = aws-encryption-sdk-specification/framework/aws-kms/aws-kms-keyring.md#ondecrypt
496
+ // = type=implication
497
+ // # - `GrantTokens` MUST be this keyring's [grant tokens]
498
+ // # (https://docs.aws.amazon.com/kms/latest/developerguide/concepts.html#grant_token).
499
+ GrantTokens := Some (grantTokens),
500
+ EncryptionAlgorithm := None
501
+ )
502
+ // = aws-encryption-sdk-specification/framework/aws-kms/aws-kms-keyring.md#ondecrypt
503
+ // = type=implication
504
+ // # To attempt to decrypt a particular [encrypted data key]
505
+ // # (../structures.md#encrypted-data-key), OnDecrypt MUST call [AWS KMS
506
+ // # Decrypt](https://docs.aws.amazon.com/kms/latest/APIReference/API_Decrypt.html)
507
+ // # with the configured AWS KMS client.
508
+ == LastDecrypt. input
509
+ // = aws-encryption-sdk-specification/framework/aws-kms/aws-kms-keyring.md#ondecrypt
510
+ // = type=implication
511
+ // # - The `KeyId` field in the response MUST equal the configured AWS
512
+ // # KMS key identifier.
513
+ && LastDecrypt. output. value. KeyId == Some (awsKmsKey)
514
514
)
515
515
// = aws-encryption-sdk-specification/framework/aws-kms/aws-kms-keyring.md#ondecrypt
516
516
// = type=implication
0 commit comments