Skip to content
This repository was archived by the owner on Aug 26, 2025. It is now read-only.
Closed
Show file tree
Hide file tree
Changes from all commits
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
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@
from ._models_py3 import AttestationProviderListResult
from ._models_py3 import AttestationServiceCreationParams
from ._models_py3 import AzureEntityResource
from ._models_py3 import JSONWebKey
from ._models_py3 import JSONWebKeySet
from ._models_py3 import OperationList
from ._models_py3 import OperationsDefinition
from ._models_py3 import OperationsDisplayDefinition
Expand All @@ -25,6 +27,8 @@
from ._models import AttestationProviderListResult
from ._models import AttestationServiceCreationParams
from ._models import AzureEntityResource
from ._models import JSONWebKey
from ._models import JSONWebKeySet
from ._models import OperationList
from ._models import OperationsDefinition
from ._models import OperationsDisplayDefinition
Expand All @@ -40,6 +44,8 @@
'AttestationProviderListResult',
'AttestationServiceCreationParams',
'AzureEntityResource',
'JSONWebKey',
'JSONWebKeySet',
'OperationList',
'OperationsDefinition',
'OperationsDisplayDefinition',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -114,15 +114,22 @@ class AttestationServiceCreationParams(Model):

:param attestation_policy: Name of attestation policy.
:type attestation_policy: str
:param policy_signing_certificates: JSON Web Key Set defining a set of
X.509 Certificates that will represent the parent certificate for the
signing certificate used for policy operations
:type policy_signing_certificates:
~azure.mgmt.attestation.models.JSONWebKeySet
"""

_attribute_map = {
'attestation_policy': {'key': 'attestationPolicy', 'type': 'str'},
'policy_signing_certificates': {'key': 'policySigningCertificates', 'type': 'JSONWebKeySet'},
}

def __init__(self, **kwargs):
super(AttestationServiceCreationParams, self).__init__(**kwargs)
self.attestation_policy = kwargs.get('attestation_policy', None)
self.policy_signing_certificates = kwargs.get('policy_signing_certificates', None)


class AzureEntityResource(Resource):
Expand Down Expand Up @@ -213,6 +220,146 @@ def __init__(self, **kwargs):
self.message = kwargs.get('message', None)


class JSONWebKey(Model):
"""JSONWebKey.

All required parameters must be populated in order to send to Azure.

:param alg: Required. The "alg" (algorithm) parameter identifies the
algorithm intended for
use with the key. The values used should either be registered in the
IANA "JSON Web Signature and Encryption Algorithms" registry
established by [JWA] or be a value that contains a Collision-
Resistant Name.
:type alg: str
:param crv: The "crv" (curve) parameter identifies the curve type
:type crv: str
:param d: RSA private exponent or ECC private key
:type d: str
:param dp: RSA Private Key Parameter
:type dp: str
:param dq: RSA Private Key Parameter
:type dq: str
:param e: RSA public exponent, in Base64
:type e: str
:param k: Symmetric key
:type k: str
:param kid: Required. The "kid" (key ID) parameter is used to match a
specific key. This
is used, for instance, to choose among a set of keys within a JWK Set
during key rollover. The structure of the "kid" value is
unspecified. When "kid" values are used within a JWK Set, different
keys within the JWK Set SHOULD use distinct "kid" values. (One
example in which different keys might use the same "kid" value is if
they have different "kty" (key type) values but are considered to be
equivalent alternatives by the application using them.) The "kid"
value is a case-sensitive string.
:type kid: str
:param kty: Required. The "kty" (key type) parameter identifies the
cryptographic algorithm
family used with the key, such as "RSA" or "EC". "kty" values should
either be registered in the IANA "JSON Web Key Types" registry
established by [JWA] or be a value that contains a Collision-
Resistant Name. The "kty" value is a case-sensitive string.
:type kty: str
:param n: RSA modulus, in Base64
:type n: str
:param p: RSA secret prime
:type p: str
:param q: RSA secret prime, with p < q
:type q: str
:param qi: RSA Private Key Parameter
:type qi: str
:param use: Required. Use ("public key use") identifies the intended use
of
the public key. The "use" parameter is employed to indicate whether
a public key is used for encrypting data or verifying the signature
on data. Values are commonly "sig" (signature) or "enc" (encryption).
:type use: str
:param x: X coordinate for the Elliptic Curve point
:type x: str
:param x5c: The "x5c" (X.509 certificate chain) parameter contains a chain
of one
or more PKIX certificates [RFC5280]. The certificate chain is
represented as a JSON array of certificate value strings. Each
string in the array is a base64-encoded (Section 4 of [RFC4648] --
not base64url-encoded) DER [ITU.X690.1994] PKIX certificate value.
The PKIX certificate containing the key value MUST be the first
certificate.
:type x5c: list[str]
:param y: Y coordinate for the Elliptic Curve point
:type y: str
"""

_validation = {
'alg': {'required': True},
'kid': {'required': True},
'kty': {'required': True},
'use': {'required': True},
}

_attribute_map = {
'alg': {'key': 'alg', 'type': 'str'},
'crv': {'key': 'crv', 'type': 'str'},
'd': {'key': 'd', 'type': 'str'},
'dp': {'key': 'dp', 'type': 'str'},
'dq': {'key': 'dq', 'type': 'str'},
'e': {'key': 'e', 'type': 'str'},
'k': {'key': 'k', 'type': 'str'},
'kid': {'key': 'kid', 'type': 'str'},
'kty': {'key': 'kty', 'type': 'str'},
'n': {'key': 'n', 'type': 'str'},
'p': {'key': 'p', 'type': 'str'},
'q': {'key': 'q', 'type': 'str'},
'qi': {'key': 'qi', 'type': 'str'},
'use': {'key': 'use', 'type': 'str'},
'x': {'key': 'x', 'type': 'str'},
'x5c': {'key': 'x5c', 'type': '[str]'},
'y': {'key': 'y', 'type': 'str'},
}

def __init__(self, **kwargs):
super(JSONWebKey, self).__init__(**kwargs)
self.alg = kwargs.get('alg', None)
self.crv = kwargs.get('crv', None)
self.d = kwargs.get('d', None)
self.dp = kwargs.get('dp', None)
self.dq = kwargs.get('dq', None)
self.e = kwargs.get('e', None)
self.k = kwargs.get('k', None)
self.kid = kwargs.get('kid', None)
self.kty = kwargs.get('kty', None)
self.n = kwargs.get('n', None)
self.p = kwargs.get('p', None)
self.q = kwargs.get('q', None)
self.qi = kwargs.get('qi', None)
self.use = kwargs.get('use', None)
self.x = kwargs.get('x', None)
self.x5c = kwargs.get('x5c', None)
self.y = kwargs.get('y', None)


class JSONWebKeySet(Model):
"""JSONWebKeySet.

:param keys: The value of the "keys" parameter is an array of JWK values.
By
default, the order of the JWK values within the array does not imply
an order of preference among them, although applications of JWK Sets
can choose to assign a meaning to the order for their purposes, if
desired.
:type keys: list[~azure.mgmt.attestation.models.JSONWebKey]
"""

_attribute_map = {
'keys': {'key': 'keys', 'type': '[JSONWebKey]'},
}

def __init__(self, **kwargs):
super(JSONWebKeySet, self).__init__(**kwargs)
self.keys = kwargs.get('keys', None)


class OperationList(Model):
"""List of supported operations.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -114,15 +114,22 @@ class AttestationServiceCreationParams(Model):

:param attestation_policy: Name of attestation policy.
:type attestation_policy: str
:param policy_signing_certificates: JSON Web Key Set defining a set of
X.509 Certificates that will represent the parent certificate for the
signing certificate used for policy operations
:type policy_signing_certificates:
~azure.mgmt.attestation.models.JSONWebKeySet
"""

_attribute_map = {
'attestation_policy': {'key': 'attestationPolicy', 'type': 'str'},
'policy_signing_certificates': {'key': 'policySigningCertificates', 'type': 'JSONWebKeySet'},
}

def __init__(self, *, attestation_policy: str=None, **kwargs) -> None:
def __init__(self, *, attestation_policy: str=None, policy_signing_certificates=None, **kwargs) -> None:
super(AttestationServiceCreationParams, self).__init__(**kwargs)
self.attestation_policy = attestation_policy
self.policy_signing_certificates = policy_signing_certificates


class AzureEntityResource(Resource):
Expand Down Expand Up @@ -213,6 +220,146 @@ def __init__(self, *, code: str=None, message: str=None, **kwargs) -> None:
self.message = message


class JSONWebKey(Model):
"""JSONWebKey.

All required parameters must be populated in order to send to Azure.

:param alg: Required. The "alg" (algorithm) parameter identifies the
algorithm intended for
use with the key. The values used should either be registered in the
IANA "JSON Web Signature and Encryption Algorithms" registry
established by [JWA] or be a value that contains a Collision-
Resistant Name.
:type alg: str
:param crv: The "crv" (curve) parameter identifies the curve type
:type crv: str
:param d: RSA private exponent or ECC private key
:type d: str
:param dp: RSA Private Key Parameter
:type dp: str
:param dq: RSA Private Key Parameter
:type dq: str
:param e: RSA public exponent, in Base64
:type e: str
:param k: Symmetric key
:type k: str
:param kid: Required. The "kid" (key ID) parameter is used to match a
specific key. This
is used, for instance, to choose among a set of keys within a JWK Set
during key rollover. The structure of the "kid" value is
unspecified. When "kid" values are used within a JWK Set, different
keys within the JWK Set SHOULD use distinct "kid" values. (One
example in which different keys might use the same "kid" value is if
they have different "kty" (key type) values but are considered to be
equivalent alternatives by the application using them.) The "kid"
value is a case-sensitive string.
:type kid: str
:param kty: Required. The "kty" (key type) parameter identifies the
cryptographic algorithm
family used with the key, such as "RSA" or "EC". "kty" values should
either be registered in the IANA "JSON Web Key Types" registry
established by [JWA] or be a value that contains a Collision-
Resistant Name. The "kty" value is a case-sensitive string.
:type kty: str
:param n: RSA modulus, in Base64
:type n: str
:param p: RSA secret prime
:type p: str
:param q: RSA secret prime, with p < q
:type q: str
:param qi: RSA Private Key Parameter
:type qi: str
:param use: Required. Use ("public key use") identifies the intended use
of
the public key. The "use" parameter is employed to indicate whether
a public key is used for encrypting data or verifying the signature
on data. Values are commonly "sig" (signature) or "enc" (encryption).
:type use: str
:param x: X coordinate for the Elliptic Curve point
:type x: str
:param x5c: The "x5c" (X.509 certificate chain) parameter contains a chain
of one
or more PKIX certificates [RFC5280]. The certificate chain is
represented as a JSON array of certificate value strings. Each
string in the array is a base64-encoded (Section 4 of [RFC4648] --
not base64url-encoded) DER [ITU.X690.1994] PKIX certificate value.
The PKIX certificate containing the key value MUST be the first
certificate.
:type x5c: list[str]
:param y: Y coordinate for the Elliptic Curve point
:type y: str
"""

_validation = {
'alg': {'required': True},
'kid': {'required': True},
'kty': {'required': True},
'use': {'required': True},
}

_attribute_map = {
'alg': {'key': 'alg', 'type': 'str'},
'crv': {'key': 'crv', 'type': 'str'},
'd': {'key': 'd', 'type': 'str'},
'dp': {'key': 'dp', 'type': 'str'},
'dq': {'key': 'dq', 'type': 'str'},
'e': {'key': 'e', 'type': 'str'},
'k': {'key': 'k', 'type': 'str'},
'kid': {'key': 'kid', 'type': 'str'},
'kty': {'key': 'kty', 'type': 'str'},
'n': {'key': 'n', 'type': 'str'},
'p': {'key': 'p', 'type': 'str'},
'q': {'key': 'q', 'type': 'str'},
'qi': {'key': 'qi', 'type': 'str'},
'use': {'key': 'use', 'type': 'str'},
'x': {'key': 'x', 'type': 'str'},
'x5c': {'key': 'x5c', 'type': '[str]'},
'y': {'key': 'y', 'type': 'str'},
}

def __init__(self, *, alg: str, kid: str, kty: str, use: str, crv: str=None, d: str=None, dp: str=None, dq: str=None, e: str=None, k: str=None, n: str=None, p: str=None, q: str=None, qi: str=None, x: str=None, x5c=None, y: str=None, **kwargs) -> None:
super(JSONWebKey, self).__init__(**kwargs)
self.alg = alg
self.crv = crv
self.d = d
self.dp = dp
self.dq = dq
self.e = e
self.k = k
self.kid = kid
self.kty = kty
self.n = n
self.p = p
self.q = q
self.qi = qi
self.use = use
self.x = x
self.x5c = x5c
self.y = y


class JSONWebKeySet(Model):
"""JSONWebKeySet.

:param keys: The value of the "keys" parameter is an array of JWK values.
By
default, the order of the JWK values within the array does not imply
an order of preference among them, although applications of JWK Sets
can choose to assign a meaning to the order for their purposes, if
desired.
:type keys: list[~azure.mgmt.attestation.models.JSONWebKey]
"""

_attribute_map = {
'keys': {'key': 'keys', 'type': '[JSONWebKey]'},
}

def __init__(self, *, keys=None, **kwargs) -> None:
super(JSONWebKeySet, self).__init__(**kwargs)
self.keys = keys


class OperationList(Model):
"""List of supported operations.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ def get(
get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Attestation/attestationProviders/{providerName}'}

def create(
self, resource_group_name, provider_name, attestation_policy=None, custom_headers=None, raw=False, **operation_config):
self, resource_group_name, provider_name, attestation_policy=None, policy_signing_certificates=None, custom_headers=None, raw=False, **operation_config):
"""Creates or updates the Attestation Provider.

:param resource_group_name: The name of the resource group. The name
Expand All @@ -112,6 +112,11 @@ def create(
:type provider_name: str
:param attestation_policy: Name of attestation policy.
:type attestation_policy: str
:param policy_signing_certificates: JSON Web Key Set defining a set of
X.509 Certificates that will represent the parent certificate for the
signing certificate used for policy operations
:type policy_signing_certificates:
~azure.mgmt.attestation.models.JSONWebKeySet
:param dict custom_headers: headers that will be added to the request
:param bool raw: returns the direct response alongside the
deserialized response
Expand All @@ -123,8 +128,8 @@ def create(
:raises: :class:`CloudError<msrestazure.azure_exceptions.CloudError>`
"""
creation_params = None
if attestation_policy is not None:
creation_params = models.AttestationServiceCreationParams(attestation_policy=attestation_policy)
if attestation_policy is not None or policy_signing_certificates is not None:
creation_params = models.AttestationServiceCreationParams(attestation_policy=attestation_policy, policy_signing_certificates=policy_signing_certificates)

# Construct URL
url = self.create.metadata['url']
Expand Down