Skip to content

Commit

Permalink
wip; local crypto testing
Browse files Browse the repository at this point in the history
  • Loading branch information
mccoyp committed Feb 5, 2021
1 parent 4942f77 commit 147a92d
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions sdk/keyvault/azure-keyvault-keys/tests/test_local_crypto.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,13 +76,14 @@ def test_rsa_wrap_unwrap(key, algorithm):
assert unwrap_result.key == plaintext


def test_symmetric_wrap_unwrap():
@pytest.mark.parametrize("algorithm", (a for a in KeyWrapAlgorithm if a.startswith("AES")))
def test_symmetric_wrap_unwrap(algorithm):
jwk = {"k": os.urandom(32), "kty": "oct", "key_ops": ("unwrapKey", "wrapKey")}
key = KeyVaultKey(key_id="http://localhost/keys/key/version", jwk=jwk)
provider = get_local_cryptography_provider(key)
key_bytes = os.urandom(32)

wrap_result = provider.wrap_key(KeyWrapAlgorithm.aes_256, key_bytes)
wrap_result = provider.wrap_key(algorithm, key_bytes)
assert wrap_result.key_id == key.id

unwrap_result = provider.unwrap_key(wrap_result.algorithm, wrap_result.encrypted_key)
Expand Down Expand Up @@ -145,7 +146,7 @@ def test_unsupported_ec_operations(key, algorithm):

@pytest.mark.parametrize(
"algorithm",
[a for a in KeyWrapAlgorithm if a != KeyWrapAlgorithm.aes_256]
[a for a in KeyWrapAlgorithm if a.startswith("RSA")]
+ list(SignatureAlgorithm)
+ list(EncryptionAlgorithm),
)
Expand Down

0 comments on commit 147a92d

Please sign in to comment.