Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Key Vault] Generate Keys with TypeSpec #36902

Draft
wants to merge 6 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Update for latest TSP
  • Loading branch information
mccoyp committed Nov 1, 2024
commit 45eef08b49a62fa82c2b1d8321b76e253089c8a8
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,10 @@ class JsonWebKeyEncryptionAlgorithm(str, Enum, metaclass=CaseInsensitiveEnumMeta
"""192-bit AES-CBC with PKCS padding."""
A256_CBCPAD = "A256CBCPAD"
"""256-bit AES-CBC with PKCS padding."""
CKM_AES_KEY_WRAP = "CKM_AES_KEY_WRAP"
"""CKM AES key wrap."""
CKM_AES_KEY_WRAP_PAD = "CKM_AES_KEY_WRAP_PAD"
"""CKM AES key wrap with padding."""


class JsonWebKeyOperation(str, Enum, metaclass=CaseInsensitiveEnumMeta):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ class DeletedKeyItem(_model_base.Model):
:vartype deleted_date: ~datetime.datetime
"""

kid: str = rest_field()
kid: str = rest_field(visibility=["read"])
"""Key identifier. Required."""
attributes: Optional["_models.KeyAttributes"] = rest_field()
"""The key management attributes."""
Expand All @@ -149,7 +149,6 @@ class DeletedKeyItem(_model_base.Model):
def __init__(
self,
*,
kid: str,
attributes: Optional["_models.KeyAttributes"] = None,
tags: Optional[Dict[str, str]] = None,
recovery_id: Optional[str] = None,
Expand Down Expand Up @@ -205,7 +204,8 @@ class JsonWebKey(_model_base.Model): # pylint: disable=too-many-instance-attrib
https://tools.ietf.org/html/draft-ietf-jose-json-web-algorithms-40. Known values are: "EC",
"EC-HSM", "RSA", "RSA-HSM", "oct", and "oct-HSM".
:vartype kty: str or ~azure.keyvault.keys.models.JsonWebKeyType
:ivar key_ops:
:ivar key_ops: Json web key operations. For more information on possible key operations, see
JsonWebKeyOperation.
:vartype key_ops: list[str]
:ivar n: RSA modulus.
:vartype n: bytes
Expand Down Expand Up @@ -243,6 +243,8 @@ class JsonWebKey(_model_base.Model): # pylint: disable=too-many-instance-attrib
https://tools.ietf.org/html/draft-ietf-jose-json-web-algorithms-40. Known values are: \"EC\",
\"EC-HSM\", \"RSA\", \"RSA-HSM\", \"oct\", and \"oct-HSM\"."""
key_ops: Optional[List[str]] = rest_field()
"""Json web key operations. For more information on possible key operations, see
JsonWebKeyOperation."""
n: Optional[bytes] = rest_field(format="base64url")
"""RSA modulus."""
e: Optional[bytes] = rest_field(format="base64url")
Expand Down Expand Up @@ -449,7 +451,8 @@ class KeyCreateParameters(_model_base.Model):
:vartype key_size: int
:ivar public_exponent: The public exponent for a RSA key.
:vartype public_exponent: int
:ivar key_ops:
:ivar key_ops: Json web key operations. For more information on possible key operations, see
JsonWebKeyOperation.
:vartype key_ops: list[str or ~azure.keyvault.keys.models.JsonWebKeyOperation]
:ivar key_attributes: The attributes of a key managed by the key vault service.
:vartype key_attributes: ~azure.keyvault.keys.models.KeyAttributes
Expand All @@ -470,6 +473,8 @@ class KeyCreateParameters(_model_base.Model):
public_exponent: Optional[int] = rest_field()
"""The public exponent for a RSA key."""
key_ops: Optional[List[Union[str, "_models.JsonWebKeyOperation"]]] = rest_field()
"""Json web key operations. For more information on possible key operations, see
JsonWebKeyOperation."""
key_attributes: Optional["_models.KeyAttributes"] = rest_field(name="attributes")
"""The attributes of a key managed by the key vault service."""
tags: Optional[Dict[str, str]] = rest_field()
Expand Down Expand Up @@ -572,7 +577,7 @@ class KeyItem(_model_base.Model):
:vartype managed: bool
"""

kid: str = rest_field()
kid: str = rest_field(visibility=["read"])
"""Key identifier. Required."""
attributes: Optional["_models.KeyAttributes"] = rest_field()
"""The key management attributes."""
Expand All @@ -586,7 +591,6 @@ class KeyItem(_model_base.Model):
def __init__(
self,
*,
kid: str,
attributes: Optional["_models.KeyAttributes"] = None,
tags: Optional[Dict[str, str]] = None,
): ...
Expand All @@ -609,22 +613,34 @@ class KeyOperationResult(_model_base.Model):

:ivar kid: Key identifier.
:vartype kid: str
:ivar result:
:ivar result: The result of the operation.
:vartype result: bytes
:ivar iv:
:ivar iv: Cryptographically random, non-repeating initialization vector for symmetric
algorithms.
:vartype iv: bytes
:ivar authentication_tag:
:ivar authentication_tag: The tag to authenticate when performing decryption with an
authenticated
algorithm.
:vartype authentication_tag: bytes
:ivar additional_authenticated_data:
:ivar additional_authenticated_data: Additional data to authenticate but not encrypt/decrypt
when using
authenticated crypto algorithms.
:vartype additional_authenticated_data: bytes
"""

kid: Optional[str] = rest_field(visibility=["read"])
"""Key identifier."""
result: Optional[bytes] = rest_field(name="value", visibility=["read"], format="base64url")
"""The result of the operation."""
iv: Optional[bytes] = rest_field(visibility=["read"], format="base64url")
"""Cryptographically random, non-repeating initialization vector for symmetric
algorithms."""
authentication_tag: Optional[bytes] = rest_field(name="tag", visibility=["read"], format="base64url")
"""The tag to authenticate when performing decryption with an authenticated
algorithm."""
additional_authenticated_data: Optional[bytes] = rest_field(name="aad", visibility=["read"], format="base64url")
"""Additional data to authenticate but not encrypt/decrypt when using
authenticated crypto algorithms."""


class KeyOperationsParameters(_model_base.Model):
Expand All @@ -634,9 +650,10 @@ class KeyOperationsParameters(_model_base.Model):

:ivar algorithm: algorithm identifier. Required. Known values are: "RSA-OAEP", "RSA-OAEP-256",
"RSA1_5", "A128GCM", "A192GCM", "A256GCM", "A128KW", "A192KW", "A256KW", "A128CBC", "A192CBC",
"A256CBC", "A128CBCPAD", "A192CBCPAD", and "A256CBCPAD".
"A256CBC", "A128CBCPAD", "A192CBCPAD", "A256CBCPAD", "CKM_AES_KEY_WRAP", and
"CKM_AES_KEY_WRAP_PAD".
:vartype algorithm: str or ~azure.keyvault.keys.models.JsonWebKeyEncryptionAlgorithm
:ivar value: Required.
:ivar value: The value to operate on. Required.
:vartype value: bytes
:ivar iv: Cryptographically random, non-repeating initialization vector for symmetric
algorithms.
Expand All @@ -652,9 +669,10 @@ class KeyOperationsParameters(_model_base.Model):
algorithm: Union[str, "_models.JsonWebKeyEncryptionAlgorithm"] = rest_field(name="alg")
"""algorithm identifier. Required. Known values are: \"RSA-OAEP\", \"RSA-OAEP-256\", \"RSA1_5\",
\"A128GCM\", \"A192GCM\", \"A256GCM\", \"A128KW\", \"A192KW\", \"A256KW\", \"A128CBC\",
\"A192CBC\", \"A256CBC\", \"A128CBCPAD\", \"A192CBCPAD\", and \"A256CBCPAD\"."""
\"A192CBC\", \"A256CBC\", \"A128CBCPAD\", \"A192CBCPAD\", \"A256CBCPAD\", \"CKM_AES_KEY_WRAP\",
and \"CKM_AES_KEY_WRAP_PAD\"."""
value: bytes = rest_field(format="base64url")
"""Required."""
"""The value to operate on. Required."""
iv: Optional[bytes] = rest_field(format="base64url")
"""Cryptographically random, non-repeating initialization vector for symmetric
algorithms."""
Expand Down Expand Up @@ -915,7 +933,7 @@ class KeySignParameters(_model_base.Model):
algorithm types, see JsonWebKeySignatureAlgorithm. Required. Known values are: "PS256",
"PS384", "PS512", "RS256", "RS384", "RS512", "RSNULL", "ES256", "ES384", "ES512", and "ES256K".
:vartype algorithm: str or ~azure.keyvault.keys.models.JsonWebKeySignatureAlgorithm
:ivar value: Required.
:ivar value: The value to operate on. Required.
:vartype value: bytes
"""

Expand All @@ -925,7 +943,7 @@ class KeySignParameters(_model_base.Model):
\"PS384\", \"PS512\", \"RS256\", \"RS384\", \"RS512\", \"RSNULL\", \"ES256\", \"ES384\",
\"ES512\", and \"ES256K\"."""
value: bytes = rest_field(format="base64url")
"""Required."""
"""The value to operate on. Required."""

@overload
def __init__(
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
directory: specification/keyvault/data-plane/Security.KeyVault.Keys
commit: 85ce1b2a7e94840ba4923f6f0d230a5262e93b69
directory: specification/keyvault/Security.KeyVault.Keys
commit: 19a075a64b52d269476d795311e6401aeb963e36
repo: Azure/azure-rest-api-specs
additionalDirectories:
Loading