KeyVaultKey Class

A key's attributes and cryptographic material.

Providing cryptographic material as keyword arguments:


   from azure.keyvault.keys.models import KeyVaultKey

   key_id = 'https://myvault.vault.azure.net/keys/my-key/my-key-version'
   key_bytes = os.urandom(32)
   key = KeyVaultKey(key_id, k=key_bytes, kty='oct', key_ops=['unwrapKey', 'wrapKey'])

Providing cryptographic material as a dictionary:


   from azure.keyvault.keys.models import KeyVaultKey

   key_id = 'https://myvault.vault.azure.net/keys/my-key/my-key-version'
   key_bytes = os.urandom(32)
   jwk = {'k': key_bytes, 'kty': 'oct', 'key_ops': ['unwrapKey', 'wrapKey']}
   key = KeyVaultKey(key_id, jwk=jwk)
Inheritance
builtins.object
KeyVaultKey

Constructor

KeyVaultKey(key_id: str, jwk: Dict[str, Any] | None = None, **kwargs)

Parameters

Name Description
key_id
Required
str

Key Vault's identifier for the key. Typically a URI, e.g. https://myvault.vault.azure.net/keys/my-key/version

jwk

The key's cryptographic material as a JSON Web Key (https://tools.ietf.org/html/rfc7517). This may be provided as a dictionary or keyword arguments. See <xref:azure.keyvault.keys.models.JsonWebKey> for field names.

Default value: None

Attributes

id

The key ID.

Returns

Type Description
str

The key ID.

key

The JSON Web Key (JWK) for the key.

Returns

Type Description

The JSON Web Key (JWK) for the key.

key_operations

Permitted operations. See KeyOperation for possible values.

Returns

Type Description
str]

Permitted operations. See KeyOperation for possible values.

key_type

The key's type. See KeyType for possible values.

Returns

Type Description
str

The key's type. See KeyType for possible values.

name

The key name.

Returns

Type Description
str

The key name.

properties

The key properties.

Returns

Type Description

The key properties.