-
Notifications
You must be signed in to change notification settings - Fork 2
/
index.html
2239 lines (2109 loc) · 82.4 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
<!DOCTYPE html>
<html>
<head>
<title>Verifiable Credential Barcodes v0.7</title>
<meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
<!--
=== NOTA BENE ===
For the three scripts below, if your spec resides on dev.w3 you can check them
out in the same tree and use relative links so that they'll work offline,
-->
<script src="//www.w3.org/Tools/respec/respec-w3c" class="remove"></script>
<script class="remove" src="https://w3c.github.io/vc-data-model/common.js"></script>
<script type="text/javascript" class="remove">
var respecConfig = {
subtitle: "Embedding Verifiable Credentials in optical barcodes",
// specification status (e.g. WD, LCWD, NOTE, etc.). If in doubt use ED.
group: "credentials",
specStatus: "CG-DRAFT",
// the specification's short name, as in http://www.w3.org/TR/short-name/
shortName: "vc-barcodes",
// if you wish the publication date to be other than today, set this
//publishDate: "",
// if there is a previously published draft, uncomment this and set its YYYY-MM-DD date
// and its maturity status
// previousPublishDate: "1977-03-15",
// previousMaturity: "WD",
// if there a publicly available Editor's Draft, this is the link
edDraftURI: "https://w3c-ccg.github.io/vc-barcodes/",
latestVersion: "https://w3c-ccg.github.io/vc-barcodes/",
// if this is a LCWD, uncomment and set the end of its review period
//implementationReportURI: "",
//crEnd: "2024-01-17",
// if you want to have extra CSS, append them to this list
// it is recommended that the respec.css stylesheet be kept
//extraCSS: ["spec.css", "prettify.css"],
// editors, add as many as you like
// only "name" is required
editors: [{
name: "Wesley Smith",
url: "https://www.linkedin.com/in/wesley-smith-phd-24973a12b/",
company: "Digital Bazaar",
companyURL: "https://digitalbazaar.com/"
}, {
name: "Manu Sporny",
url: "https://www.linkedin.com/in/manusporny/",
company: "Digital Bazaar",
companyURL: "https://digitalbazaar.com/",
w3cid: 41758
}, {
name: "Yash Shah",
url: "https://www.linkedin.com/in/ynshah/",
company: "CredenceID",
companyURL: "https://credenceid.com/"
}],
// authors, add as many as you like.
// This is optional, uncomment if you have authors as well as editors.
// only "name" is required. Same format as editors.
authors: [{
name: "Manu Sporny", url: "https://www.linkedin.com/in/manusporny/",
company: "Digital Bazaar", companyURL: "https://digitalbazaar.com/",
w3cid: 41758
}, {
name: "Dave Longley", url: "https://github.com/dlongley",
company: "Digital Bazaar", companyURL: "https://digitalbazaar.com/",
w3cid: 48025
}, {
name: "Wesley Smith",
url: "https://www.linkedin.com/in/wesley-smith-phd-24973a12b/",
company: "Digital Bazaar",
companyURL: "https://digitalbazaar.com/"
}],
// name of the WG
//wg: "W3C Credentials Community Group",
// URI of the public WG page
//wgURI: "https://www.w3.org/community/credentials/",
// name (with the @w3c.org) of the public mailing to which comments are due
//wgPublicList: "public-credentials",
github: "https://github.com/digitalbazaar/vc-barcodes/",
otherLinks: [],
// URI of the patent status for this WG, for Rec-track documents
// !!!! IMPORTANT !!!!
// This is important for Rec-track documents, do not copy a patent URI from a random
// document unless you know what you're doing. If in doubt ask your friendly neighbourhood
// Team Contact.
// wgPatentURI: "",
maxTocLevel: 3,
/*preProcess: [ webpayments.preProcess ],
alternateFormats: [ {uri: "diff-20111214.html", label: "diff to previous version"} ],
*/
localBiblio: {
"CBOR-LD": {
title: "Compact Binary Object Representation for Linked Data v0.7",
href: "https://json-ld.github.io/cbor-ld-spec/"
},
"ICAO9303-3": {
title: "Machine Readable Travel Documents Part 3: Specifications Common to all MRTDs, Eighth Edition, 2021",
date: "2021",
href: "https://www.icao.int/publications/Documents/9303_p3_cons_en.pdf",
authors: [
"ICAO"
],
publisher: "International Civil Aviation Organization"
},
"ISO15438-2015": {
title: "ISO/IEC 15438:2015: PDF417 Bar Code Symbology Specification",
date: "2015",
href: "https://www.iso.org/standard/65502.html",
authors: [
"ISO/IEC JTC 1/SC 31"
],
publisher: "International Standards Organization"
},
"aamva-dl-id-card-design-standard": {
title: "AAMVA DL/ID Card Design Standard (2020)",
date: "2020",
href: "https://www.aamva.org/assets/best-practices,-guides,-standards,-manuals,-whitepapers/aamva-dl-id-card-design-standard-(2020)",
publisher: "American Association of Motor Vehicle Administrators"
}
},
lint: {"no-unused-dfns": false},
xref: ["INFRA"],
postProcess: [restrictRefs],
otherLinks: [{
key: "Related Specifications",
data: [{
value: "The Verifiable Credentials Data Model v2.0",
href: "https://www.w3.org/TR/vc-data-model-2.0/"
}, {
value: "Verifiable Credential Data Integrity v1.0",
href: "https://www.w3.org/TR/vc-data-integrity/"
}, {
value: "The Elliptic Curve Digital Signature Algorithm Cryptosuites v1.0",
href: "https://www.w3.org/TR/vc-di-ecdsa/"
}, {
value: "Compact Binary Object Representation for Linked Data v0.7",
href: "https://json-ld.github.io/cbor-ld-spec/"
}]
}]
};
</script>
<style>
code {
color: rgb(199, 73, 0);
font-weight: bold;
}
pre.nohighlight {
overflow-x: auto;
white-space: pre-wrap;
}
pre .highlight {
font-weight: bold;
color: green;
}
pre .comment {
font-weight: bold;
color: Gray;
}
.color-text {
font-weight: bold;
text-shadow: -1px 0 black, 0 1px black, 1px 0 black, 0 -1px black;
}
ol.algorithm {
counter-reset: numsection;
list-style-type: none;
}
ol.algorithm li {
margin: 0.5em 0;
}
ol.algorithm li:before {
font-weight: bold;
counter-increment: numsection;
content: counters(numsection, ".") ") ";
}
</style>
</head>
<body>
<section id="abstract">
<p>
This specification describes a mechanism to protect optical barcodes,
such as those found on driver's licenses (PDF417) and travel documents (MRZ),
using Verifiable Credentials [[VC-DATA-MODEL-2.0]]. The Verifiable Credential
representations are compact enough such that they fit in under 150 bytes and
can thus be integrated with traditional two-dimensional barcodes that are
printed on physical cards using standard printing processes.
</p>
</section>
<section id="sotd">
<p>
This specification is experimental.
</p>
</section>
<section>
<h2>Introduction</h2>
<p>
Physical credentials, such as driver's licenses, passports, and travel
credentials often include machine-readable data that can be used to quickly read
the information from the document. This information is encoded in formats such
as PDF417 [[ISO15438-2015]], machine-readable zone (MRZ) [[ICAO9303-3]], and
other optically scannable codes that are formatted in one-dimensional or
two-dimensional "bars"; thus the term "barcode". This information is often
not protected from tampering and the readily available barcode generation and
scanning libraries mean that it is fairly trivial for anyone to generate these
barcodes.
</p>
<p>
It is, therefore, useful for an <a>issuer</a> of these barcodes to protect
the information contained within the barcode as well as the entity that
generated the barcode.
</p>
<p>
The [[[VC-DATA-MODEL-2.0]]] specification provides a global standard for
expressing credential information, such as those in a driver's license or
travel document. The [[[VC-DATA-INTEGRITY]]] specification provides a global
standard for securing credential information. These two specifications, when
combined, provide a means of protecting credentials from tampering,
expressing authorship of the credential, and providing the current status of
a credential in a privacy-protecting manner. These data formats, however, tend
to be too large to express in an optical barcode.
</p>
<p>
The [[[CBOR-LD]]] specification provides a means of compressing secured
<a>verifiable credentials</a> to the point at which it becomes feasible to
express the information as an optical barcode, or embedded within an optical
barcode.
</p>
<p>
This specification describes a mechanism to protect optical barcodes,
such as those found on driver's licenses (PDF417) and travel documents (MRZ),
by using a <a>verifiable credential</a> [[VC-DATA-MODEL-2.0]] to express
information about the barcode, which is then secured using Data Integrity
[[VC-DATA-INTEGRITY]], and then compressed using CBOR-LD [[CBOR-LD]]. The
resulting <a>verifiable credential</a> representations are compact enough such
that they fit in under 140 bytes and can thus be integrated with traditional
two-dimensional barcodes that are printed on physical cards using standard
printing processes. This adds tamper resistance to the barcode while
optionally enhancing the barcode to provide information related to whether or
not the physical document has been revoked or suspended by the <a>issuer</a>.
</p>
<section>
<h3>Driver's License Example</h3>
<p>
This section provides an example on how the technology in this specification
can be utilized to secure the optical barcode on a driver's license that
uses a PDF417 barcode. We start off with an example driver's license:
</p>
<figure id="dl-front">
<img style="margin: auto; display: block; border-radius:15px; width: 50%;"
src="diagrams/dl-front.png"
alt="Picture of the front of a driver's license issued by the state of Utopia which contains a picture of the individual that is the subject of the driver's license along with their attributes, such as name, address, height, weight, eye color, and driving privileges.">
<figcaption style="text-align: center;">
The front of a driver's license issued by the state of Utopia.
</figcaption>
</figure>
<p>
The back of the driver's license contains a PDF417 barcode:
</p>
<figure id="dl-back">
<img style="margin: auto; display: block; border-radius:15px; width: 50%;"
src="diagrams/dl-back.png"
alt="Picture of the back of a driver's license issued by the state of Utopia, containing usage rules as well as a PDF417 barcode that encodes much of the information displayed on the front of the card.">
<figcaption style="text-align: center;">
A back of a driver's license issued by the state of Utopia.
</figcaption>
</figure>
<p>
The PDF417 data contains information that is secured using the algorithms
described in this specification. Namely, the PDF417 barcode contains a
<a>verifiable credential</a> of the following form.
</p>
<pre class="example nohighlight"
title="Verifiable Credential embedded in the PDF417 barcode">
{
"@context": [
"https://www.w3.org/ns/credentials/v2",
"https://w3id.org/vdl/v2",
"https://w3id.org/vdl/utopia/v1"
],
"type": [
"VerifiableCredential",
"OpticalBarcodeCredential"
],
<span class="comment">// the issuer value below is defined as a URL in the 'utopia/v1' context above</span>
"issuer": "did:web:dmv.utopia.example",
"credentialStatus": {
"type": "TerseBitstringStatusListEntry",
"terseStatusListBaseUrl": "https://dmv.utopia.gov/statuses/12345/status-lists"
"terseStatusListIndex": 123567890
},
"credentialSubject": {
"type": "AamvaDriversLicenseScannableInformation",
"protectedComponentIndex": "uP_BA"
},
"proof": {
"type": "DataIntegrity",
"cryptosuite": "ecdsa-xi-2023",
<span class="comment">// the public key below is defined as a URL in the 'utopia/v1' context above</span>
"verificationMethod": "did:web:dmv.utopia.example#key-1",
"proofPurpose": "assertionMethod",
"proofValue": "z4peo48uwK2EF4Fta8P...HzQMDYJ34r9gL"
}
}
</pre>
<p>
The <a>verifiable credential</a> above is then compressed using [[CBOR-LD]]
to the following output (in CBOR Diagnostic Notation):
</p>
<pre class="example nohighlight"
title="CBOR-LD compressed Verifiable Credential (145 bytes)">
1281{
1 => [ 32768, 32769, 32770], <span class="comment">// @context</span>
155 => [ 116, 164 ], <span class="comment">// type</span>
192 => 174, <span class="comment">// issuer</span>
186 => { 154 => 166, 206 => 178, 208 => 1234567890 }, <span class="comment">// credentialStatus</span>
188 => { 154 => 172, 180 => h'753FF040 }, <span class="comment">// credentialSubject</span>
194 => { <span class="comment">// proof</span>
154 => 108, <span class="comment">// type</span>
214 => 4, <span class="comment">// cryptosuite</span>
224 => 230 <span class="comment">// verificationMethod</span>
228 => 176, <span class="comment">// proofPurpose</span>
210 => Uint8Array(65) [ ... ], <span class="comment">// proofValue</span>
}
}
</pre>
</section>
<section>
<h3>Employment Authorization Example</h3>
<p>
This section provides an example on how the technology in this specification
can be utilized to secure the machine-readable zone on an employment
authorization document that uses a machine-readable zone (MRZ) on the back of
the card. We start off with an example employment authorization document:
</p>
<figure id="ead-front">
<img style="margin: auto; display: block; border-radius:15px; width: 50%;"
src="diagrams/ead-front.png"
alt="Picture of the front of an employment authorization document issued by the state of Utopia which contains a picture of the individual that is the subject of the document along with their attributes, such as name, address, height, weight, eye color, and employment privileges.">
<figcaption style="text-align: center;">
The front of an employment authorization document issued by the state of Utopia.
</figcaption>
</figure>
<p>
The back of the employment authorization document contains a machine-readable
zone (MRZ) containing information designed to be read through optical character
recognition:
</p>
<figure id="ead-back">
<img style="margin: auto; display: block; border-radius:15px; width: 50%;"
src="diagrams/ead-back.png"
alt="Picture of the back of a employment authorization document issued by the state of Utopia, containing usage rules as well as machine-readable zone data that encodes much of the information displayed on the front of the card.">
<figcaption style="text-align: center;">
A back of an employment authorization document issued by the state of Utopia.
</figcaption>
</figure>
<p>
The MRZ data contains information that is secured using the algorithms
described in this specification. Namely, the QR Code on the front of the
card contains a <a>verifiable credential</a> of the following form, which secures
the information on the back of the card.
</p>
<pre class="example nohighlight"
title="Verifiable Credential expressed as a QR Code on the front of the card">
{
"@context": [
"https://www.w3.org/ns/credentials/v2",
"https://w3id.org/citizenship/v2",
"https://w3id.org/citizenship/utopia/v1"
],
"type": [
"VerifiableCredential",
"OpticalBarcodeCredential"
],
<span class="comment">// the value below is defined as a URL in the 'utopia/v1' context above</span>
"issuer": "did:web:immigration.utopia.example",
"credentialSubject": {
"type": "MachineReadableZone",
},
"proof": {
"type": "DataIntegrity",
"cryptosuite": "ecdsa-xi-2023",
<span class="comment">// the value below is defined as a URL in the 'utopia/v1' context above</span>
"verificationMethod": "did:web:immigration.utopia.example#key-4"
"proofPurpose": "assertionMethod",
"proofValue": "z4peo48uwK2EF4Fta8P...HzQMDYJ34r9gL"
}
}
</pre>
<p class="note" title="credentialStatus is optional">
Readers might note that the credential above does not contain the optional
`credentialStatus` property. Not every optical barcode credential issuer will
have the requirement to have revocable optical barcode credentials.
</p>
<p>
The <a>verifiable credential</a> above is then compressed using [[CBOR-LD]]
to the following output (in CBOR Diagnostic Notation):
</p>
<pre class="example nohighlight"
title="CBOR-LD compressed Verifiable Credential (120 bytes)">
{
1 => [ 32768, 32769, 32770], <span class="comment">// @context</span>
155 => [ 116, 176 ], <span class="comment">// type</span>
208 => 194, <span class="comment">// issuer</span>
204 => { 154 => 192 }, <span class="comment">// credentialSubject</span>
210 => { <span class="comment">// proof</span>
154 => 108, <span class="comment">// type</span>
226 => 4, <span class="comment">// cryptosuite</span>
236 => 242 <span class="comment">// verificationMethod</span>
240 => 196, <span class="comment">// proofPurpose</span>
210 => Uint8Array(65) [ ... ], <span class="comment">// proofValue</span>
}
}
</pre>
</section>
<section id="terminology">
<h3>Terminology</h3>
<div data-include="https://w3c.github.io/vc-data-model/terms.html"></div>
</section>
<section id="terms-reference">
<h3>Terms defined by cited specifications</h3>
<dl data-sort="ascending">
<dt><dfn data-cite="XPATH-FUNCTIONS#codepoint-collation" data-lt="code point order|code point ordered|unicode codepoint collation">Unicode code point order</dfn></dt>
<dd>
This refers to determining the order of two Unicode strings (`A` and `B`),
using <a>Unicode Codepoint Collation</a>,
as defined in [[XPATH-FUNCTIONS]],
which defines a
<a href="https://en.wikipedia.org/wiki/Total_order">total ordering</a>
of <a>strings</a> comparing code points.
Note that for UTF-8 encoded strings, comparing the byte sequences gives the same result as <a>code point order</a>.
</dd>
</dl>
</section>
<section id="conformance">
<p>
A <dfn>conforming document</dfn> is any concrete expression of the data model
that complies with the normative statements in this specification. Specifically,
all relevant normative statements in Sections
<a href="#data-model"></a> and <a href="#algorithms"></a>
of this document MUST be enforced.
</p>
<p>
A <dfn class="lint-ignore">conforming processor</dfn> is any algorithm realized
as software and/or hardware that generates or consumes a
<a>conforming document</a>. Conforming processors MUST produce errors when
non-conforming documents are consumed.
</p>
<p>
This document contains examples of JSON and JSON-LD data. Some of these examples
are invalid JSON, as they include features such as inline comments (`//`)
explaining certain portions and ellipses (`...`) indicating the omission of
information that is irrelevant to the example. Such parts need to be
removed if implementers want to treat the examples as valid JSON or JSON-LD.
</p>
</section>
<section>
<h3>Design Goals</h3>
<p>
The following are the design goals of the technology in this specification:
<ul>
<li>
<b>Authenticity</b>: a Verifiable Credential Barcode that succesfully verifies is
guaranteed to have originated from the claimed issuing authority.
</li>
<li>
<b>Integrity</b>: data on a document with a Verifiable Credential Barcode that
succesfully verifies is guaranteed to not have been modified as long as that data
is secured by the barcode.
</li>
<li>
<b>Real-time Status</b>: verification of a Verifiable Credential Barcode proves that
the document has not been revoked or suspended, and this is done without a
privacy-invasive "phone home" to a source-of-truth database.
</li>
<li>
<b>Simplicity</b>: Verifiable Credential Barcodes reuse existing optical barcodes on
documents (e.g. PDF417s on the back of AAMVA compliant Driver's Licenses) or add a
new barcode in an easily consumable form (e.g. a QR code).
</li>
<li>
<b>Conformance</b>: the Verifiable Credential Barcodes technology stack is aligned with
global standards and standards-track technologies.
</li>
</ul>
</p>
</section>
</section>
<section>
<h2>Data Model</h2>
<p>
The following sections outline the data model that is used by this specification
to express [=verifiable credentials=] that secure optically printed information
such as barcodes and machine-readable zones on travel documents.
</p>
<section>
<h3>OpticalBarcodeCredential</h3>
<p>
An `OpticalBarcodeCredential` is used to secure the contents of an optical
barcode in a way that provides 1) authorship information , 2) tamper
resistance, and 3) optionally, revocation and suspension status. In other words,
the credential can tell you who issued the optical barcode, if the
optical barcode has been tampered with since it was first issued, and
whether or not the <a>issuer</a> of the optical barcode still warrants that
the document is still valid or not. These features provide significant
anti-fraud protections for physical documents.
</p>
<p>
The `credentialSubject` of an `OpticalBarcodeCredential` is either of type
`AamvaDriversLicenseScannableInformation` or a `MachineReadableZone`. A
`AamvaDriversLicenseScannableInformation` signifies that
the <a>verifiable credential</a> secures the PDF417 barcode on the physical
document as well as the information expressed in the
<a>verifiable credential</a>. A `MachineReadableZone` signifies that
the <a>verifiable credential</a> secures the machine-readable zone on the
physical document as well as the information expressed in the
<a>verifiable credential</a>.
</p>
<p>
If an `OpticalBarcodeCredential` is of type `AamvaDriversLicenseScannableInformation`,
there is a REQUIRED additional field `protectedComponentIndex` that contains information about which fields
in the PDF417 are digitally signed. `protectedComponentIndex` MUST be a three byte/24 bit value that is
multibase-base64url encoded for a total of 5 characters in the JSON-LD credential. There are 22
mandatory fields in an AAMVA compliant driver's license PDF417 [[aamva-dl-id-card-design-standard]],
and the first 22 bits of the `protectedComponentIndex` value correspond to these fields. Each AAMVA mandatory
field begins with a three character element ID (e.g. `DBA` for document expiration date). To construct
a mapping between bits in the `protectedComponentIndex` value and these fields, sort these element IDs
according to Unicode code point order. Then, if a bit in position `i` of `protectedComponentIndex` is `1`, the
AAMVA mandatory field in position `i` of the sorted element IDs is protected by the digital signature. The last two
bits in `protectedComponentIndex` MUST be `0`. For more information, see Section [[[#create-opticaldatabytes]]].
</p>
<p>
In order to achieve as much compression as possible, it is RECOMMENDED that the
`issuer` and `verificationMethod` fields utilize terms from a JSON-LD Context,
which can then be compressed down to a few bytes due to CBOR-LD's semantic
compression mechanism.
</p>
<p>
An example of an optical barcode credential that utilizes the properties
specified in this section is provided below:
</p>
<pre class="example nohighlight"
title="An OpticalBarcodeCredential utilizing a TerseBitstringStatusListEntry">
{
"@context": [
"https://www.w3.org/ns/credentials/v2",
"https://w3id.org/vdl/v2",
"https://w3id.org/vdl/utopia/v1"
],
"type": [
"VerifiableCredential",
<span class="highlight">"OpticalBarcodeCredential"</span>
],
"issuer": "did:web:dmv.utopia.example",
"credentialStatus": <span class="highlight">{
"type": "TerseBitstringStatusListEntry",
"terseStatusListBaseUrl": "dmv.utopia.gov/statuses/12345/status-lists"
"terseStatusListIndex": 123567890
}</span>,
"credentialSubject": {
<span class="highlight">"type": "AamvaDriversLicenseScannableInformation"</span>,
<span class="highlight">"protectedComponentIndex": "uP_BA"</span>
}
}
</pre>
</section>
<section>
<h3>TerseBitstringStatusListEntry</h3>
<p>
A `TerseBitstringStatusListEntry` is a compact representation
of a `BitstringStatusListEntry` as defined in the [[[VC-BITSTRING-STATUS-LIST]]]
specification.
</p>
<p>
An object of type `TerseBitstringStatusListEntry` MUST have two additional properties:
<ul>
<li>
`terseStatusListBaseUrl`, which identifies the location of the status lists associated with this credential.
`terseStatusListBaseUrl` MUST be a URL [[URL]].
</li>
<li>
`terseStatusListIndex`, which specifies an individual status at the above URL. `terseStatusListIndex` MUST be
representable as a 32 bit unsigned integer.
</li>
</ul>
</p>
To process a `TerseBitstringStatusListEntry`, apply the algorithm in Section
[[[#convert-status-list-entries]]] to convert it to a `BitstringStatusListEntry`,
then process it as in [[[VC-BITSTRING-STATUS-LIST]]].
<p>
Implementers need to set a value |listLength| for the length of an individual status list. This then yields
a number of status lists |listCount| = 2^32 / |listLength| for a 32-bit `terseStatusListIndex`.
|listLength| is needed to convert from a `TerseBitstringStatusListEntry` to a `BitstringStatusListEntry`.
Noting that some values of |listLength| will harm the privacy-preserving properties of these status lists,
implementations MUST use |listLength| = 2^17 and |listCount| = 2^15.
</p>
</section>
<section>
<h3>Encoding to and from barcodes</h3>
While the credentials in this specification use CBOR-LD to efficiently encode [=verifiable credentials=]
in a binary format, binary data is often inefficient or incompatible to turn into standard barcode
image formats directly. To that end, we provide requirements here for implementations.
<p>
It is RECOMMENDED that implementers character-encode CBOR-LD encoded `AamvaDriversLicenseScannableInformation`
credentials as base64url before encoding them in a PDF417.
</p>
<p>
It is REQUIRED that implementers re-encode CBOR-LD encoded `MachineReadableZone` credentials
as base45-multibase with the string 'VC1-' prepended before encoding them in a QR code.
</p>
</section>
</section>
<section>
<h2>Algorithms</h2>
<p>
The following section describes algorithms for adding and verifying digital
proofs that protect optical information, such as barcodes and machine-readable
zones, on physical media, such as driver's licenses and travel documents.
</p>
<p>
Generally speaking, the algorithms in this section are effectively the same
as the ones in the [[[VC-DI-ECDSA]]] [[VC-DI-ECDSA]] except that the
algorithm name is different because the cryptographic hashing process includes
the machine-readable barcode information when calculating the digital signature
such that the optical barcode is protected.
</p>
<section>
<h3>CBOR-LD Compression</h3>
<p>
This specification requires that an application-specific compression table is
provided to a CBOR-LD processor when encoding and decoding
<a>verifiable credentials</a> of type `OpticalBarcodeCredential`. A registry for
all context URLs for various issuers is <a href="cbor-ld-compression-table.csv">
provided as a comma-separated value file</a> and can be updated and modified via
<a href="https://github.com/digitalbazaar/verifiable-barcodes/pulls/">
change requests</a> to the file on an append-only and first-come-first-served
basis. Implementations SHOULD retrieve and utilize the latest file on a monthly
basis to ensure that compression and decompression supports the latest values.
</p>
</section>
<section>
<h3>Credential Creation</h3>
<ol class="algorithm">
<li>
Set |opticalData| to the data in the optical barcode to be secured.
</li>
<li>
Set |statusListEntryVerbose| to the `BitstringStatusListCredential`
(as defined in the [[[VC-BITSTRING-STATUS-LIST]]] specification) that the issuer
wishes to add to the `OpticalBarcodeCredential`.
</li>
<li>
Let |statusListEntryTerse| be an empty [=map=]. Set |statusListEntryTerse|.|type| to `TerseBitstringStatusListEntry` and |statusListEntryTerse|.|index| to the integer representation of |statusListEntryVerbose|.|statusListIndex|.
</li>
<li>
Set |issuerUrl| to the URL the issuer wishes to use for credential verification.
</li>
<li>
Set |unsignedStatus| to an `OpticalBarcodeCredential` with
|unsignedStatus|.|issuer| set to |issuerUrl| and |unsignedStatus|.|credentialStatus|
set to |statusListEntryTerse|.
</li>
<li>
Set |signedStatusVc| to the result of using the algorithm in
<a href="#add-proof-ecdsa-xi-2023"></a> to sign |opticalData|
and |unsignedStatus|.
</li>
<li>
Encode |signedStatusVc| using CBOR-LD [[CBOR-LD]] and add it to the designated area of the |opticalData|.
</li>
<li>
Generate the machine-readable credential (MRZ or PDF417).
</li>
</ol>
</section>
<section>
<h3>Credential Validation</h3>
<ol class="algorithm">
<li>
Set |securedDocument| to the data in the PDF417 or MRZ.
</li>
<li>
Set |verificationResult| to the result of applying the algorithm in Section
[[[#verify-proof-ecdsa-xi-2023]]]to |securedDocument|.
</li>
<li>
Set |credential| to the `OpticalBarcodeCredential` in |securedDocument|.
</li>
<li>
Set |statusListEntry| to the result of applying the algorithm in Section
[[[#convert-status-list-entries]]] to |credential|.
</li>
<li>
Set |statusResult| to the result of applying the algorithm in
<a data-cite="VC-BITSTRING-STATUS-LIST#validate-algorithm">
Bitstring Status List v1.0: Validate Algorithm</a> to |statusListEntry|.
</li>
<li>
Return (|validationResult|, |statusResult|).
</li>
</ol>
</section>
<section>
<h3>Convert Status List Entries</h3>
<p>
The algorithm in this section is used to convert the
`TerseBitstringStatusListEntry` to a `BitstringStatusListEntry`, which is used
after verification has been performed on the <a>verifiable credential</a>,
during the validation process.
</p>
<p>
After <a>verifiable credential</a> verification has been performed, the
algorithm takes an `OpticalBarcodeCredential` <a>verifiable credential</a>
([=struct=] |vc|), an integer |listLength| containing the number of entries
in the `BitstringStatusListCredential` associated with |vc|, and a string
|statusPurpose| (e.g. 'revocation', 'suspension'...) as input and returns
a 'BitstringStatusListEntry' object.
</p>
<ol class="algorithm">
<li>
Set |result| to be an empty [=map=].
</li>
<li>
Set |listIndex| to |vc|.|credentialStatus|.|terseStatusListIndex|/|listLength| rounded down
to the next lowest integer (i.e. apply the `floor()` operation).
</li>
<li>
Set |statusListIndex| to |vc|.|credentialStatus|.|terseStatusListIndex| % |listLength|.
</li>
<li>
Set |result|.|statusListCredential| to the concatenation of the following values:
|vc|.|credentialStatus|.|terseStatusListBaseUrl|, '/', |statusPurpose|, '/', |listIndex|.
</li>
<li>
Set |result|.|type| to 'BitstringStatusListEntry'.
</li>
<li>
Set |result|.|statusListIndex| to |statusListIndex|.
</li>
Set |result|.|statusPurpose| to |statusPurpose|.
<li>
Return |result|.
</li>
</ol>
<p>
|result| can be used as input to the
<a data-cite="VC-BITSTRING-STATUS-LIST#validate-algorithm">
validation algorithm</a> in the [[[VC-BITSTRING-STATUS-LIST]]] specification.
</p>
<p class="note" title="Status lists are optional">
Implementers are advised that not all <a>issuers</a> will publish status
list information for their <a>verifiable credentials</a>. Some <a>issuers</a>
might require authorization before allowing a <a>verifier</a> to access a
status list credential.
</p>
</section>
<section>
<h3>ecdsa-xi-2023</h3>
<p>
The `ecdsa-xi-2023` is effectively the `ecdsa-rdfc-2019` algorithm
[[VC-DI-ECDSA]] with an added step that takes some "extra information" (xi) as
input, such as the original optical barcode data, and includes that data in the
information that is protected by the digital signature. The algorithms in this
section detail how such a signature is created and verified.
</p>
<section>
<h4>Add Proof (ecdsa-xi-2023)</h4>
<p>
To generate a proof, the algorithm in
<a href="https://www.w3.org/TR/vc-data-integrity/#add-proof">
Section 4.1: Add Proof</a> in the Data Integrity
[[VC-DATA-INTEGRITY]] specification MUST be executed.
For that algorithm, the cryptographic suite specific
<a href="https://www.w3.org/TR/vc-data-integrity/#dfn-transformation-algorithm">
transformation algorithm</a> is defined in the
<a href="https://www.w3.org/TR/vc-di-ecdsa/#transformation-ecdsa-rdfc-2019">
Transformation (ecdsa-rdfc-2019)</a> section of the [[[VC-DI-ECDSA]]], the
<a href="https://www.w3.org/TR/vc-data-integrity/#dfn-hashing-algorithm">
hashing algorithm</a> is defined in Section
<a href="#hashing-ecdsa-xi-2023"></a>, and the
<a href="https://www.w3.org/TR/vc-data-integrity/#dfn-proof-serialization-algorithm">
proof serialization algorithm</a> is defined in the
<a href="https://www.w3.org/TR/vc-di-ecdsa/#proof-serialization-ecdsa-rdfc-2019">
Proof Serialization (ecdsa-rdfc-2019)</a> section of the [[[VC-DI-ECDSA]]].
</p>
</section>
<section>
<h4>Verify Proof (ecdsa-xi-2023)</h4>
<p>
To verify a proof, the algorithm in
<a href="https://www.w3.org/TR/vc-data-integrity/#verify-proof">
Section 4.2: Verify Proof</a> in the Data Integrity [[VC-DATA-INTEGRITY]]
specification MUST be executed. For that algorithm, the cryptographic suite
specific
<a href="https://www.w3.org/TR/vc-data-integrity/#dfn-transformation-algorithm">
transformation algorithm</a> is defined in the
<a href="https://www.w3.org/TR/vc-di-ecdsa/#transformation-ecdsa-rdfc-2019">
Transformation (ecdsa-rdfc-2019)</a> section of the [[[VC-DI-ECDSA]]], the
<a href="https://www.w3.org/TR/vc-data-integrity/#dfn-hashing-algorithm">
hashing algorithm</a> is defined in
Section <a href="#hashing-ecdsa-xi-2023"></a>, and the
<a href="https://www.w3.org/TR/vc-data-integrity/#dfn-proof-serialization-algorithm">
proof verification algorithm</a> is defined in the
<a href="https://www.w3.org/TR/vc-di-ecdsa/#proof-verification-ecdsa-rdfc-2019">
Proof Verification (ecdsa-rdfc-2019)</a> section of the [[[VC-DI-ECDSA]]].
</p>
</section>
<section>
<h4>Hashing (ecdsa-xi-2023)</h4>
<p>
The hashing algorithm is what is defined in the
<a href="https://www.w3.org/TR/vc-di-ecdsa/#hashing-ecdsa-rdfc-2019">
Hashing (ecdsa-rdfc-2019)</a> section of the [[[VC-DI-ECDSA]]] specification
with the addition of the hashing of the optical data, as described below. It is
presumed that the implementation makes the machine-readable optical data (PDF417
or MRZ data) available to this hashing algorithm.
</p>
<p>
The required inputs to this algorithm are a <em>transformed data document</em>
(<var>transformedDocument</var>), a <em>canonical proof configuration</em>
(<var>canonicalProofConfig</var>), and the <em>optical data</em>
(<var>opticalDataBytes</var>). A single <em>hash data</em> value represented as
series of bytes is produced as output.
</p>
<p>
The hashing algorithm is what is defined in the
<a href="https://www.w3.org/TR/vc-di-ecdsa/#hashing-ecdsa-rdfc-2019">
Hashing (ecdsa-rdfc-2019)</a> section of the [[[VC-DI-ECDSA]]] with step 3
replaced with the following two steps:
</p>
<ol class="algorithm">
<li>
Let <var>opticalDataHash</var> be the result of applying the same hash algorithm
that was applied to <var>hashData</var> to the <var>opticalDataBytes</var>
value.
</li>
<li>
Let <var>hashData</var> be the result of joining <var>proofConfigHash</var> (the
first hash), <var>transformedDocumentHash</var> (the second hash), and
<var>opticalDataHash</var> (the third hash).
</li>
</ol>
</section>
<section>
<h4> Create opticalDataBytes</h4>
<section>
<h5>`AamvaDriversLicenseScannableInformation` Credentials</h5>
<ol class="algorithm">
<li>
Set |dataToCanonicalize| to an empty array.
</li>
<li>
Set |bitfieldDecoded| to be first 22 bits of the length 24 bitstring resulting from decoding
`credentialSubject.protectedComponentIndex` from multibase-base64url to binary.
</li>
<li>
Set |fieldsAlphabetized| to be an array containing the 22 AAMVA mandatory PDF417 Element IDs
[[aamva-dl-id-card-design-standard]] sorted in Unicode code point order (i.e. ['DAC', 'DAD' ... 'DDG']).
</li>
<li>
For each bit with value `1` in |bitfieldDecoded|:
<ol class="algorithm">
<li>
Set the string |fieldName| to |fieldsAlphabetized|[|i|], where |i| is the index of the bit in |bitfieldDecoded|.
</li>
<li>
Set the string |fieldData| to the data that will be in the PDF417 associated with that field name.
</li>
<li>
Concatenate |fieldData| to the end of |fieldName|, concatenate a newline character (`\n`, `U+000A`) to the end,
and append the result to |dataToCanonicalize|.
</li>
</ol>
</li>
<li>
Set |canonicalizedData| to the result of sorting |dataToCanonicalize| in Unicode code point order and then applying a join operation
to create a single string from the array.
</li>
<li>
Hash |canonicalizedData| and return the result.
</li>
</ol>
</section>
<section>
<h5>`MachineReadableZone` Credentials</h5>
<ol class="algorithm">
<li>
Set |dataToCanonicalize| to an empty array.
</li>
<li>
For each line in the Machine Readable Zone on the credential:
<ol class="algorithm">
<li>
Set |mrzLine| to a string containing the data in that line.
</li>
<li>
Append a newline character to the end of |mrzLine| and append |mrzLine| to |dataToCanonicalize|.
</li>
</ol>
</li>
<li>
Set |canonicalizedData| to the result of ordering the elements of |dataToCanonicalize| to match the order they appear
on the credential and then applying a join operation to create a single string from the array.
</li>
<li>
Hash |canonicalizedData| and return the result.
</li>