Skip to content

Commit c099967

Browse files
Revisions from the MAA API Review (Azure#20558)
Significant revisions to the API surface to reflect API review comments. Co-authored-by: Jesse Squire <jesse.squire@gmail.com>
1 parent 339eaaf commit c099967

File tree

67 files changed

+2921
-1729
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

67 files changed

+2921
-1729
lines changed

.github/CODEOWNERS

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,8 @@
7373
#/<NotInRepo>/ @antcp @AzureAppServiceCLI
7474

7575
# ServiceLabel: %Attestation %Service Attention
76-
/sdk/attestation/ @anilba06
76+
/sdk/attestation/ @anilba06 @larryosterman
77+
/sdk/attestation/azure-security-attestation @azure/ @larryosterman @Azure/azure-sdk-write-attestation @anilba06
7778

7879
# ServiceLabel: %Authorization %Service Attention
7980
/sdk/authorization/Microsoft.Azure.Management.Authorization/ @darshanhs90 @AshishGargMicrosoft

sdk/attestation/Azure.Security.Attestation/CHANGELOG.md

Lines changed: 40 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,14 @@
11
# Release History
22

33
## 1.0.0-beta.3 (Unreleased)
4+
45
### Changed
6+
57
- Hopefully the final changes for Azure Attestation Service for .Net. Mostly code cleanups, but significant improvements to the `AttestationToken` class.
68

79
### Breaking change
8-
- Clients no longer need to instantiate `SecuredAttestationToken` or `UnsecuredAttestationToken` objects to validate the token hash. All of the functionality associated with `SecuredAttestationToken` and `UnsecuredAttestationToken` has been folded into the `AttestationToken` class.
10+
11+
- Clients no longer need to instantiate `SecuredAttestationToken` or `UnsecuredAttestationToken` objects to validate the token hash. All of the functionality associated with `SecuredAttestationToken` and `UnsecuredAttestationToken` has been folded into the `AttestationToken` class.
912
As a result, the `SecuredAttestationToken` and `UnsecuredAttestationToken` types have been removed.
1013

1114
```C# Snippet:VerifySigningHash
@@ -15,31 +18,47 @@ As a result, the `SecuredAttestationToken` and `UnsecuredAttestationToken` types
1518
// of an attestation token created locally.
1619
TokenSigningKey signingKey = new TokenSigningKey(<Customer provided signing key>, <Customer provided certificate>)
1720
var policySetToken = new AttestationToken(
18-
new StoredAttestationPolicy { AttestationPolicy = attestationPolicy },
21+
BinaryData.FromObjectAsJson(new StoredAttestationPolicy { AttestationPolicy = attestationPolicy }),
1922
signingKey);
2023

2124
using var shaHasher = SHA256Managed.Create();
22-
var attestationPolicyHash = shaHasher.ComputeHash(Encoding.UTF8.GetBytes(policySetToken.ToString()));
25+
byte[] attestationPolicyHash = shaHasher.ComputeHash(Encoding.UTF8.GetBytes(policySetToken.Serialize()));
2326

24-
Debug.Assert(attestationPolicyHash.SequenceEqual(setResult.Value.PolicyTokenHash));
27+
Debug.Assert(attestationPolicyHash.SequenceEqual(setResult.Value.PolicyTokenHash.ToArray()));
2528
```
29+
2630
- The JSON Web Token associated properties in the `AttestationToken` class have been converted to nullable types to allow the AttestationToken class to express JSON Web Signature objects.
2731
- The token validation related properties in the `AttestationClientOptions` class (validateAttestationTokens, validationCallback) have been moved into the new `TokenValidationOptions` class.
2832
- The `TokenValidationOptions` class contains a number of options to tweak the JSON Web Token validation process, modeled extremely loosely after constructs in [Nimbus JWT](https://connect2id.com/products/nimbus-jose-jwt) and [PyJWT](https://pypi.org/project/PyJWT/).
33+
- The validationCallback in the `TokenValidationOptions` object has been moved to a `TokenValidated` event on the `TokenValidationOptions` class. The `TokenValidated` event derives from the [SyncAsyncEventHandler](https://docs.microsoft.com/dotnet/api/azure.core.syncasynceventhandler-1) class, enabling both synchronous and asynchronous event handlers.
34+
- The `TokenBody` and `TokenHeader` properties have been removed from the [AttestationToken](https://docs.microsoft.com/dotnet/api/azure.security.attestation.attestationtoken) object since they were redundant.
35+
- The `TokenSigningKey` type has been renamed `AttestationTokenSigningKey`.
36+
- The `PolicyResult` type has been renamed `PolicyModificationResult`.
37+
- The constructor for the `AttestationToken` class has been changed from taking an `object` to taking a `BinaryData`. This allows callers to use their preferred serialization
38+
mechanism. The constructor for `AttestationToken` will ensure that the `body` parameter is in fact a serialized JSON object to ensure it is compatable wih the JSON Web Signature encoding algorithms.
39+
- The inputs to the AttestSgxEnclave and AttestOpenEnclave APIs have been restructured
40+
to reduce the number of parameters passed into the API.
41+
- When creating an `AttestationData` object specifying that the body type is "JSON", the binary data passed in will be verified that it contains a JSON object.
42+
- The return value of `GetPolicyManagementCertificates` has been changed from `AttestationResult<PolicyCertificatesResult>` to `AttestationResult<IReadOnlyList<X509Certificate2>>` to simplify the experience of retrieving the certificate list. As a consequence of this change, the `PolicyCertificatesResult` type has been removed.
43+
- The unused `TpmAttestationRequest` and `TpmAttestationResponse` types have been removed.
44+
- The `AttestationTokenSigningKey` will now ensure that the public key in the provided certificate is the public key corresponding to the private key.
2945

3046
## 1.0.0-beta.2 (2021-04-06)
3147

3248
### Fixed
33-
- [19708](https://github.com/Azure/azure-sdk-for-net/issues/19708), handle JSON values that are not just simple integers.
34-
- [18183](https://github.com/Azure/azure-sdk-for-net/issues/18183), Significant cleanup of README.md.
35-
- [18739](https://github.com/Azure/azure-sdk-for-net/issues/18739), reference the readme.md file in the azure-rest-apis directory instead of referencing the attestation JSON file directly. Also updated to the most recent version of the dataplane swagger files.
49+
50+
- [19708](https://github.com/Azure/azure-sdk-for-net/issues/19708), handle JSON values that are not just simple integers.
51+
- [18183](https://github.com/Azure/azure-sdk-for-net/issues/18183), Significant cleanup of README.md.
52+
- [18739](https://github.com/Azure/azure-sdk-for-net/issues/18739), reference the readme.md file in the azure-rest-apis directory instead of referencing the attestation JSON file directly. Also updated to the most recent version of the dataplane swagger files.
3653

3754
### Breaking Change
38-
- It is no longer necessary to manually Base64Url encode the AttestationPolicy property in the StoredAttestationPolicy model.
55+
56+
- It is no longer necessary to manually Base64Url encode the AttestationPolicy property in the StoredAttestationPolicy model.
3957
This dramatically simplifies the user experience for interacting with the saved attestation policies - developers can treat attestation policies as string values.
4058
- The `SecuredAttestationToken` and `UnsecuredAttestationToken` parameters have been removed from the APIs which took them. Instead those APIs directly take the underlying type.
4159

4260
Before:
61+
4362
``` C#
4463
string attestationPolicy = "version=1.0; authorizationrules{=> permit();}; issuancerules{};";
4564

@@ -54,33 +73,38 @@ Before:
5473
```
5574

5675
After:
57-
``` C#
58-
string attestationPolicy = "version=1.0; authorizationrules{=> permit();}; issuancerules{};";
59-
var setResult = client.SetPolicy(AttestationType.SgxEnclave,
60-
attestationPolicy,
61-
TestEnvironment.PolicySigningKey0, policyTokenSigner);
62-
```
6376

77+
```C# Snippet:SetPolicy
78+
string attestationPolicy = "version=1.0; authorizationrules{=> permit();}; issuancerules{};";
79+
80+
X509Certificate2 policyTokenCertificate = new X509Certificate2(<Attestation Policy Signing Certificate>);
81+
AsymmetricAlgorithm policyTokenKey = <Attestation Policy Signing Key>;
82+
83+
var setResult = client.SetPolicy(AttestationType.SgxEnclave, attestationPolicy, new AttestationTokenSigningKey(policyTokenKey, policyTokenCertificate));
84+
```
6485

6586
- The `GetPolicy` API has been changed to directly return the policy requested instead of a `StoredAttestationPolicy` object.
6687

6788
Before:
89+
6890
``` C#
6991
var policyResult = await client.GetPolicyAsync(AttestationType.SgxEnclave);
7092
var result = policyResult.Value.AttestationPolicy;
7193
```
7294

7395
After:
96+
7497
```C# Snippet:GetPolicy
7598
var client = new AttestationAdministrationClient(new Uri(endpoint), new DefaultAzureCredential());
7699

77-
var policyResult = await client.GetPolicyAsync(AttestationType.SgxEnclave);
78-
var result = policyResult.Value;
100+
AttestationResponse<string> policyResult = await client.GetPolicyAsync(AttestationType.SgxEnclave);
101+
string result = policyResult.Value;
79102
```
80103

81104
The net result of these changes is a significant reduction in the complexity of interacting with the attestation administration APIs.
82105

83106
## 1.0.0-beta.1 (2021-01-15)
107+
84108
Released as beta, not alpha.
85109

86110
## 1.0.0-alpha.1 (2020-12-08)

0 commit comments

Comments
 (0)