in src/dynamodb_encryption_sdk/internal/crypto/jce_bridge/primitives.py [0:0]
def load_key(self, key, key_type, key_encoding):
"""Load a key from bytes.
:param bytes key: Key bytes
:param EncryptionKeyType key_type: Type of key
:param KeyEncodingType key_encoding: Encoding used to serialize key
:returns: Loaded key
"""
if key_type is not EncryptionKeyType.SYMMETRIC:
raise ValueError(
'Invalid key type "{key_type}" for cipher "{cipher}"'.format(key_type=key_type, cipher=self.java_name)
)
if key_encoding is not KeyEncodingType.RAW:
raise ValueError(
'Invalid key encoding "{key_encoding}" for cipher "{cipher}"'.format(
key_encoding=key_encoding, cipher=self.java_name
)
)
return key