16
16
- Sort key is named "sort_key" with type (S)
17
17
"""
18
18
import pathlib
19
-
20
19
import boto3
21
20
from aws_cryptographic_material_providers .mpl import AwsCryptographicMaterialProviders
22
21
from aws_cryptographic_material_providers .mpl .config import MaterialProvidersConfig
29
28
RawEcdhStaticConfigurationsRawPrivateKeyToStaticPublicKey ,
30
29
RawPrivateKeyToStaticPublicKeyInput ,
31
30
)
31
+ from aws_cryptography_primitives .smithygenerated .aws_cryptography_primitives .models import ECDHCurveSpec
32
32
from aws_cryptographic_material_providers .mpl .references import IKeyring
33
33
from aws_dbesdk_dynamodb .encrypted .client import EncryptedClient
34
34
from aws_dbesdk_dynamodb .structures .dynamodb import (
46
46
EXAMPLE_ECC_PUBLIC_KEY_FILENAME_RECIPIENT = "RawEcdhKeyringExamplePublicKeyRecipient.pem"
47
47
48
48
49
- def raw_ecdh_keyring_get_item_put_item (ddb_table_name : str , curve_spec : str ):
49
+ def raw_ecdh_keyring_get_item_put_item (ddb_table_name : str , curve_spec : ECDHCurveSpec ):
50
50
"""
51
51
Demonstrate using a raw ECDH keyring with static keys.
52
52
@@ -106,7 +106,7 @@ def raw_ecdh_keyring_get_item_put_item(ddb_table_name: str, curve_spec: str):
106
106
mat_prov = AwsCryptographicMaterialProviders (config = MaterialProvidersConfig ())
107
107
108
108
keyring_input = CreateRawEcdhKeyringInput (
109
- curve_spec = curve_spec ,
109
+ curve_spec = str ( curve_spec ) ,
110
110
key_agreement_scheme = RawEcdhStaticConfigurationsRawPrivateKeyToStaticPublicKey (
111
111
RawPrivateKeyToStaticPublicKeyInput (
112
112
# Must be a UTF8 PEM-encoded private key
@@ -122,7 +122,7 @@ def raw_ecdh_keyring_get_item_put_item(ddb_table_name: str, curve_spec: str):
122
122
put_get_example_with_keyring (raw_ecdh_keyring , ddb_table_name )
123
123
124
124
125
- def ephemeral_raw_ecdh_keyring_put_item (ddb_table_name : str , curve_spec : str ):
125
+ def ephemeral_raw_ecdh_keyring_put_item (ddb_table_name : str , curve_spec : ECDHCurveSpec ):
126
126
"""
127
127
Demonstrate using a raw ECDH keyring with ephemeral keys.
128
128
@@ -159,9 +159,8 @@ def ephemeral_raw_ecdh_keyring_put_item(ddb_table_name: str, curve_spec: str):
159
159
# encrypt data and CANNOT decrypt messages.
160
160
# The DynamoDb encryption client uses this to encrypt items.
161
161
mat_prov = AwsCryptographicMaterialProviders (config = MaterialProvidersConfig ())
162
-
163
162
keyring_input = CreateRawEcdhKeyringInput (
164
- curve_spec = curve_spec ,
163
+ curve_spec = str ( curve_spec ) ,
165
164
key_agreement_scheme = RawEcdhStaticConfigurationsEphemeralPrivateKeyToStaticPublicKey (
166
165
EphemeralPrivateKeyToStaticPublicKeyInput (recipient_public_key = public_key_bytes )
167
166
),
@@ -175,7 +174,7 @@ def ephemeral_raw_ecdh_keyring_put_item(ddb_table_name: str, curve_spec: str):
175
174
put_example_with_keyring (raw_ecdh_keyring , ddb_table_name )
176
175
177
176
178
- def discovery_raw_ecdh_keyring_get_item (ddb_table_name : str , curve_spec : str ):
177
+ def discovery_raw_ecdh_keyring_get_item (ddb_table_name : str , curve_spec : ECDHCurveSpec ):
179
178
"""
180
179
Demonstrate using a raw ECDH keyring with discovery.
181
180
@@ -210,7 +209,7 @@ def discovery_raw_ecdh_keyring_get_item(ddb_table_name: str, curve_spec: str):
210
209
mat_prov = AwsCryptographicMaterialProviders (config = MaterialProvidersConfig ())
211
210
212
211
keyring_input = CreateRawEcdhKeyringInput (
213
- curve_spec = curve_spec ,
212
+ curve_spec = str ( curve_spec ) ,
214
213
key_agreement_scheme = RawEcdhStaticConfigurationsPublicKeyDiscovery (
215
214
PublicKeyDiscoveryInput (recipient_static_private_key = private_key_utf8_encoded )
216
215
),
0 commit comments