@@ -9,56 +9,67 @@ https://datatracker.ietf.org/doc/draft-ietf-rats-ar4si/
9
9
# Construction
10
10
11
11
An AttestationResult object is constructed by populating the relevant fields.
12
- The mandatory attributes are: status, timestamp and profile .
12
+ The mandatory attributes are: status, issued_at, profile, submods, and verifier_id .
13
13
For example, a simple AttestationResult payload with only the bare minimum
14
14
claims could be created as follows:
15
15
16
- myStatus := TrustTierAffirming
17
- myTimestamp := time.Now().Format(time.RFC3339)
18
- myPolicyID := `https://veraison.example/policy/1A4DF345-B512-4F3B-8461-967DE7F60ECA`
19
- myProfile := EatProfile
20
-
21
- ar := AttestationResult{
22
- Status: &myStatus,
23
- Timestamp: &testTimestamp,
24
- AppraisalPolicyID: &testPolicyID,
25
- Profile: &testProfile,
26
- }
16
+ myStatus := TrustTierAffirming
17
+ myTimestamp := time.Now().Unix()
18
+ myPolicyID := `https://veraison.example/policy/1A4DF345-B512-4F3B-8461-967DE7F60ECA`
19
+ myProfile := EatProfile
20
+ verifierBuild := "verifier-build"
21
+ verifierDeveloper := "verifier-developer"
22
+
23
+ ar := AttestationResult{
24
+ Profile: &myProfile,
25
+ IssuedAt: &myTimestamp,
26
+ Submods: map[string]*Appraisal{
27
+ "submodName": {
28
+ TrustVector: &TrustVector{},
29
+ Status: &myStatus,
30
+ AppraisalPolicyID: &myPolicyID,
31
+ },
32
+ },
33
+ VerifierID: &VerifierIdentity{
34
+ Build: &verifierBuild,
35
+ Developer: &verifierDeveloper,
36
+ },
37
+ }
27
38
28
39
A richer one would normally include the Trustworthiness Vector, which provides
29
- details about the appraised attester components. In the example below, the
40
+ details about the appraised attester components. In the example below, the
30
41
attester has been assessed as genuine, i.e., all claims are in the "affirming"
31
- range. (See §2.3 of draft-ietf-rats-ar4si-03 for details about the allowed values
42
+ range. (See §2.3 of draft-ietf-rats-ar4si-03 for details about the allowed values
32
43
and their meaning.)
33
44
34
- tv := TrustVector{
35
- InstanceIdentity: 2,
36
- Configuration: 2,
37
- Executables: 2,
38
- Hardware: 2,
39
- }
45
+ tv := TrustVector{
46
+ InstanceIdentity: 2,
47
+ Configuration: 2,
48
+ Executables: 2,
49
+ Hardware: 2,
50
+ }
40
51
41
- ar.TrustVector : = &tv
52
+ ar.Submods["submodName"]. TrustVector = &tv
42
53
43
54
# Signing and Serializing
44
55
45
56
Once the AttestationResult is populated, it can be signed (i.e., wrapped in a
46
57
JWT) by invoking the Sign method:
47
58
48
- myECDSAPrivateKey = `{
49
- "kty": "EC",
50
- "crv": "P-256",
51
- "x": "usWxHK2PmfnHKwXPS54m0kTcGJ90UiglWiGahtagnv8",
52
- "y": "IBOL-C3BttVivg-lSreASjpkttcsz-1rb7btKLv8EX4",
53
- "d": "V8kgd2ZBRuh2dgyVINBUqpPDr7BOMGcF22CQMIUHtNM"
54
- }`
59
+ myECDSAPrivateKey : = `{
60
+ "kty": "EC",
61
+ "crv": "P-256",
62
+ "x": "usWxHK2PmfnHKwXPS54m0kTcGJ90UiglWiGahtagnv8",
63
+ "y": "IBOL-C3BttVivg-lSreASjpkttcsz-1rb7btKLv8EX4",
64
+ "d": "V8kgd2ZBRuh2dgyVINBUqpPDr7BOMGcF22CQMIUHtNM"
65
+ }`
55
66
56
- sigK, _ := jwk.ParseKey([]byte(myECDSAPrivateKey))
67
+ sigK, _ := jwk.ParseKey([]byte(myECDSAPrivateKey))
57
68
58
- buf, _ = ar.Sign(jwa.ES256, sigK)
69
+ buf, _ : = ar.Sign(jwa.ES256, sigK)
59
70
60
71
In this case, the returned buf contains a signed ES256 JWT with the JSON
61
- serialization of the AttestationResult object as its payload. This is the usual
72
+ serialization of the AttestationResult object as its payload. This is the usual
62
73
JWT format that can be used as-is for interchange with other applications.
63
74
64
75
# Parsing and Verifying
@@ -67,38 +78,38 @@ On the consumer end of the protocol, when the EAT containing the attestation
67
78
result is received from a veraison verifier, the relying party needs to first
68
79
parse it and verify the signature using the Verify method:
69
80
70
- myECDSAPublicKey = `{
71
- "kty": "EC",
72
- "crv": "P-256",
73
- "x": "usWxHK2PmfnHKwXPS54m0kTcGJ90UiglWiGahtagnv8",
74
- "y": "IBOL-C3BttVivg-lSreASjpkttcsz-1rb7btKLv8EX4"
75
- }`
81
+ myECDSAPublicKey : = `{
82
+ "kty": "EC",
83
+ "crv": "P-256",
84
+ "x": "usWxHK2PmfnHKwXPS54m0kTcGJ90UiglWiGahtagnv8",
85
+ "y": "IBOL-C3BttVivg-lSreASjpkttcsz-1rb7btKLv8EX4"
86
+ }`
76
87
77
- vfyK, _ := jwk.ParseKey([]byte(myECDSAPublicKey))
88
+ vfyK, _ := jwk.ParseKey([]byte(myECDSAPublicKey))
78
89
79
- var ar AttestationResult
90
+ var ar AttestationResult
80
91
81
- err := ar.Verify(token, jwa.ES256, vfyK)
82
- if err != nil {
83
- // handle verification error
84
- }
92
+ err := ar.Verify(token, jwa.ES256, vfyK)
93
+ if err != nil {
94
+ // handle verification error
95
+ }
85
96
86
97
If there are no errors, the relying party can trust the attestation result and
87
98
inspect the relevant fields to decide about the trustworthiness of the attested
88
99
entity.
89
100
90
- if *ar.Status != TrustTierAffirming {
91
- // handle troubles with appraisal
92
- }
101
+ if *ar.Submods["submodName"] .Status != TrustTierAffirming {
102
+ // handle troubles with appraisal
103
+ }
93
104
94
105
# Pretty printing
95
106
96
107
The package provides a Report method that allows pretty printing of the
97
- Trustworthiness Vector. The caller can request a short summary or a detailed
108
+ Trustworthiness Vector. The caller can request a short summary or a detailed
98
109
printout, as well as using colors when displaying the claims' values.
99
110
100
- short, color := true, true
111
+ short, color := true, true
101
112
102
- fmt.Print(ar.TrustVector.Report(short, color))
113
+ fmt.Print(ar.Submods["submodName"] .TrustVector.Report(short, color))
103
114
*/
104
115
package ear
0 commit comments