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

Add implementation notes section to test vectors, add text there clarifying CBOR-LD maps. #16

Merged
merged 3 commits into from
Jul 25, 2024
Merged
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
75 changes: 57 additions & 18 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -719,7 +719,7 @@ <h3>Credential Creation</h3>
</li>
<li>
Set |signedStatusVc| to the result of using the algorithm in
<a href="#add-proof-ecdsa-xi-2023">Section 3.2.1</a> to sign |opticalData|
<a href="#add-proof-ecdsa-xi-2023"></a> to sign |opticalData|
and |unsignedStatus|.
</li>
<li>
Expand Down Expand Up @@ -1169,7 +1169,7 @@ <h5>
name (DAC), last name (DCS), and license number (DAQ). The bitstring value for use in
`protectedComponentIndex` is then |100000100000000000100000|, and the value of
`protectedComponentIndex` is "uggAg". Applying
<a href="#create-opticaldatabytes">Algorithm 3.5.4.1</a>, we get
<a href="#create-opticaldatabytes"></a>, we get
</p>
<pre class="example nohighlight"
title="Data from the canonicalization of a Utopia Driver's License">
Expand All @@ -1183,8 +1183,8 @@ <h5>
</section>
<p>
We now can use this hash value with
<a href="#hashing-ecdsa-xi-2023">Algorithm 3.5.3</a> to sign the VC.
Executing <a href="#credential-creation">Algorithm 3.2</a> with a
<a href="#hashing-ecdsa-xi-2023"></a> to sign the VC.
Executing <a href="#credential-creation"></a> with a
`BitstringStatusListCredential`, we get the following JSON-LD VC:
</p>
<section>
Expand Down Expand Up @@ -1364,7 +1364,12 @@ <h4>CBOR-LD Compression and Encoding</h4>
'keyAgreement' => 238
}
</pre>
<p>
For more information on the above, see <a href="#implementation-notes"></a>.
</p>
<p>
This results in the following encoded credential:
</p>
<pre class="example nohighlight"
title="A CBOR-LD compressed Utopia Driver's License VC">
d90664a60183198000198001198002189d82187618a418b8a3189c18a618ce18b218d01ae592208118baa2189c18a018a8447582002018be18aa18c0a5189c186c18d60418e018e618e258417ab7c2e56b49e2cce62184ce26818e15a8b173164401b5d3bb93ffd6d2b5eb8f6ac0971502ae3dd49d17ec66528164034c912685b8111bc04cdc9ec13dbadd91cc18e418ac
Expand Down Expand Up @@ -1425,7 +1430,7 @@ <h5>
Creating `opticalDataBytes`
</h5>
<p>
For the EAD, we apply <a href="#create-opticaldatabytes">Algorithm 3.5.4.2</a>:
For the EAD, we apply <a href="#create-opticaldatabytes"></a>:
</p>
<pre class="example nohighlight"
title="Data from the canonicalization of a Utopia EAD MRZ">
Expand All @@ -1439,8 +1444,8 @@ <h5>
</pre>
<p>
We now can use this hash value with
<a href="#hashing-ecdsa-xi-2023">Algorithm 3.5.3</a> to sign the VC.
Executing <a href="#credential-creation">Algorithm 3.2</a> without
<a href="#hashing-ecdsa-xi-2023"></a> to sign the VC.
Executing <a href="#credential-creation"></a> without
adding status, we get the following JSON-LD VC:
</p>
</section>
Expand Down Expand Up @@ -1613,7 +1618,12 @@ <h4>CBOR-LD Compression and Encoding</h4>
'keyAgreement' => 234
}
</pre>
This results in the following encoded credential:
<p>
For more information on the above, see <a href="#implementation-notes"></a>.
</p>
<p>
Compression then results in the following encoded credential:
</p>
<pre class="example nohighlight"
title="A CBOR-LD compressed Utopia EAD VC">
d90664a50183198000198001198002189d82187618a418baa1189c18a218be18ae18c0a5189c186c18d20418dc18e218de58417a9ec7f688f60caa8c757592250b3f6d6e18419941f186e1ed4245770e687502d51d01cd2c2295e4338178a51a35c2f044a85598e15db9aef00261bc5c95a744e718e018b0
Expand Down Expand Up @@ -1827,6 +1837,9 @@ <h4>Decoding and Decompressing</h4>
}
</pre>
<p>
For more information on the above, see <a href="#implementation-notes"></a>.
</p>
<p>
Decompression then yields the following credential:
</p>
<pre class="example nohighlight"
Expand Down Expand Up @@ -1863,9 +1876,8 @@ <h4>Decoding and Decompressing</h4>
<section>
<h4>Verifying</h4>
<p>
Again we apply <a href="#create-opticaldatabytes">Algorithm 3.5.4.1</a>
and <a href="#create-opticaldatabytes">Algorithm 3.5.4.2</a> to create
the |opticalDataBytes| that `ecdsa-xi-2023` requires, using the
We apply <a href="#create-opticaldatabytes"></a>
to create the |opticalDataBytes| that `ecdsa-xi-2023` requires, using the
scanned PDF417 and `protectedComponentIndex` as input.
</p>
<pre class="example nohighlight"
Expand All @@ -1879,16 +1891,16 @@ <h4>Verifying</h4>
</pre>

<p>
We then apply <a href="#hashing-ecdsa-xi-2023">Algorithm 3.5.3</a> and
<a href="#verify-proof-ecdsa-xi-2023">Algorithm 3.5.2</a> to verify
We then apply <a href="#hashing-ecdsa-xi-2023"></a> and
<a href="#verify-proof-ecdsa-xi-2023"></a> to verify
the credential.
</p>
</section>
<section>
<h4>Status Checking</h4>
<p>
The last step is to check the status information on the Driver's License
credential. We apply <a href="#convert-status-list-entries">Algorithm 3.4</a>
credential. We apply <a href="#convert-status-list-entries"></a>
to convert the `TerseBitstringStatusListEntry` into a `BitstringStatusListEntry`.
Here we check two status types, 'revocation' and 'suspension', passing those
strings as values of |statusPurpose|.
Expand Down Expand Up @@ -2066,6 +2078,9 @@ <h4>Decoding and Decompressing</h4>
}
</pre>
<p>
For more information on the above, see <a href="#implementation-notes"></a>.
</p>
<p>
Decompression then yields the following credential:
</p>
<pre class="example nohighlight"
Expand Down Expand Up @@ -2097,8 +2112,7 @@ <h4>Decoding and Decompressing</h4>
<section>
<h4>Verifying</h4>
<p>
Again we apply <a href="#create-opticaldatabytes">Algorithm 3.5.4.1</a>
and <a href="#create-opticaldatabytes">Algorithm 3.5.4.2</a> to create
We apply <a href="#create-opticaldatabytes"></a> to create
the |opticalDataBytes| that `ecdsa-xi-2023` requires,using the MRZ
on the EAD as input for the EAD:
</p>
Expand All @@ -2113,15 +2127,40 @@ <h4>Verifying</h4>
46, 253, 9, 137, 145, 42, 192, 113]
</pre>
<p>
We then apply <a href="#hashing-ecdsa-xi-2023">Algorithm 3.5.3</a> and
<a href="#verify-proof-ecdsa-xi-2023">Algorithm 3.5.2</a> to verify
We then apply <a href="#hashing-ecdsa-xi-2023"></a> and
<a href="#verify-proof-ecdsa-xi-2023"></a> to verify
the credential.
</p>
</section>
</section>
</section>
<section>
<h3>
Implementation Notes
</h3>
<section>
<h4>
CBOR-LD
</h4>
<p>
When building maps from context terms to CBOR-LD integers, note that
some contexts include other contexts inside of them, nested under particular
types of objects. These nested contexts are called "type-scoped contexts" and they only
become active when the associated type is used in the data. This is important for term ID
assignment because the terms in a context are only assigned IDs once that context becomes
active. In these test vectors, this is why the maps created for the Driver's License and
the Employment Authorization Document are different even though the two credentials use
identical contexts.
</p>
<p>
In addition, note that odd numbers are used in CBOR-LD to express terms when the associated
value is plural. For example, in the CBOR-LD term to ID and id to term maps above, "type" is
mapped to 156, but in places where multiple types are expressed in a VC, 157 is used instead.
</p>
</section>
</section>
<section>
<h3>
Legacy CBOR-LD encoded credentials
</h3>
For testing if a CBOR-LD implementation that is not fully up to date is used. The process remains
Expand Down
Loading