From 7ba57b582dff106fb8afa910c631d6c61303997c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?McCoy=20Pati=C3=B1o?= Date: Fri, 4 Jun 2021 18:00:38 -0700 Subject: [PATCH 1/4] Update certs --- .../azure/keyvault/certificates/_client.py | 10 ++++++---- .../azure/keyvault/certificates/aio/_client.py | 12 +++++++----- 2 files changed, 13 insertions(+), 9 deletions(-) diff --git a/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_client.py b/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_client.py index 5520b6baf8af..dbb832499e85 100644 --- a/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_client.py +++ b/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_client.py @@ -340,8 +340,9 @@ def import_certificate(self, certificate_name, certificate_bytes, **kwargs): Imports an existing valid certificate, containing a private key, into Azure Key Vault. The certificate to be imported can be in either PFX or PEM format. If the certificate is in PEM format the PEM file must contain the - key as well as x509 certificates, and you must provide a ``policy`` with :attr:`CertificatePolicy.content_type` - of :attr:`CertificateContentType.pem`. + key as well as x509 certificates, and you must provide a ``policy`` + with :attr:`~azure.keyvault.certificates.CertificatePolicy.content_type` of + :attr:`~azure.keyvault.certificates.CertificateContentType.pem`. :param str certificate_name: The name of the certificate. :param bytes certificate_bytes: Bytes of the certificate object to import. This certificate @@ -350,9 +351,10 @@ def import_certificate(self, certificate_name, certificate_bytes, **kwargs): :keyword tags: Application specific metadata in the form of key-value pairs. :paramtype tags: dict[str, str] :keyword str password: If the private key in the passed in certificate is encrypted, it - is the password used for encryption. + is the password used for encryption. :keyword policy: The management policy for the certificate. Required if importing a PEM-format certificate, - with :attr:`CertificatePolicy.content_type` set to :attr:`CertificateContentType.pem`. + with :attr:`~azure.keyvault.certificates.CertificatePolicy.content_type` set to + :attr:`~azure.keyvault.certificates.CertificateContentType.pem`. :paramtype policy: ~azure.keyvault.certificates.CertificatePolicy :returns: The imported KeyVaultCertificate :rtype: ~azure.keyvault.certificates.KeyVaultCertificate diff --git a/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/aio/_client.py b/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/aio/_client.py index 751095c46178..d2553ea5ac19 100644 --- a/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/aio/_client.py +++ b/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/aio/_client.py @@ -316,8 +316,9 @@ async def import_certificate( Imports an existing valid certificate, containing a private key, into Azure Key Vault. The certificate to be imported can be in either PFX or PEM format. If the certificate is in PEM format the PEM file must contain the - key as well as x509 certificates, and you must provide a ``policy`` with :attr:`CertificatePolicy.content_type` - of :attr:`CertificateContentType.pem`. + key as well as x509 certificates, and you must provide a ``policy`` + with :attr:`~azure.keyvault.certificates.CertificatePolicy.content_type` of + :attr:`~azure.keyvault.certificates.CertificateContentType.pem`. :param str certificate_name: The name of the certificate. :param bytes certificate_bytes: Bytes of the certificate object to import. @@ -326,9 +327,10 @@ async def import_certificate( :keyword tags: Application specific metadata in the form of key-value pairs. :paramtype tags: dict[str, str] :keyword str password: If the private key in the passed in certificate is encrypted, it - is the password used for encryption. + is the password used for encryption. :keyword policy: The management policy for the certificate. Required if importing a PEM-format certificate, - with :attr:`CertificatePolicy.content_type` set to :attr:`CertificateContentType.pem`. + with :attr:`~azure.keyvault.certificates.CertificatePolicy.content_type` set to + :attr:`~azure.keyvault.certificates.CertificateContentType.pem`. :paramtype policy: ~azure.keyvault.certificates.CertificatePolicy :returns: The imported KeyVaultCertificate :rtype: ~azure.keyvault.certificates.KeyVaultCertificate @@ -749,7 +751,7 @@ async def merge_certificate( Requires the certificates/create permission. Performs the merging of a certificate or certificate chain with a key pair currently available in the service. - Make sure when creating the certificate to merge using :func:`begin_create_certificate` that you set + Make sure when creating the certificate to merge using :func:`create_certificate` that you set its issuer to 'Unknown'. This way Key Vault knows that the certificate will not be signed by an issuer known to it. From 145f29691b4b9d77de935399e7ef3fc4c532d507 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?McCoy=20Pati=C3=B1o?= Date: Fri, 4 Jun 2021 18:27:29 -0700 Subject: [PATCH 2/4] Update keys --- .../azure/keyvault/keys/_client.py | 49 ++++++++++++------- .../azure/keyvault/keys/aio/_client.py | 46 +++++++++++------ .../azure/keyvault/keys/crypto/_client.py | 26 +++++++--- .../azure/keyvault/keys/crypto/aio/_client.py | 26 +++++++--- 4 files changed, 99 insertions(+), 48 deletions(-) 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 f71997563231..9e439d7560ed 100644 --- a/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/_client.py +++ b/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/_client.py @@ -47,7 +47,7 @@ class KeyClient(KeyVaultClientBase): @distributed_trace def create_key(self, name, key_type, **kwargs): # type: (str, Union[str, azure.keyvault.keys.KeyType], **Any) -> KeyVaultKey - """Create a key or, if `name` is already in use, create a new version of the key. + """Create a key or, if ``name`` is already in use, create a new version of the key. Requires keys/create permission. @@ -109,7 +109,7 @@ def create_key(self, name, key_type, **kwargs): @distributed_trace def create_rsa_key(self, name, **kwargs): # type: (str, **Any) -> KeyVaultKey - """Create a new RSA key or, if `name` is already in use, create a new version of the key + """Create a new RSA key or, if ``name`` is already in use, create a new version of the key Requires the keys/create permission. @@ -143,7 +143,7 @@ def create_rsa_key(self, name, **kwargs): @distributed_trace def create_ec_key(self, name, **kwargs): # type: (str, **Any) -> KeyVaultKey - """Create a new elliptic curve key or, if `name` is already in use, create a new version of the key. + """Create a new elliptic curve key or, if ``name`` is already in use, create a new version of the key. Requires the keys/create permission. @@ -177,7 +177,8 @@ def create_ec_key(self, name, **kwargs): @distributed_trace def create_oct_key(self, name, **kwargs): # type: (str, **Any) -> KeyVaultKey - """Create a new octet sequence (symmetric) key or, if `name` is already in use, create a new version of the key. + """Create a new octet sequence (symmetric) key or, if ``name`` is already in use, create a new version of the + key. Requires the keys/create permission. @@ -210,10 +211,11 @@ def create_oct_key(self, name, **kwargs): @distributed_trace def begin_delete_key(self, name, **kwargs): # type: (str, **Any) -> DeletedKey - """Delete all versions of a key and its cryptographic material. Requires keys/delete permission. + """Delete all versions of a key and its cryptographic material. - When this method returns Key Vault has begun deleting the key. Deletion may take several seconds in a vault - with soft-delete enabled. This method therefore returns a poller enabling you to wait for deletion to complete. + Requires keys/delete permission. When this method returns Key Vault has begun deleting the key. Deletion may + take several seconds in a vault with soft-delete enabled. This method therefore returns a poller enabling you to + wait for deletion to complete. :param str name: The name of the key to delete. :returns: A poller for the delete key operation. The poller's `result` method returns the @@ -254,7 +256,9 @@ def begin_delete_key(self, name, **kwargs): @distributed_trace def get_key(self, name, version=None, **kwargs): # type: (str, Optional[str], **Any) -> KeyVaultKey - """Get a key's attributes and, if it's an asymmetric key, its public material. Requires keys/get permission. + """Get a key's attributes and, if it's an asymmetric key, its public material. + + Requires keys/get permission. :param str name: The name of the key to get. :param str version: (optional) A specific version of the key to get. If not specified, gets the latest version @@ -278,7 +282,9 @@ def get_key(self, name, version=None, **kwargs): @distributed_trace def get_deleted_key(self, name, **kwargs): # type: (str, **Any) -> DeletedKey - """Get a deleted key. Possible only in a vault with soft-delete enabled. Requires keys/get permission. + """Get a deleted key. Possible only in a vault with soft-delete enabled. + + Requires keys/get permission. :param str name: The name of the key :returns: The deleted key @@ -327,7 +333,9 @@ def list_deleted_keys(self, **kwargs): @distributed_trace def list_properties_of_keys(self, **kwargs): # type: (**Any) -> ItemPaged[KeyProperties] - """List identifiers and properties of all keys in the vault. Requires keys/list permission. + """List identifiers and properties of all keys in the vault. + + Requires keys/list permission. :returns: An iterator of keys without their cryptographic material or version information :rtype: ~azure.core.paging.ItemPaged[~azure.keyvault.keys.KeyProperties] @@ -351,7 +359,9 @@ def list_properties_of_keys(self, **kwargs): @distributed_trace def list_properties_of_key_versions(self, name, **kwargs): # type: (str, **Any) -> ItemPaged[KeyProperties] - """List the identifiers and properties of a key's versions. Requires keys/list permission. + """List the identifiers and properties of a key's versions. + + Requires keys/list permission. :param str name: The name of the key :returns: An iterator of keys without their cryptographic material @@ -385,7 +395,6 @@ def purge_deleted_key(self, name, **kwargs): This method is only necessary for purging a key before its :py:attr:`~azure.keyvault.keys.DeletedKey.scheduled_purge_date`. - Requires keys/purge permission. :param str name: The name of the deleted key to purge @@ -448,7 +457,9 @@ def begin_recover_deleted_key(self, name, **kwargs): @distributed_trace def update_key_properties(self, name, version=None, **kwargs): # type: (str, Optional[str], **Any) -> KeyVaultKey - """Change a key's properties (not its cryptographic material). Requires keys/update permission. + """Change a key's properties (not its cryptographic material). + + Requires keys/update permission. :param str name: The name of key to update :param str version: (optional) The version of the key to update. If unspecified, the latest version is updated. @@ -500,7 +511,9 @@ def update_key_properties(self, name, version=None, **kwargs): @distributed_trace def backup_key(self, name, **kwargs): # type: (str, **Any) -> bytes - """Back up a key in a protected form useable only by Azure Key Vault. Requires keys/backup permission. + """Back up a key in a protected form useable only by Azure Key Vault. + + Requires keys/backup permission. This is intended to allow copying a key from one vault to another. Both vaults must be owned by the same Azure subscription. Also, backup / restore cannot be performed across geopolitical boundaries. For example, a backup @@ -526,7 +539,9 @@ def backup_key(self, name, **kwargs): @distributed_trace def restore_key_backup(self, backup, **kwargs): # type: (bytes, **Any) -> KeyVaultKey - """Restore a key backup to the vault. Requires keys/restore permission. + """Restore a key backup to the vault. + + Requires keys/restore permission. This imports all versions of the key, with its name, attributes, and access control policies. If the key's name is already in use, restoring it will fail. Also, the target vault must be owned by the same Microsoft Azure @@ -558,9 +573,9 @@ def restore_key_backup(self, backup, **kwargs): @distributed_trace def import_key(self, name, key, **kwargs): # type: (str, JsonWebKey, **Any) -> KeyVaultKey - """Import a key created externally. Requires keys/import permission. + """Import a key created externally. - If `name` is already in use, the key will be imported as a new version. + Requires keys/import permission. If ``name`` is already in use, the key will be imported as a new version. :param str name: Name for the imported key :param key: The JSON web key to import 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 80bf2b4de17a..0223d6cea3a6 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 @@ -45,7 +45,7 @@ class KeyClient(AsyncKeyVaultClientBase): @distributed_trace_async async def create_key(self, name: str, key_type: "Union[str, KeyType]", **kwargs: "Any") -> KeyVaultKey: - """Create a key or, if `name` is already in use, create a new version of the key. + """Create a key or, if ``name`` is already in use, create a new version of the key. Requires keys/create permission. @@ -107,7 +107,7 @@ async def create_key(self, name: str, key_type: "Union[str, KeyType]", **kwargs: @distributed_trace_async async def create_rsa_key(self, name: str, **kwargs: "Any") -> KeyVaultKey: - """Create a new RSA key or, if `name` is already in use, create a new version of the key + """Create a new RSA key or, if ``name`` is already in use, create a new version of the key Requires the keys/create permission. @@ -140,7 +140,7 @@ async def create_rsa_key(self, name: str, **kwargs: "Any") -> KeyVaultKey: @distributed_trace_async async def create_ec_key(self, name: str, **kwargs: "Any") -> KeyVaultKey: - """Create a new elliptic curve key or, if `name` is already in use, create a new version of the key. + """Create a new elliptic curve key or, if ``name`` is already in use, create a new version of the key. Requires the keys/create permission. @@ -173,7 +173,8 @@ async def create_ec_key(self, name: str, **kwargs: "Any") -> KeyVaultKey: @distributed_trace_async async def create_oct_key(self, name: str, **kwargs: "Any") -> KeyVaultKey: - """Create a new octet sequence (symmetric) key or, if `name` is already in use, create a new version of the key. + """Create a new octet sequence (symmetric) key or, if ``name`` is already in use, create a new version of the + key. Requires the keys/create permission. @@ -205,9 +206,10 @@ async def create_oct_key(self, name: str, **kwargs: "Any") -> KeyVaultKey: @distributed_trace_async async def delete_key(self, name: str, **kwargs: "Any") -> DeletedKey: - """Delete all versions of a key and its cryptographic material. Requires keys/delete permission. + """Delete all versions of a key and its cryptographic material. - If the vault has soft-delete enabled, deletion may take several seconds to complete. + Requires keys/delete permission. If the vault has soft-delete enabled, deletion may take several seconds to + complete. :param str name: The name of the key to delete :returns: The deleted key @@ -244,7 +246,9 @@ async def delete_key(self, name: str, **kwargs: "Any") -> DeletedKey: @distributed_trace_async async def get_key(self, name: str, version: "Optional[str]" = None, **kwargs: "Any") -> KeyVaultKey: - """Get a key's attributes and, if it's an asymmetric key, its public material. Requires keys/get permission. + """Get a key's attributes and, if it's an asymmetric key, its public material. + + Requires keys/get permission. :param str name: The name of the key to get. :param str version: (optional) A specific version of the key to get. If not specified, gets the latest version @@ -270,7 +274,9 @@ async def get_key(self, name: str, version: "Optional[str]" = None, **kwargs: "A @distributed_trace_async async def get_deleted_key(self, name: str, **kwargs: "Any") -> DeletedKey: - """Get a deleted key. Possible only in a vault with soft-delete enabled. Requires keys/get permission. + """Get a deleted key. Possible only in a vault with soft-delete enabled. + + Requires keys/get permission. :param str name: The name of the key :returns: The deleted key @@ -317,7 +323,9 @@ def list_deleted_keys(self, **kwargs: "Any") -> "AsyncItemPaged[DeletedKey]": @distributed_trace def list_properties_of_keys(self, **kwargs: "Any") -> "AsyncItemPaged[KeyProperties]": - """List identifiers and properties of all keys in the vault. Requires keys/list permission. + """List identifiers and properties of all keys in the vault. + + Requires keys/list permission. :returns: An iterator of keys without their cryptographic material or version information :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.keyvault.keys.KeyProperties] @@ -340,7 +348,9 @@ def list_properties_of_keys(self, **kwargs: "Any") -> "AsyncItemPaged[KeyPropert @distributed_trace def list_properties_of_key_versions(self, name: str, **kwargs: "Any") -> "AsyncItemPaged[KeyProperties]": - """List the identifiers and properties of a key's versions. Requires keys/list permission. + """List the identifiers and properties of a key's versions. + + Requires keys/list permission. :param str name: The name of the key :returns: An iterator of keys without their cryptographic material @@ -427,7 +437,9 @@ async def recover_deleted_key(self, name: str, **kwargs: "Any") -> KeyVaultKey: @distributed_trace_async async def update_key_properties(self, name: str, version: "Optional[str]" = None, **kwargs: "Any") -> KeyVaultKey: - """Change a key's properties (not its cryptographic material). Requires keys/update permission. + """Change a key's properties (not its cryptographic material). + + Requires keys/update permission. :param str name: The name of key to update :param str version: (optional) The version of the key to update. If unspecified, the latest version is updated. @@ -478,7 +490,9 @@ async def update_key_properties(self, name: str, version: "Optional[str]" = None @distributed_trace_async async def backup_key(self, name: str, **kwargs: "Any") -> bytes: - """Back up a key in a protected form useable only by Azure Key Vault. Requires key/backup permission. + """Back up a key in a protected form useable only by Azure Key Vault. + + Requires key/backup permission. This is intended to allow copying a key from one vault to another. Both vaults must be owned by the same Azure subscription. Also, backup / restore cannot be performed across geopolitical boundaries. For example, a backup @@ -503,7 +517,9 @@ async def backup_key(self, name: str, **kwargs: "Any") -> bytes: @distributed_trace_async async def restore_key_backup(self, backup: bytes, **kwargs: "Any") -> KeyVaultKey: - """Restore a key backup to the vault. Requires keys/restore permission. + """Restore a key backup to the vault. + + Requires keys/restore permission. This imports all versions of the key, with its name, attributes, and access control policies. If the key's name is already in use, restoring it will fail. Also, the target vault must be owned by the same Microsoft Azure @@ -534,9 +550,9 @@ async def restore_key_backup(self, backup: bytes, **kwargs: "Any") -> KeyVaultKe @distributed_trace_async async def import_key(self, name: str, key: JsonWebKey, **kwargs: "Any") -> KeyVaultKey: - """Import a key created externally. Requires keys/import permission. + """Import a key created externally. - If `name` is already in use, the key will be imported as a new version. + Requires keys/import permission. If ``name`` is already in use, the key will be imported as a new version. :param str name: Name for the imported key :param key: The JSON web key to import diff --git a/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/crypto/_client.py b/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/crypto/_client.py index a9e9222e9315..c577ae69c471 100644 --- a/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/crypto/_client.py +++ b/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/crypto/_client.py @@ -210,9 +210,10 @@ def _initialize(self, **kwargs): @distributed_trace def encrypt(self, algorithm, plaintext, **kwargs): # type: (EncryptionAlgorithm, bytes, **Any) -> EncryptResult - """Encrypt bytes using the client's key. Requires the keys/encrypt permission. + """Encrypt bytes using the client's key. - This method encrypts only a single block of data, whose size depends on the key and encryption algorithm. + Requires the keys/encrypt permission. This method encrypts only a single block of data, whose size depends on + the key and encryption algorithm. :param algorithm: encryption algorithm to use :type algorithm: :class:`~azure.keyvault.keys.crypto.EncryptionAlgorithm` @@ -268,9 +269,10 @@ def encrypt(self, algorithm, plaintext, **kwargs): @distributed_trace def decrypt(self, algorithm, ciphertext, **kwargs): # type: (EncryptionAlgorithm, bytes, **Any) -> DecryptResult - """Decrypt a single block of encrypted data using the client's key. Requires the keys/decrypt permission. + """Decrypt a single block of encrypted data using the client's key. - This method decrypts only a single block of data, whose size depends on the key and encryption algorithm. + Requires the keys/decrypt permission. This method decrypts only a single block of data, whose size depends on + the key and encryption algorithm. :param algorithm: encryption algorithm to use :type algorithm: :class:`~azure.keyvault.keys.crypto.EncryptionAlgorithm` @@ -323,7 +325,9 @@ def decrypt(self, algorithm, ciphertext, **kwargs): @distributed_trace def wrap_key(self, algorithm, key, **kwargs): # type: (KeyWrapAlgorithm, bytes, **Any) -> WrapResult - """Wrap a key with the client's key. Requires the keys/wrapKey permission. + """Wrap a key with the client's key. + + Requires the keys/wrapKey permission. :param algorithm: wrapping algorithm to use :type algorithm: :class:`~azure.keyvault.keys.crypto.KeyWrapAlgorithm` @@ -364,7 +368,9 @@ def wrap_key(self, algorithm, key, **kwargs): @distributed_trace def unwrap_key(self, algorithm, encrypted_key, **kwargs): # type: (KeyWrapAlgorithm, bytes, **Any) -> UnwrapResult - """Unwrap a key previously wrapped with the client's key. Requires the keys/unwrapKey permission. + """Unwrap a key previously wrapped with the client's key. + + Requires the keys/unwrapKey permission. :param algorithm: wrapping algorithm to use :type algorithm: :class:`~azure.keyvault.keys.crypto.KeyWrapAlgorithm` @@ -403,7 +409,9 @@ def unwrap_key(self, algorithm, encrypted_key, **kwargs): @distributed_trace def sign(self, algorithm, digest, **kwargs): # type: (SignatureAlgorithm, bytes, **Any) -> SignResult - """Create a signature from a digest using the client's key. Requires the keys/sign permission. + """Create a signature from a digest using the client's key. + + Requires the keys/sign permission. :param algorithm: signing algorithm :type algorithm: :class:`~azure.keyvault.keys.crypto.SignatureAlgorithm` @@ -444,7 +452,9 @@ def sign(self, algorithm, digest, **kwargs): @distributed_trace def verify(self, algorithm, digest, signature, **kwargs): # type: (SignatureAlgorithm, bytes, bytes, **Any) -> VerifyResult - """Verify a signature using the client's key. Requires the keys/verify permission. + """Verify a signature using the client's key. + + Requires the keys/verify permission. :param algorithm: verification algorithm :type algorithm: :class:`~azure.keyvault.keys.crypto.SignatureAlgorithm` diff --git a/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/crypto/aio/_client.py b/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/crypto/aio/_client.py index 2b1597232e0e..ffda9d3d06f8 100644 --- a/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/crypto/aio/_client.py +++ b/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/crypto/aio/_client.py @@ -153,9 +153,10 @@ async def _initialize(self, **kwargs): @distributed_trace_async async def encrypt(self, algorithm: "EncryptionAlgorithm", plaintext: bytes, **kwargs: "Any") -> EncryptResult: - """Encrypt bytes using the client's key. Requires the keys/encrypt permission. + """Encrypt bytes using the client's key. - This method encrypts only a single block of data, whose size depends on the key and encryption algorithm. + Requires the keys/encrypt permission. This method encrypts only a single block of data, whose size depends on + the key and encryption algorithm. :param algorithm: encryption algorithm to use :type algorithm: :class:`~azure.keyvault.keys.crypto.EncryptionAlgorithm` @@ -210,9 +211,10 @@ async def encrypt(self, algorithm: "EncryptionAlgorithm", plaintext: bytes, **kw @distributed_trace_async async def decrypt(self, algorithm: "EncryptionAlgorithm", ciphertext: bytes, **kwargs: "Any") -> DecryptResult: - """Decrypt a single block of encrypted data using the client's key. Requires the keys/decrypt permission. + """Decrypt a single block of encrypted data using the client's key. - This method decrypts only a single block of data, whose size depends on the key and encryption algorithm. + Requires the keys/decrypt permission. This method decrypts only a single block of data, whose size depends on + the key and encryption algorithm. :param algorithm: encryption algorithm to use :type algorithm: :class:`~azure.keyvault.keys.crypto.EncryptionAlgorithm` @@ -264,7 +266,9 @@ async def decrypt(self, algorithm: "EncryptionAlgorithm", ciphertext: bytes, **k @distributed_trace_async async def wrap_key(self, algorithm: "KeyWrapAlgorithm", key: bytes, **kwargs: "Any") -> WrapResult: - """Wrap a key with the client's key. Requires the keys/wrapKey permission. + """Wrap a key with the client's key. + + Requires the keys/wrapKey permission. :param algorithm: wrapping algorithm to use :type algorithm: :class:`~azure.keyvault.keys.crypto.KeyWrapAlgorithm` @@ -304,7 +308,9 @@ async def wrap_key(self, algorithm: "KeyWrapAlgorithm", key: bytes, **kwargs: "A @distributed_trace_async async def unwrap_key(self, algorithm: "KeyWrapAlgorithm", encrypted_key: bytes, **kwargs: "Any") -> UnwrapResult: - """Unwrap a key previously wrapped with the client's key. Requires the keys/unwrapKey permission. + """Unwrap a key previously wrapped with the client's key. + + Requires the keys/unwrapKey permission. :param algorithm: wrapping algorithm to use :type algorithm: :class:`~azure.keyvault.keys.crypto.KeyWrapAlgorithm` @@ -343,7 +349,9 @@ async def unwrap_key(self, algorithm: "KeyWrapAlgorithm", encrypted_key: bytes, @distributed_trace_async async def sign(self, algorithm: "SignatureAlgorithm", digest: bytes, **kwargs: "Any") -> SignResult: - """Create a signature from a digest using the client's key. Requires the keys/sign permission. + """Create a signature from a digest using the client's key. + + Requires the keys/sign permission. :param algorithm: signing algorithm :type algorithm: :class:`~azure.keyvault.keys.crypto.SignatureAlgorithm` @@ -385,7 +393,9 @@ async def sign(self, algorithm: "SignatureAlgorithm", digest: bytes, **kwargs: " async def verify( self, algorithm: "SignatureAlgorithm", digest: bytes, signature: bytes, **kwargs: "Any" ) -> VerifyResult: - """Verify a signature using the client's key. Requires the keys/verify permission. + """Verify a signature using the client's key. + + Requires the keys/verify permission. :param algorithm: verification algorithm :type algorithm: :class:`~azure.keyvault.keys.crypto.SignatureAlgorithm` From 544f2efa41a26b4bafd7f9e05c6b05f0c0c22dcc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?McCoy=20Pati=C3=B1o?= Date: Mon, 7 Jun 2021 11:31:39 -0700 Subject: [PATCH 3/4] Appease pylint --- .../azure-keyvault-keys/azure/keyvault/keys/aio/_client.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 0223d6cea3a6..5774770e1f1f 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 @@ -550,7 +550,7 @@ async def restore_key_backup(self, backup: bytes, **kwargs: "Any") -> KeyVaultKe @distributed_trace_async async def import_key(self, name: str, key: JsonWebKey, **kwargs: "Any") -> KeyVaultKey: - """Import a key created externally. + """Import a key created externally. Requires keys/import permission. If ``name`` is already in use, the key will be imported as a new version. From 268fa96e6568b7afe67e6c674272804733958e58 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?McCoy=20Pati=C3=B1o?= <39780829+mccoyp@users.noreply.github.com> Date: Mon, 7 Jun 2021 14:33:14 -0700 Subject: [PATCH 4/4] Thanks, Charles! Co-authored-by: Charles Lowell --- .../azure-keyvault-keys/azure/keyvault/keys/_client.py | 3 +-- .../azure-keyvault-keys/azure/keyvault/keys/aio/_client.py | 3 +-- 2 files changed, 2 insertions(+), 4 deletions(-) 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 9e439d7560ed..e04ea0a31b4e 100644 --- a/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/_client.py +++ b/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/_client.py @@ -177,8 +177,7 @@ def create_ec_key(self, name, **kwargs): @distributed_trace def create_oct_key(self, name, **kwargs): # type: (str, **Any) -> KeyVaultKey - """Create a new octet sequence (symmetric) key or, if ``name`` is already in use, create a new version of the - key. + """Create a new octet sequence (symmetric) key or, if ``name`` is in use, create a new version of the key. Requires the keys/create permission. 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 5774770e1f1f..afe86c18bf0b 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 @@ -173,8 +173,7 @@ async def create_ec_key(self, name: str, **kwargs: "Any") -> KeyVaultKey: @distributed_trace_async async def create_oct_key(self, name: str, **kwargs: "Any") -> KeyVaultKey: - """Create a new octet sequence (symmetric) key or, if ``name`` is already in use, create a new version of the - key. + """Create a new octet sequence (symmetric) key or, if ``name`` is in use, create a new version of the key. Requires the keys/create permission.