in src/dynamodb_encryption_sdk/internal/crypto/jce_bridge/authentication.py [0:0]
def load_key(self, key, key_type, key_encoding):
# (bytes, EncryptionKeyType, KeyEncodingType) -> bytes
"""Load a raw key from bytes.
:param bytes key: Raw key bytes to load
:param EncryptionKeyType key_type: Type of key to load
:param KeyEncodingType key_encoding: Encoding used to serialize ``key``
:returns: Loaded key
:rtype: bytes
:raises ValueError: if ``key_type`` is not symmetric or ``key_encoding`` is not raw
"""
if not (key_type is EncryptionKeyType.SYMMETRIC and key_encoding is KeyEncodingType.RAW):
raise ValueError("Key type must be symmetric and encoding must be raw.")
if len(key) * 8 < MinimumKeySizes.HMAC.value:
_LOGGER.warning("HMAC keys smaller than %d bits are unsafe", MinimumKeySizes.HMAC.value)
return key