File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 77from cryptography .hazmat .primitives .asymmetric .rsa import rsa_crt_dmq1
88from cryptography .hazmat .primitives .asymmetric .rsa import rsa_crt_iqmp
99
10+ from ..exception import MissingValue
1011from ..exception import WrongKeyType
1112from ..exception import UnknownKeyType
1213from ..exception import UnsupportedAlgorithm
@@ -86,10 +87,10 @@ def key_from_jwk_dict(jwk_dict):
8687 'kty' ]))
8788 return RSAKey (** _jwk_dict )
8889 elif _jwk_dict ['kty' ] == 'oct' :
89- if isinstance ( _jwk_dict [ 'k' ], bytes ) :
90- _jwk_dict [ 'key' ] = b64d ( _jwk_dict [ "k" ])
91- else :
92- _jwk_dict [ 'key' ] = b64d ( as_bytes ( _jwk_dict [ "k" ]))
90+ if not 'key' in _jwk_dict and not 'k' in _jwk_dict :
91+ raise MissingValue (
92+ 'There has to be one of "k" or "key" in a symmetric key' )
93+
9394 return SYMKey (** _jwk_dict )
9495 else :
9596 raise UnknownKeyType
You can’t perform that action at this time.
0 commit comments