Skip to content

Commit 479faf7

Browse files
authored
fix(Key Store): remove runtime length check on GenerateKey (#84)
* chore: Update CHANGELOG and bump version
1 parent 13e0ac3 commit 479faf7

File tree

7 files changed

+13
-13
lines changed

7 files changed

+13
-13
lines changed

AwsCryptographicMaterialProviders/dafny/AwsCryptographyKeyStore/src/KMSKeystoreOperations.dfy

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,6 @@ module {:options "/functionSyntax:4" } KMSKeystoreOperations {
4747
ensures res.Success? ==>
4848
&& res.value.KeyId.Some?
4949
&& res.value.CiphertextBlob.Some?
50-
&& |res.value.CiphertextBlob.value| == Structure.KMS_GEN_KEY_NO_PLAINTEXT_LENGTH_32
5150
&& KMS.IsValid_CiphertextType(res.value.CiphertextBlob.value)
5251
&& var kmsOperationOutput := Seq.Last(kmsClient.History.GenerateDataKeyWithoutPlaintext).output;
5352
&& kmsOperationOutput.Success?
@@ -67,17 +66,15 @@ module {:options "/functionSyntax:4" } KMSKeystoreOperations {
6766

6867
:- Need(
6968
&& generateResponse.KeyId.Some?,
70-
// && ParseAwsKmsIdentifier(generateResponse.KeyId.value).Success?,
7169
Types.KeyStoreException(
7270
message := "Invalid response from KMS GenerateDataKey:: Invalid Key Id")
7371
);
7472

7573
:- Need(
7674
&& generateResponse.CiphertextBlob.Some?
77-
&& |generateResponse.CiphertextBlob.value| == Structure.KMS_GEN_KEY_NO_PLAINTEXT_LENGTH_32
7875
&& KMS.IsValid_CiphertextType(generateResponse.CiphertextBlob.value),
7976
Types.KeyStoreException(
80-
message := "Invalid response from AWS KMS GeneratedDataKey: Invalid ciphertext")
77+
message := "Invalid response from AWS KMS GenerateDataKey: Invalid ciphertext")
8178
);
8279

8380
return Success(generateResponse);
@@ -161,7 +158,7 @@ module {:options "/functionSyntax:4" } KMSKeystoreOperations {
161158
&& reEncryptResponse.CiphertextBlob.Some?
162159
&& KMS.IsValid_CiphertextType(reEncryptResponse.CiphertextBlob.value),
163160
Types.KeyStoreException(
164-
message := "Invalid response from AWS KMS GeneratedDataKey: Invalid ciphertext")
161+
message := "Invalid response from AWS KMS ReEncrypt: Invalid ciphertext.")
165162
);
166163

167164
return Success(reEncryptResponse);

AwsCryptographicMaterialProviders/dafny/AwsCryptographyKeyStore/src/Structure.dfy

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,6 @@ module {:options "/functionSyntax:4" } Structure {
2727
const BEACON_KEY_TYPE_VALUE := "beacon:ACTIVE"
2828
const ENCRYPTION_CONTEXT_PREFIX := "aws-crypto-ec:"
2929

30-
// A GenerateDataKeyWithoutPlaintext of request size 32 returns a ciphertext size of 184 bytes.
31-
const KMS_GEN_KEY_NO_PLAINTEXT_LENGTH_32 := 184
32-
3330
type BranchKeyContext = m: map<string, string> | BranchKeyContext?(m) witness *
3431
predicate BranchKeyContext?(m: map<string, string>) {
3532
//= aws-encryption-sdk-specification/framework/branch-key-store.md#encryption-context

AwsCryptographicMaterialProviders/runtimes/java/build.gradle.kts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ plugins {
1010
}
1111

1212
group = "software.amazon.cryptography"
13-
version = "1.0.0"
13+
version = "1.0.1"
1414
description = "AWS Cryptographic Material Providers Library"
1515

1616
java {

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
# Changelog
22

3+
## 1.0.1 2023-07-26
4+
5+
### Fix
6+
- Fixes a runtime check in `VersionKey` Key Store API that no longer checks for the CipherText length
7+
on the output of a KMS ReEncrypt API call.
8+
39
## 1.0.0 2023-07-21
410

511
### Features

ComAmazonawsKms/src/Index.dfy

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ module {:extern "software.amazon.cryptography.services.kms.internaldafny"} Com.A
3030

3131
function method DafnyUserAgentSuffix(runtime: string): string
3232
{
33-
var version := "1.0.0";
33+
var version := "1.0.1";
3434
"AwsCryptographicMPL/" + runtime + "/" + version
3535
}
3636

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,14 +72,14 @@ You can get the latest release from Maven or Gradle:
7272
<dependency>
7373
<groupId>software.amazon.cryptography</groupId>
7474
<artifactId>aws-cryptographic-material-providers</artifactId>
75-
<version>1.0.0</version>
75+
<version>1.0.1</version>
7676
</dependency>
7777
```
7878

7979
#### Gradle:
8080
```
8181
dependencies {
82-
implementation("software.amazon.cryptography:aws-cryptographic-material-providers:1.0.0")
82+
implementation("software.amazon.cryptography:aws-cryptographic-material-providers:1.0.1")
8383
}
8484
```
8585

TestVectorsAwsCryptographicMaterialProviders/runtimes/java/build.gradle.kts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ repositories {
5858
dependencies {
5959
implementation("org.dafny:DafnyRuntime:4.1.0")
6060
implementation("software.amazon.smithy.dafny:conversion:0.1")
61-
implementation("software.amazon.cryptography:aws-cryptographic-material-providers:1.0.0")
61+
implementation("software.amazon.cryptography:aws-cryptographic-material-providers:1.0.1")
6262
implementation(platform("software.amazon.awssdk:bom:2.19.1"))
6363
implementation("software.amazon.awssdk:dynamodb")
6464
implementation("software.amazon.awssdk:dynamodb-enhanced")

0 commit comments

Comments
 (0)