diff --git a/sdk/keyvault/azure-keyvault-certificates/HISTORY.md b/sdk/keyvault/azure-keyvault-certificates/HISTORY.md index 48464a3671a9..bd4ad8929f65 100644 --- a/sdk/keyvault/azure-keyvault-certificates/HISTORY.md +++ b/sdk/keyvault/azure-keyvault-certificates/HISTORY.md @@ -1,5 +1,9 @@ # Release History +## 4.0.0b4 +### Breaking changes +- Enums 'JsonWebKeyCurveName' and 'JsonWebKeyType' have been renamed to 'KeyCurveName' and 'KeyType', respectively. + ## 4.0.0b3 (2019-09-11) Version 4.0.0b3 is the first preview of our efforts to create a user-friendly and Pythonic client library for Azure Key Vault. For more information about preview releases of other Azure SDK libraries, please visit https://aka.ms/azure-sdk-preview1-python. diff --git a/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/__init__.py b/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/__init__.py index db62571fe925..9c62cdca4b6d 100644 --- a/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/__init__.py +++ b/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/__init__.py @@ -3,7 +3,7 @@ # Licensed under the MIT License. # ------------------------------------ from .client import CertificateClient -from .enums import ActionType, JsonWebKeyCurveName, JsonWebKeyType, SecretContentType, KeyUsageType +from .enums import ActionType, KeyCurveName, KeyType, SecretContentType, KeyUsageType from .models import ( AdministratorDetails, CertificatePolicy, @@ -18,8 +18,8 @@ "CertificateClient", "CertificatePolicy", "Contact", - "JsonWebKeyCurveName", - "JsonWebKeyType", + "KeyCurveName", + "KeyType", "KeyProperties", "KeyUsageType", "LifetimeAction", diff --git a/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/aio/__init__.py b/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/aio/__init__.py index af111e52db7b..8eacab36b4d4 100644 --- a/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/aio/__init__.py +++ b/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/aio/__init__.py @@ -4,7 +4,7 @@ # ------------------------------------ from .client import CertificateClient -from ..enums import ActionType, JsonWebKeyCurveName, JsonWebKeyType, SecretContentType, KeyUsageType +from ..enums import ActionType, KeyCurveName, KeyType, SecretContentType, KeyUsageType from ..models import AdministratorDetails, CertificatePolicy, Contact, KeyProperties, LifetimeAction __all__ = [ @@ -13,8 +13,8 @@ "CertificateClient", "CertificatePolicy", "Contact", - "JsonWebKeyCurveName", - "JsonWebKeyType", + "KeyCurveName", + "KeyType", "KeyProperties", "KeyUsageType", "LifetimeAction", diff --git a/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/enums.py b/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/enums.py index a26035d86d54..d84a779d973f 100644 --- a/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/enums.py +++ b/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/enums.py @@ -33,7 +33,7 @@ class KeyUsageType(str, Enum): decipher_only = "decipherOnly" -class JsonWebKeyType(str, Enum): +class KeyType(str, Enum): """Supported key types""" ec = "EC" #: Elliptic Curve @@ -43,7 +43,7 @@ class JsonWebKeyType(str, Enum): oct = "oct" #: Octet sequence (used to represent symmetric keys) -class JsonWebKeyCurveName(str, Enum): +class KeyCurveName(str, Enum): """Supported elliptic curves""" p_256 = "P-256" #: The NIST P-256 elliptic curve, AKA SECG curve SECP256R1. diff --git a/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/models.py b/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/models.py index fa3cc3d9faba..b41605a2b350 100644 --- a/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/models.py +++ b/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/models.py @@ -8,7 +8,7 @@ from ._shared import parse_vault_id from ._shared._generated.v7_0 import models -from .enums import ActionType, KeyUsageType, JsonWebKeyCurveName, JsonWebKeyType, SecretContentType +from .enums import ActionType, KeyUsageType, KeyCurveName, KeyType, SecretContentType try: from typing import TYPE_CHECKING @@ -703,11 +703,11 @@ def _from_certificate_policy_bundle(cls, certificate_policy_bundle): key_properties = KeyProperties( exportable=certificate_policy_bundle.key_properties.exportable, - key_type=(JsonWebKeyType(certificate_policy_bundle.key_properties.key_type) + key_type=(KeyType(certificate_policy_bundle.key_properties.key_type) if certificate_policy_bundle.key_properties.key_type else None), key_size=certificate_policy_bundle.key_properties.key_size, reuse_key=certificate_policy_bundle.key_properties.reuse_key, - curve=(JsonWebKeyCurveName(certificate_policy_bundle.key_properties.curve) + curve=(KeyCurveName(certificate_policy_bundle.key_properties.curve) if certificate_policy_bundle.key_properties.curve else None), ekus=(certificate_policy_bundle.x509_certificate_properties.ekus if certificate_policy_bundle.x509_certificate_properties else None), @@ -1116,14 +1116,14 @@ class KeyProperties(object): :param bool exportable: Indicates if the private key can be exported. :param key_type: The type of key pair to be used for the certificate. Possible values include: 'EC', 'EC-HSM', 'RSA', 'RSA-HSM', 'oct' - :type key_type: str or ~azure.keyvault.certificates.enums.JsonWebKeyType + :type key_type: str or ~azure.keyvault.certificates.enums.KeyType :param int key_size: The key size in bits. For example: 2048, 3072, or 4096 for RSA. :param bool reuse_key: Indicates if the same key pair will be used on certificate renewal. - :param curve: Elliptic curve name. For valid values, see JsonWebKeyCurveName. + :param curve: Elliptic curve name. For valid values, see KeyCurveName. Possible values include: 'P-256', 'P-384', 'P-521', 'P-256K' - :type curve: str or ~azure.keyvault.certificates.enums.JsonWebKeyCurveName + :type curve: str or ~azure.keyvault.certificates.enums.KeyCurveName :param ekus: The enhanced key usages. :type ekus: list[str] :param key_usage: List of key usages. @@ -1132,10 +1132,10 @@ class KeyProperties(object): def __init__( self, exportable=None, # type: Optional[bool] - key_type=None, # type: Optional[JsonWebKeyType] + key_type=None, # type: Optional[KeyType] key_size=None, # type: Optional[str] reuse_key=None, # type: Optional[bool] - curve=None, # type: Optional[JsonWebKeyCurveName] + curve=None, # type: Optional[KeyCurveName] ekus=None, # type: Optional[list[str]] key_usage=None # type: Optional[list[KeyUsageType]] ): @@ -1159,10 +1159,10 @@ def exportable(self): @property def key_type(self): - # type: () -> JsonWebKeyType + # type: () -> KeyType """The type of key pair to be used for the certificate. - :rtype: ~azure.keyvault.certificates.enums.JsonWebKeyType + :rtype: ~azure.keyvault.certificates.enums.KeyType """ return self._key_type @@ -1186,10 +1186,10 @@ def reuse_key(self): @property def curve(self): - # type: () -> JsonWebKeyCurveName + # type: () -> KeyCurveName """Elliptic curve name. - :rtype: ~azure.keyvault.certificates.enums.JsonWebKeyCurveName + :rtype: ~azure.keyvault.certificates.enums.KeyCurveName """ return self._curve diff --git a/sdk/keyvault/azure-keyvault-keys/HISTORY.md b/sdk/keyvault/azure-keyvault-keys/HISTORY.md index 15d14bc3613e..bdc64b1eed20 100644 --- a/sdk/keyvault/azure-keyvault-keys/HISTORY.md +++ b/sdk/keyvault/azure-keyvault-keys/HISTORY.md @@ -1,5 +1,9 @@ # Release History +## 4.0.0b4 +- Enums 'JsonWebKeyCurveName', 'JsonWebKeyOperation', and 'JsonWebKeyType' have +been renamed to 'KeyCurveName', 'KeyOperation', and 'KeyType', respectively. + ## 4.0.0b3 (2019-09-11) ### Breaking changes: - `CryptographyClient` methods `wrap` and `unwrap` are renamed `wrap_key` and diff --git a/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/__init__.py b/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/__init__.py index 3e072ff03a5f..81c43354a71b 100644 --- a/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/__init__.py +++ b/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/__init__.py @@ -3,6 +3,6 @@ # Licensed under the MIT License. # ------------------------------------- from .client import KeyClient -from .enums import JsonWebKeyCurveName, JsonWebKeyOperation, JsonWebKeyType +from .enums import KeyCurveName, KeyOperation, KeyType -__all__ = ["JsonWebKeyCurveName", "JsonWebKeyOperation", "JsonWebKeyType", "KeyClient"] +__all__ = ["KeyCurveName", "KeyOperation", "KeyType", "KeyClient"] diff --git a/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/aio/client.py b/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/aio/client.py index d04d85928de7..c54c274be3f5 100644 --- a/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/aio/client.py +++ b/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/aio/client.py @@ -57,16 +57,16 @@ async def create_key( :param str name: The name of the new key. Key Vault will generate the key's version. :param key_type: The type of key to create - :type key_type: str or ~azure.keyvault.keys.enums.JsonWebKeyType + :type key_type: str or ~azure.keyvault.keys.enums.KeyType :param int size: (optional) RSA key size in bits, for example 2048, 3072, or 4096. :param key_operations: (optional) Allowed key operations - :type key_operations: list(str or ~azure.keyvault.keys.enums.JsonWebKeyOperation) + :type key_operations: list(str or ~azure.keyvault.keys.enums.KeyOperation) :param bool enabled: (optional) Whether the key is enabled for use :param expires: (optional) Expiry date of the key in UTC :param datetime.datetime not_before: (optional) Not before date of the key in UTC :param dict tags: (optional) Application specific metadata in the form of key-value pairs :param curve: (optional) Elliptic curve name. Defaults to the NIST P-256 elliptic curve. - :type curve: ~azure.keyvault.keys.enums.JsonWebKeyCurveName or str + :type curve: ~azure.keyvault.keys.enums.KeyCurveName or str :returns: The created key :rtype: ~azure.keyvault.keys.models.Key @@ -116,7 +116,7 @@ async def create_rsa_key( :param bool hsm: Whether to create a hardware key (HSM) or software key :param int size: (optional) Key size in bits, for example 2048, 3072, or 4096 :param key_operations: (optional) Allowed key operations - :type key_operations: list(str or ~azure.keyvault.keys.enums.JsonWebKeyOperation) + :type key_operations: list(str or ~azure.keyvault.keys.enums.KeyOperation) :param bool enabled: (optional) Whether the key is enabled for use :param expires: (optional) Expiry date of the key in UTC :param datetime.datetime not_before: (optional) Not before date of the key in UTC @@ -165,9 +165,9 @@ async def create_ec_key( :param str name: The name for the new key. Key Vault will generate the key's version. :param bool hsm: Whether to create as a hardware key (HSM) or software key. :param curve: (optional) Elliptic curve name. Defaults to the NIST P-256 elliptic curve. - :type curve: ~azure.keyvault.keys.enums.JsonWebKeyCurveName or str + :type curve: ~azure.keyvault.keys.enums.KeyCurveName or str :param key_operations: (optional) Allowed key operations - :type key_operations: list(~azure.keyvault.keys.enums.JsonWebKeyOperation) + :type key_operations: list(~azure.keyvault.keys.enums.KeyOperation) :param bool enabled: (optional) Whether the key is enabled for use :param datetime.datetime expires: (optional) Expiry date of the key in UTC :param datetime.datetime not_before: (optional) Not before date of the key in UTC @@ -398,7 +398,7 @@ async def update_key( :param str name: The name of key to update :param str version: (optional) The version of the key to update :param key_operations: (optional) Allowed key operations - :type key_operations: list(str or ~azure.keyvault.keys.enums.JsonWebKeyOperation) + :type key_operations: list(str or ~azure.keyvault.keys.enums.KeyOperation) :param bool enabled: (optional) Whether the key is enabled for use :param datetime.datetime expires: (optional) Expiry date of the key in UTC :param datetime.datetime not_before: (optional) Not before date of the key in UTC diff --git a/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/client.py b/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/client.py index 98637f6d0922..9f47a030da27 100644 --- a/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/client.py +++ b/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/client.py @@ -67,16 +67,16 @@ def create_key( :param str name: The name of the new key. Key Vault will generate the key's version. :param key_type: The type of key to create - :type key_type: str or ~azure.keyvault.keys.enums.JsonWebKeyType + :type key_type: str or ~azure.keyvault.keys.enums.KeyType :param int size: (optional) RSA key size in bits, for example 2048, 3072, or 4096. :param key_operations: (optional) Allowed key operations - :type key_operations: list(str or ~azure.keyvault.keys.enums.JsonWebKeyOperation) + :type key_operations: list(str or ~azure.keyvault.keys.enums.KeyOperation) :param bool enabled: (optional) Whether the key is enabled for use :param expires: (optional) Expiry date of the key in UTC :param datetime.datetime not_before: (optional) Not before date of the key in UTC :param dict tags: (optional) Application specific metadata in the form of key-value pairs :param curve: (optional) Elliptic curve name. Defaults to the NIST P-256 elliptic curve. - :type curve: ~azure.keyvault.keys.enums.JsonWebKeyCurveName or str + :type curve: ~azure.keyvault.keys.enums.KeyCurveName or str :returns: The created key :rtype: ~azure.keyvault.keys.models.Key @@ -127,7 +127,7 @@ def create_rsa_key( :param bool hsm: Whether to create a hardware key (HSM) or software key :param int size: (optional) Key size in bits, for example 2048, 3072, or 4096 :param key_operations: (optional) Allowed key operations - :type key_operations: list(str or ~azure.keyvault.keys.enums.JsonWebKeyOperation) + :type key_operations: list(str or ~azure.keyvault.keys.enums.KeyOperation) :param bool enabled: (optional) Whether the key is enabled for use :param expires: (optional) Expiry date of the key in UTC :param datetime.datetime not_before: (optional) Not before date of the key in UTC @@ -177,9 +177,9 @@ def create_ec_key( :param str name: The name for the new key. Key Vault will generate the key's version. :param bool hsm: Whether to create as a hardware key (HSM) or software key. :param curve: (optional) Elliptic curve name. Defaults to the NIST P-256 elliptic curve. - :type curve: ~azure.keyvault.keys.enums.JsonWebKeyCurveName or str + :type curve: ~azure.keyvault.keys.enums.KeyCurveName or str :param key_operations: (optional) Allowed key operations - :type key_operations: list(~azure.keyvault.keys.enums.JsonWebKeyOperation) + :type key_operations: list(~azure.keyvault.keys.enums.KeyOperation) :param bool enabled: (optional) Whether the key is enabled for use :param datetime.datetime expires: (optional) Expiry date of the key in UTC :param datetime.datetime not_before: (optional) Not before date of the key in UTC @@ -424,7 +424,7 @@ def update_key( :param str name: The name of key to update :param str version: (optional) The version of the key to update :param key_operations: (optional) Allowed key operations - :type key_operations: list(str or ~azure.keyvault.keys.enums.JsonWebKeyOperation) + :type key_operations: list(str or ~azure.keyvault.keys.enums.KeyOperation) :param bool enabled: (optional) Whether the key is enabled for use :param datetime.datetime expires: (optional) Expiry date of the key in UTC :param datetime.datetime not_before: (optional) Not before date of the key in UTC diff --git a/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/enums.py b/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/enums.py index 228e0a6d4095..2e2521f0422f 100644 --- a/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/enums.py +++ b/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/enums.py @@ -5,7 +5,7 @@ from enum import Enum -class JsonWebKeyCurveName(str, Enum): +class KeyCurveName(str, Enum): """Supported elliptic curves""" p_256 = "P-256" #: The NIST P-256 elliptic curve, AKA SECG curve SECP256R1. @@ -14,7 +14,7 @@ class JsonWebKeyCurveName(str, Enum): p_256_k = "P-256K" #: The SECG SECP256K1 elliptic curve. -class JsonWebKeyOperation(str, Enum): +class KeyOperation(str, Enum): """Supported key operations""" encrypt = "encrypt" @@ -25,7 +25,7 @@ class JsonWebKeyOperation(str, Enum): unwrap_key = "unwrapKey" -class JsonWebKeyType(str, Enum): +class KeyType(str, Enum): """Supported key types""" ec = "EC" #: Elliptic Curve diff --git a/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/models.py b/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/models.py index 6bfc319f05cd..7d65e0716e60 100644 --- a/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/models.py +++ b/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/models.py @@ -24,9 +24,9 @@ class JsonWebKey(object): :param str kid: Key identifier. :param kty: Key Type (kty), as defined in https://tools.ietf.org/html/draft-ietf-jose-json-web-algorithms-40 - :type kty: str or ~azure.keyvault.keys.enums.JsonWebKeyType + :type kty: str or ~azure.keyvault.keys.enums.KeyType :param key_ops: Allowed operations for the key - :type key_ops: list(~azure.keyvault.keys.enums.JsonWebKeyOperation) + :type key_ops: list(~azure.keyvault.keys.enums.KeyOperation) :param bytes n: RSA modulus. :param bytes e: RSA public exponent. :param bytes d: RSA private exponent, or the D component of an EC private key. @@ -38,7 +38,7 @@ class JsonWebKey(object): :param bytes k: Symmetric key. :param bytes t: HSM Token, used with 'Bring Your Own Key'. :param crv: Elliptic curve name. - :type crv: str or ~azure.keyvault.keys.enums.JsonWebKeyCurveName + :type crv: str or ~azure.keyvault.keys.enums.KeyCurveName :param bytes x: X component of an EC public key. :param bytes y: Y component of an EC public key. """ diff --git a/sdk/keyvault/azure-keyvault-keys/tests/test_crypto_client.py b/sdk/keyvault/azure-keyvault-keys/tests/test_crypto_client.py index afa5d92c304e..5f37a8385a11 100644 --- a/sdk/keyvault/azure-keyvault-keys/tests/test_crypto_client.py +++ b/sdk/keyvault/azure-keyvault-keys/tests/test_crypto_client.py @@ -5,7 +5,7 @@ import codecs import hashlib -from azure.keyvault.keys import JsonWebKeyCurveName +from azure.keyvault.keys import KeyCurveName from azure.keyvault.keys.crypto import EncryptionAlgorithm, KeyWrapAlgorithm, SignatureAlgorithm from azure.keyvault.keys._shared._generated.v7_0.models import JsonWebKey from azure.mgmt.keyvault.models import KeyPermissions, Permissions @@ -189,10 +189,10 @@ def test_ec_verify_local(self, vault_client, **kwargs): key_client = vault_client.keys matrix = { - JsonWebKeyCurveName.p_256: (SignatureAlgorithm.es256, hashlib.sha256), - JsonWebKeyCurveName.p_256_k: (SignatureAlgorithm.es256_k, hashlib.sha256), - JsonWebKeyCurveName.p_384: (SignatureAlgorithm.es384, hashlib.sha384), - JsonWebKeyCurveName.p_521: (SignatureAlgorithm.es512, hashlib.sha512), + KeyCurveName.p_256: (SignatureAlgorithm.es256, hashlib.sha256), + KeyCurveName.p_256_k: (SignatureAlgorithm.es256_k, hashlib.sha256), + KeyCurveName.p_384: (SignatureAlgorithm.es384, hashlib.sha384), + KeyCurveName.p_521: (SignatureAlgorithm.es512, hashlib.sha512), } for curve, (signature_algorithm, hash_function) in matrix.items(): diff --git a/sdk/keyvault/azure-keyvault-keys/tests/test_crypto_client_async.py b/sdk/keyvault/azure-keyvault-keys/tests/test_crypto_client_async.py index 4114caa59170..797f7c271ce2 100644 --- a/sdk/keyvault/azure-keyvault-keys/tests/test_crypto_client_async.py +++ b/sdk/keyvault/azure-keyvault-keys/tests/test_crypto_client_async.py @@ -5,7 +5,7 @@ import codecs import hashlib -from azure.keyvault.keys import JsonWebKeyCurveName +from azure.keyvault.keys import KeyCurveName from azure.keyvault.keys.crypto import CryptographyClient, EncryptionAlgorithm, KeyWrapAlgorithm, SignatureAlgorithm from azure.keyvault.keys._shared._generated.v7_0.models import JsonWebKey from azure.mgmt.keyvault.models import KeyPermissions, Permissions @@ -196,10 +196,10 @@ async def test_ec_verify_local(self, vault_client, **kwargs): key_client = vault_client.keys matrix = { - JsonWebKeyCurveName.p_256: (SignatureAlgorithm.es256, hashlib.sha256), - JsonWebKeyCurveName.p_256_k: (SignatureAlgorithm.es256_k, hashlib.sha256), - JsonWebKeyCurveName.p_384: (SignatureAlgorithm.es384, hashlib.sha384), - JsonWebKeyCurveName.p_521: (SignatureAlgorithm.es512, hashlib.sha512), + KeyCurveName.p_256: (SignatureAlgorithm.es256, hashlib.sha256), + KeyCurveName.p_256_k: (SignatureAlgorithm.es256_k, hashlib.sha256), + KeyCurveName.p_384: (SignatureAlgorithm.es384, hashlib.sha384), + KeyCurveName.p_521: (SignatureAlgorithm.es512, hashlib.sha512), } for curve, (signature_algorithm, hash_function) in matrix.items():