Solution was simply to extend the CryptoGraphy
client...
class ExtendedCryptographyClient:
def __init__(self, key_id, credential):
self.cryptography_client = CryptographyClient(key_id, credential)
self.key_id = key_id
def wrap_key(self, key: bytes) -> bytes:
# Implement wrapping logic using cryptography_client
wrap_result = self.cryptography_client.wrap_key(KeyWrapAlgorithm.rsa_oaep, key)
return wrap_result.encrypted_key
def unwrap_key(self, key: bytes, algorithm: str) -> bytes:
# Implement unwrapping logic using cryptography_client
unwrap_result = self.cryptography_client.unwrap_key(algorithm, key)
return unwrap_result.key
def get_kid(self) -> str:
# Return the key ID
return self.key_id
def get_key_wrap_algorithm(self) -> str:
# Return the key wrap algorithm used
return KeyWrapAlgorithm.rsa_oaep