16
16
"""
17
17
import json
18
18
import attr
19
-
20
19
# Ignore missing MPL for pylint, but the MPL is required for this example
21
20
# noqa pylint: disable=import-error
21
+ import _dafny
22
+ import UTF8
23
+
24
+ # Ignore pylint not being able to read a module that requires the MPL
25
+ # pylint: disable=no-name-in-module
26
+ from awses_test_vectors .internal .mpl .keyvectors_provider import KeyVectorsProvider
27
+ from awses_test_vectors .manifests .keys import KeysManifest # noqa: disable=F401
28
+ from .master_key import KNOWN_TYPES as MASTER_KEY_KNOWN_TYPES
29
+
30
+
22
31
from aws_cryptography_materialproviderstestvectorkeys .smithygenerated .\
23
32
aws_cryptography_materialproviderstestvectorkeys .models import (
24
33
GetKeyDescriptionInput ,
30
39
from aws_cryptographic_materialproviders .mpl .references import IKeyring
31
40
from aws_cryptographic_materialproviders .mpl .models import CreateMultiKeyringInput
32
41
33
- from .master_key import KNOWN_TYPES as MASTER_KEY_KNOWN_TYPES
34
42
from awses_test_vectors .internal .util import membership_validator
35
43
36
- KEYRING_ONLY_KNOWN_TYPES = ("aws-kms-hierarchy" , )
37
-
38
- import _dafny
39
- import UTF8
44
+ from .master_key import MasterKeySpec
40
45
41
- # Ignore pylint not being able to read a module that requires the MPL
42
- # pylint: disable=no-name-in-module
43
- from awses_test_vectors .internal .mpl .keyvectors_provider import KeyVectorsProvider
44
- from awses_test_vectors .manifests .keys import KeysManifest # noqa: disable=F401
45
46
47
+ KEYRING_ONLY_KNOWN_TYPES = ("aws-kms-hierarchy" , )
46
48
47
- from .master_key import MasterKeySpec
48
49
49
50
50
51
@attr .s
@@ -61,7 +62,9 @@ class KeyringSpec(MasterKeySpec): # pylint: disable=too-many-instance-attribute
61
62
:param str padding_hash: Wrapping key padding hash (required for raw master keys)
62
63
"""
63
64
64
- type_name = attr .ib (validator = membership_validator (set (MASTER_KEY_KNOWN_TYPES ).union (set (KEYRING_ONLY_KNOWN_TYPES ))))
65
+ type_name = attr .ib (validator = membership_validator (
66
+ set (MASTER_KEY_KNOWN_TYPES ).union (set (KEYRING_ONLY_KNOWN_TYPES ))
67
+ ))
65
68
66
69
@classmethod
67
70
def from_scenario (cls , spec ):
@@ -100,9 +103,8 @@ def keyring(self, keys_uri, mode):
100
103
"key" : self .key_name ,
101
104
"provider-id" : self .provider_id ,
102
105
"encryption-algorithm" : self .encryption_algorithm ,
103
- # "keyDescription":
104
-
105
106
}
107
+
106
108
if self .padding_algorithm is not None and self .padding_algorithm != "" :
107
109
input_kwargs ["padding-algorithm" ] = self .padding_algorithm
108
110
if self .padding_hash is not None :
@@ -182,7 +184,7 @@ def keyring(self, keys_uri, mode):
182
184
183
185
return keyring
184
186
185
-
187
+
186
188
def _kms_hierarchy_keyring_from_spec (self , keys ):
187
189
# type: (KeysManifest) -> AwsKmsHierarchyKeyring
188
190
"""Build an AWS KMS hierarchy keyring using this specification.
@@ -194,7 +196,7 @@ def _kms_hierarchy_keyring_from_spec(self, keys):
194
196
"""
195
197
if not self .type_name == "aws-kms-hierarchy" :
196
198
raise TypeError ("This is not an AWS KMS hierarchy key" )
197
-
199
+
198
200
return keyring_from_master_key_specs (keys , )
199
201
200
202
0 commit comments