forked from w3c/vc-di-eddsa
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
1330 lines (1180 loc) · 48.6 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>EdDSA Cryptosuite v2022</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="https://www.w3.org/Tools/respec/respec-w3c" class="remove"></script>
<script class="remove" src="https://w3c.github.io/vc-data-integrity/common.js"></script>
<script type="text/javascript" class="remove">
var respecConfig = {
// specification status (e.g. WD, LCWD, NOTE, etc.). If in doubt use ED.
specStatus: "FPWD",
// the specification's short name, as in http://www.w3.org/TR/short-name/
shortName: "vc-di-eddsa",
group: "vc",
// if you wish the publication date to be other than today, set this
publishDate: "2023-04-18",
// 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.github.io/vc-di-eddsa/",
//latestVersion: "https://www.w3.org/community/reports/credentials/CG-FINAL-di-eddsa-2020-20220724/",
// if this is a LCWD, uncomment and set the end of its review period
// lcEnd: "2009-08-05",
// 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: "Manu Sporny",
url: "https://www.linkedin.com/in/manusporny/",
company: "Digital Bazaar",
companyURL: "https://digitalbazaar.com/",
w3cid: 41758
}, {
name: "Dmitri Zagidulin",
url: "https://www.linkedin.com/in/dzagidulin/",
company: "MIT Digital Credentials Consortium",
companyURL: "https://digitalcredentials.mit.edu/",
w3cid: 86708
}],
authors: [{
name: "Dave Longley", url: "https://digitalbazaar.com/",
company: "Digital Bazaar", companyURL: "https://digitalbazaar.com/",
w3cid: 48025
}, {
name: "Manu Sporny", url: "https://www.linkedin.com/in/manusporny/",
company: "Digital Bazaar", companyURL: "https://digitalbazaar.com/",
w3cid: 41758
}],
github: "https://github.com/w3c/vc-di-eddsa/",
// 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: 4,
/*preProcess: [ webpayments.preProcess ],
alternateFormats: [ {uri: "diff-20111214.html", label: "diff to previous version"} ],
*/
localBiblio: {
MULTIBASE: {
title: "Multibase",
href: "https://datatracker.ietf.org/doc/html/draft-multiformats-multibase-01",
},
MULTICODEC: {
title: "Multicodec",
href: "https://github.com/multiformats/multicodec/",
},
},
lint: {"no-unused-dfns": false},
postProcess: [restrictRefs]
};
</script>
<style>
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 Data Integrity cryptographic suite for use when
creating or verifying a digital signature using the twisted Edwards Curve
Digital Signature Algorithm (EdDSA) and Curve25519 (ed25519).
</p>
</section>
<section id="sotd">
<p>
This is an experimental specification and is undergoing regular revisions. It is
not fit for production deployment.
</p>
</section>
<section>
<h2>Introduction</h2>
<p>
This specification defines a cryptographic suite for the purpose of creating,
verifying proofs for Ed25519 EdDSA signatures in conformance with the
Data Integrity [[VC-DATA-INTEGRITY]] specification. The approach is
accepted by the U.S. National Institute of Standards in the latest FIPS 186-5
publication and meets U.S. Federal Information Processing requirements when
using cryptography to secure digital information.
</p>
<p>
The suites described in this specification use the RDF Dataset Normalization
Algorithm [[RDF-CANON]] or the JSON Canonicalization Scheme [[RFC8785]] to
transform an input document into its canonical form. The canonical
representation is then hashed and signed with a detached signature algorithm.
</p>
<section id="terminology">
<h3>Terminology</h3>
<div data-include="https://w3c.github.io/vc-data-integrity/terms.html"></div>
</section>
<section id="conformance">
<p>
A <dfn>conforming proof</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 proof</a>. Conforming processors MUST produce errors when
non-conforming documents are consumed.
</p>
<p>
This document also contains examples that contain JSON and JSON-LD content. Some
of these examples contain characters that are invalid JSON, such as inline
comments (`//`) and the use of ellipsis (`...`) to denote
information that adds little value to the example. Implementers are cautioned to
remove this content if they desire to use the information as valid JSON or
JSON-LD.
</p>
</section>
</section>
<section>
<h2>Data Model</h2>
<p>
The following sections outline the data model that is used by this specification
for verification methods and signature formats.
</p>
<section>
<h3>Verification Methods</h3>
<p>
The cryptographic material used to verify a linked data proof is called the
verification method. This suite relies on public key material represented using
[[MULTIBASE]] and [[MULTICODEC]]. This suite supports public key use for both
digital signature generation and verification, according to [[RFC8032]].
</p>
<p>
This suite MAY be used to verify Data Integrity Proofs [[VC-DATA-INTEGRITY]]
produced by Ed25519 public key material encoded as either a
<a href="#ed25519verificationkey2020">Ed25519VerificationKey2020</a> or
<a href="#multikey">Multikey</a>. Loss-less key transformation processes that
result in equivalent cryptographic material MAY be utilized.
</p>
<section>
<h4>Multikey</h4>
<p class="issue">
This definition should go in the Data Integrity specification and referenced
from there.
</p>
<p>
The `type` of the verification method MUST be `Multikey`.
</p>
<p>
The `controller` of the verification method MUST be a URL.
</p>
<p>
The `publicKeyMultibase` property of the verification method MUST be
a public key encoded according to [[MULTICODEC]] and formatted according to
[[MULTIBASE]]. The multicodec encoding of a Ed25519 public key is the two-byte
prefix `0xed01` followed by the 32-byte public key data. The 34 byte
value is then encoded using base58-btc (`z`) as the prefix. Any other encoding
MUST NOT be allowed.
</p>
<p class="advisement">
Developers are advised to not accidentally publish a representation of a private
key. Implementations of this specification will raise errors in the event of a
[[MULTICODEC]] value other than `0xed01` being used in a
`publicKeyMultibase` value.
</p>
<pre class="example"
title="An Ed25519 public key encoded as a Multikey">
{
"id": "https://example.com/issuer/123#key-0",
"type": "Multikey",
"controller": "https://example.com/issuer/123",
"publicKeyMultibase": "z6Mkf5rGMoatrSj1f4CyvuHBeXJELe9RPdzo2PKGNCKVtZxP"
}
</pre>
<pre class="example" title="An Ed25519 public key encoded as a
Multikey in a controller document">
{
"@context": [
"https://www.w3.org/ns/did/v1",
"https://w3id.org/security/data-integrity/v1"
],
"id": "did:example:123",
"verificationMethod": [{
"id": "did:example:123#key-0",
"type": "Multikey",
"controller": "did:example:123",
"publicKeyMultibase": "z6Mkf5rGMoatrSj1f4CyvuHBeXJELe9RPdzo2PKGNCKVtZxP"
}],
"authentication": [
"did:example:123#key-0"
],
"assertionMethod": [
"did:example:123#key-0"
],
"capabilityDelegation": [
"did:example:123#key-0"
],
"capabilityInvocation": [
"did:example:123#key-0"
]
}
</pre>
</section>
</section>
<section>
<h3>Proof Representations</h3>
<p>
This suite relies on detached digital signatures represented using [[MULTIBASE]]
and [[MULTICODEC]].
</p>
<section>
<h4>DataIntegrityProof</h4>
<p>
The `verificationMethod` property of the proof MUST be a URL.
Dereferencing the `verificationMethod` MUST result in an object
containing a `type` property with the value set to
`Multikey`.
</p>
<p>
The `type` property of the proof MUST be `DataIntegrityProof`.
</p>
<p>
The `cryptosuite` property of the proof MUST be `eddsa-2022`.
</p>
<p>
The `created` property of the proof MUST be an [[XMLSCHEMA11-2]]
formatted date string.
</p>
<p>
The `proofPurpose` property of the proof MUST be a string, and MUST
match the verification relationship expressed by the verification method
`controller`.
</p>
<p>
The `proofValue` property of the proof MUST be a detached EdDSA
produced according to [[RFC8032]], encoded according to [[MULTIBASE]] using
the base58-btc base encoding.
</p>
<pre class="example highlight" style="overflow-x:
auto; white-space: pre-wrap; word-wrap: break-word;"
title="An Ed25519 digital signature expressed as a
DataIntegrityProof">
{
"@context": [
{"title": "https://schema.org/title"},
"https://w3id.org/security/data-integrity/v1"
],
"title": "Hello world!",
"proof": {
"type": "DataIntegrityProof",
"cryptosuite": "eddsa-2022",
"created": "2020-11-05T19:23:24Z",
"verificationMethod": "https://ldi.example/issuer#z6MkjLrk3gKS2nnkeWcmcxi
ZPGskmesDpuwRBorgHxUXfxnG",
"proofPurpose": "assertionMethod",
"proofValue": "z4oey5q2M3XKaxup3tmzN4DRFTLVqpLMweBrSxMY2xHX5XTYVQeVbY8nQA
VHMrXFkXJpmEcqdoDwLWxaqA3Q1geV6"
}
}
</pre>
</section>
</section>
</section>
<section>
<h2>Algorithms</h2>
<p>
The following section describes multiple Data Integrity cryptographic suites
that utilize the twisted Edwards Curve Digital Signature Algorithm.
</p>
<section>
<h3>eddsa-2022</h3>
<p>
The `eddsa-2022` cryptographic suite takes an input document, canonicalizes
the document using the Universal RDF Dataset Canonicalization Algorithm
[[RDF-CANON]], and then cryptographically hashes and signs the output
resulting in the production of a data integrity proof. The algorithms in this
section also include the verification of such a data integrity proof.
</p>
<section>
<h4>Add Proof (eddsa-2022)</h4>
<p>
To generate a proof, the algorithm in
<a data-cite="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 data-cite="vc-data-integrity#dfn-transformation-algorithm">
transformation algorithm</a> is defined in Section
<a href="#transformation-eddsa-2022"></a>, the
<a data-cite="vc-data-integrity#dfn-hashing-algorithm">
hashing algorithm</a> is defined in Section <a href="#hashing-eddsa-2022"></a>,
and the
<a data-cite="vc-data-integrity#dfn-proof-serialization-algorithm">
proof serialization algorithm</a> is defined in Section
<a href="#proof-serialization-eddsa-2022"></a>.
</p>
</section>
<section>
<h4>Verify Proof (eddsa-2022)</h4>
<p>
To verify a proof, the algorithm in
<a data-cite="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 data-cite="vc-data-integrity#dfn-transformation-algorithm">
transformation algorithm</a> is defined in Section
<a href="#transformation-eddsa-2022"></a>, the
<a data-cite="vc-data-integrity#dfn-hashing-algorithm">
hashing algorithm</a> is defined in Section <a href="#hashing-eddsa-2022"></a>,
and the
<a data-cite="vc-data-integrity#dfn-proof-serialization-algorithm">
proof verification algorithm</a> is defined in Section
<a href="#proof-verification-eddsa-2022"></a>.
</p>
</section>
<section>
<h4>Transformation (eddsa-2022)</h4>
<p>
The following algorithm specifies how to transform an unsecured input document
into a transformed document that is ready to be provided as input to the
hashing algorithm in Section <a href="#hashing-eddsa-2022"></a>.
</p>
<p>
Required inputs to this algorithm are an
<a data-cite="vc-data-integrity#dfn-unsecured-data-document">
unsecured data document</a> (<var>unsecuredDocument</var>) and
transformation options (<var>options</var>). The
transformation options MUST contain a type identifier for the
<a data-cite="vc-data-integrity#dfn-cryptosuite">
cryptographic suite</a> (<var>type</var>) and a cryptosuite
identifier (<var>cryptosuite</var>). A <em>transformed data document</em> is
produced as output. Whenever this algorithm encodes strings, it MUST use UTF-8
encoding.
</p>
<ol class="algorithm">
<li>
If <var>options</var>.<var>type</var> is not set to the string
`DataIntegrityProof` and <var>options</var>.<var>cryptosuite</var> is not
set to the string `eddsa-2022` then a `PROOF_TRANSFORMATION_ERROR` MUST be
raised.
</li>
<li>
Let <var>canonicalDocument</var> be the result of applying the
Universal RDF Dataset Canonicalization Algorithm
[[RDF-CANON]] to the <var>unsecuredDocument</var>.
</li>
<li>
Return <var>canonicalDocument</var> as the <em>transformed data document</em>.
</li>
</ol>
</section>
<section>
<h4>Hashing (eddsa-2022)</h4>
<p>
The following algorithm specifies how to cryptographically hash a
<em>transformed data document</em> and <em>proof configuration</em>
into cryptographic hash data that is ready to be provided as input to the
algorithms in Section <a href="#proof-serialization-eddsa-2022"></a> or
Section <a href="#proof-verification-eddsa-2022"></a>.
</p>
<p>
The required inputs to this algorithm are a <em>transformed data document</em>
(<var>transformedDocument</var>) and <em>canonical proof configuration</em>
(<var>canonicalProofConfig</var>). A single <em>hash data</em> value represented as
series of bytes is produced as output.
</p>
<ol class="algorithm">
<li>
Let <var>transformedDocumentHash</var> be the result of applying the
SHA-256 (SHA-2 with 256-bit output) cryptographic hashing algorithm [[RFC6234]]
to the <var>transformedDocument</var>. <var>transformedDocumentHash</var> will
be exactly 32 bytes in size.
</li>
<li>
Let <var>proofConfigHash</var> be the result of applying the
SHA-256 (SHA-2 with 256-bit output) cryptographic hashing algorithm [[RFC6234]]
to the <var>canonicalProofConfig</var>. <var>proofConfigHash</var> will be
exactly 32 bytes in size.
</li>
<li>
Let <var>hashData</var> be the result of joining <var>proofConfigHash</var> (the
first hash) with <var>transformedDocumentHash</var> (the second hash).
</li>
<li>
Return <var>hashData</var> as the <em>hash data</em>.
</li>
</ol>
</section>
<section>
<h4>Proof Configuration (eddsa-2022)</h4>
<p>
The following algorithm specifies how to generate a
<em>proof configuration</em> from a set of <em>proof options</em>
that is used as input to the <a href="#hashing-eddsa-2022">proof hashing algorithm</a>.
</p>
<p>
The required inputs to this algorithm are <em>proof options</em>
(<var>options</var>). The <em>proof options</em> MUST contain a type identifier
for the
<a data-cite="vc-data-integrity#dfn-cryptosuite">
cryptographic suite</a> (<var>type</var>) and MUST contain a cryptosuite
identifier (<var>cryptosuite</var>). A <em>proof configuration</em>
object is produced as output.
</p>
<ol class="algorithm">
<li>
Let <var>proofConfig</var> be an empty object.
</li>
<li>
Set <var>proofConfig</var>.<var>type</var> to
<var>options</var>.<var>type</var>.
</li>
<li>
If <var>options</var>.<var>cryptosuite</var> is set, set
<var>proofConfig</var>.<var>cryptosuite</var> to its value.
</li>
<li>
If <var>options</var>.<var>type</var> is not set to `DataIntegrityProof` and
<var>proofConfig</var>.<var>cryptosuite</var> is not set to `eddsa-2022`, an
`INVALID_PROOF_CONFIGURATION` error MUST be raised.
</li>
<li>
Set <var>proofConfig</var>.<var>created</var> to
<var>options</var>.<var>created</var>. If the value is not a valid
[[XMLSCHEMA11-2]] datetime, an `INVALID_PROOF_DATETIME` error MUST be raised.
</li>
<li>
Set <var>proofConfig</var>.<var>verificationMethod</var> to
<var>options</var>.<var>verificationMethod</var>.
</li>
<li>
Set <var>proofConfig</var>.<var>proofPurpose</var> to
<var>options</var>.<var>proofPurpose</var>.
</li>
<li>
Set <var>proofConfig</var>.<var>@context</var> to
<var>unsecuredDocument</var>.<var>@context</var>
</li>
<li>
Let <var>canonicalProofConfig</var> be the result of applying the
Universal RDF Dataset Canonicalization Algorithm
[[RDF-CANON]] to the <var>proofConfig</var>.
</li>
<li>
Return <var>canonicalProofConfig</var>.
</li>
</ol>
</section>
<section>
<h4>Proof Serialization (eddsa-2022)</h4>
<p>
The following algorithm specifies how to serialize a digital signature from
a set of cryptographic hash data. This
algorithm is designed to be used in conjunction with the algorithms defined
in the Data Integrity [[VC-DATA-INTEGRITY]] specification,
<a data-cite="vc-data-integrity#algorithms">
Section 4: Algorithms</a>. Required inputs are
cryptographic hash data (<var>hashData</var>) and
<em>proof options</em> (<var>options</var>). The
<em>proof options</em> MUST contain a type identifier for the
<a data-cite="vc-data-integrity#dfn-cryptosuite">
cryptographic suite</a> (<var>type</var>) and MAY contain a cryptosuite
identifier (<var>cryptosuite</var>). A single <em>digital proof</em> value
represented as series of bytes is produced as output.
</p>
<ol class="algorithm">
<li>
Let <var>privateKeyBytes</var> be the result of retrieving the
private key bytes associated with the
<var>options</var>.<var>verificationMethod</var> value as described in the
Data Integrity [[VC-DATA-INTEGRITY]] specification,
<a data-cite="vc-data-integrity#algorithms">
Section 4: Retrieving Cryptographic Material</a>.
</li>
<li>
Let <var>proofBytes</var> be the result of applying the Edwards-Curve Digital
Signature Algorithm (EdDSA) [[RFC8032]], using the `Ed25519` variant
(Pure EdDSA), with <var>hashData</var> as the data to be signed using
the private key specified by <var>privateKeyBytes</var>.
<var>proofBytes</var> will be exactly 64 bytes in size.
</li>
<li>
Return <var>proofBytes</var> as the <em>digital proof</em>.
</li>
</ol>
</section>
<section>
<h4>Proof Verification (eddsa-2022)</h4>
<p>
The following algorithm specifies how to verify a digital signature from
a set of cryptographic hash data. This
algorithm is designed to be used in conjunction with the algorithms defined
in the Data Integrity [[VC-DATA-INTEGRITY]] specification,
<a data-cite="vc-data-integrity#algorithms">
Section 4: Algorithms</a>. Required inputs are
cryptographic hash data (<var>hashData</var>),
a digital signature (<var>proofBytes</var>) and
proof options (<var>options</var>). A <em>verification result</em>
represented as a boolean value is produced as output.
</p>
<ol class="algorithm">
<li>
Let <var>publicKeyBytes</var> be the result of retrieving the
public key bytes associated with the
<var>options</var>.<var>verificationMethod</var> value as described in the
Data Integrity [[VC-DATA-INTEGRITY]] specification,
<a data-cite="vc-data-integrity#algorithms">
Section 4: Retrieving Cryptographic Material</a>.
</li>
<li>
Let <var>verificationResult</var> be the result of applying the verification
algorithm for the Edwards-Curve Digital Signature Algorithm (EdDSA)
[[RFC8032]], using the `Ed25519` variant (Pure EdDSA),
with <var>hashData</var> as the data to be verified against the
<var>proofBytes</var> using the public key specified by
<var>publicKeyBytes</var>.
</li>
<li>
Return <var>verificationResult</var> as the <em>verification result</em>.
</li>
</ol>
</section>
</section>
<section>
<h3>jcs-eddsa-2022</h3>
<p class="issue" title="Cryptosuite naming convention is disputed">
The naming convention utilized by this cryptosuite is disputed. An alternative
of `json-eddsa-2022` was originally suggested for this cryptography suite to
convey that it is a cryptography suite for securing JSON data utilizing the
Twisted Edwards Curve Digital Signature Algorithm. The counter-argument to
the original proposal was that expressing the canonicalization mechanism in
the cryptosuite string clearly conveys to a developer that the thing that
differentiates this cryptosuite from the `eddsa-2022` one is the use of
JSON Canonicalization Scheme [[RFC8785]]. Other options include
`"cryptosuite": "json-sign-2022"`, and `"cryptosuite": "json-2022"`. This
topic is <a href="https://github.com/w3c/vc-data-integrity/issues/38">
currently being debated in the Data Integrity work item.</a>.
</p>
<p>
The `jcs-eddsa-2022` cryptographic suite takes an input document, canonicalizes
the document using the JSON Canonicalization Scheme [[RFC8785]], and then
cryptographically hashes and signs the output resulting in the production of a
data integrity proof. The algorithms for this cryptographic suite are the
same as the ones in Section <a href="#eddsa-2022"></a> except for the following
modifications:
</p>
<p>
In Section <a href="#transformation-eddsa-2022"></a>, step <strong>1)</strong>
and step <strong>2)</strong> are replaced by the following text:
</p>
<ol class="algorithm">
<li>
If <var>options</var>.<var>type</var> is not set to the string
`DataIntegrityProof` and <var>options</var>.<var>cryptosuite</var> is not
set to the string `jcs-eddsa-2022` then a `PROOF_TRANSFORMATION_ERROR` MUST be
raised.
</li>
<li>
Let <var>canonicalDocument</var> be the result of applying the
JSON Canonicalization Scheme [[RFC8785]] to the <var>unsecuredDocument</var>.
</li>
</ol>
<p>
In Section <a href="#proof-configuration-eddsa-2022"></a>, step
<strong>4)</strong> is replaced by the following text:
</p>
<p style="padding-left: 2em;">
<strong>4)</strong> If <var>options</var>.<var>type</var> is not set to
`DataIntegrityProof` and <var>proofConfig</var>.<var>cryptosuite</var> is not
set to `json-eddsa-2020`, an `INVALID_PROOF_CONFIGURATION` error MUST be raised.
</p>
</section>
</section>
<section>
<h2>Security Considerations</h2>
<p>
The following section describes security considerations that developers
implementing this specification should be aware of in order to create secure
software.
</p>
<p class="note">
This specification relies on URDNA2015, please review
[[RDF-CANON]].
</p>
<p class="note">
This specification relies on [[MULTIBASE]], [[MULTICODEC]] and [[RFC8032]].
</p>
<p class="issue">
There are <a href="https://eprint.iacr.org/2020/1244.pdf">
known mis-implementation attacks against multiple flavors of EdDSA</a>
implementations. We might want to warn about what to look out for and how to
mitigate the attacks.
</p>
</section>
<section>
<h2>Privacy Considerations</h2>
<p>
The following section describes privacy considerations that developers
implementing this specification should be aware of in order to avoid violating
privacy assumptions.
</p>
<p class="issue">
This cryptography suite does not provide for selective disclosure or
unlinkability. If signatures are re-used, they can be used as correlatable data.
</p>
</section>
<section class="appendix">
<h2>The Ed25519Signature2020 Suite</h2>
<p>
`Ed25519Signature2020` is an earlier version of a cryptographic suite
for the usage of the EdDSA algorithm and Curve25519. While it has
been used in production systems, new implementations should use <a href="#eddsa-2022">`edssa-2022`</a>
instead. It has been kept in this specification to provide a stable reference.
</p>
<section>
<h3>Data Model</h3>
<section>
<h3>Verification Methods</h3>
<section>
<h4>Ed25519VerificationKey2020</h4>
<p class="issue">
We need to add documentation to note that this key format is deployed and
widely used in production, but is deprecated. `Multikey` and `JsonWebKey2020`
supersede it.
</p>
<p>
The `type` of the verification method MUST be
<a href="#ed25519verificationkey2020">Ed25519VerificationKey2020</a>.
</p>
<p>
The `controller` of the verification method MUST be a URL.
</p>
<p>
The `publicKeyMultibase` property of the verification method MUST be
a public key encoded according to [[MULTICODEC]] and formatted according to
[[MULTIBASE]]. The multicodec encoding of a Ed25519 public key is the two-byte
prefix `0xed01` followed by the 32-byte public key data. The 34 byte
value is then encoded using base58-btc (`z`) as the prefix. Any other encoding
MUST NOT be allowed.
</p>
<p class="advisement">
Developers are advised to not accidentally publish a representation of a private
key. Implementations of this specification will raise errors in the event of a
[[MULTICODEC]] value other than `0xed01` being used in a
`publicKeyMultibase` value.
</p>
<pre class="example" title="An Ed25519 public key encoded as an
Ed25519VerificationKey2020">
{
"id": "https://example.com/issuer/123#key-0",
"type": "Ed25519VerificationKey2020",
"controller": "https://example.com/issuer/123",
"publicKeyMultibase": "z6Mkf5rGMoatrSj1f4CyvuHBeXJELe9RPdzo2PKGNCKVtZxP"
}
</pre>
<pre class="example" title="An Ed25519 public key encoded as an
Ed25519VerificationKey2020 in a controller document.">
{
"@context": [
"https://www.w3.org/ns/did/v1",
"https://w3id.org/security/suites/ed25519-2020/v1"
],
"id": "did:example:123",
"verificationMethod": [{
"id": "did:example:123#key-0",
"type": "Ed25519VerificationKey2020",
"controller": "did:example:123",
"publicKeyMultibase": "z6Mkf5rGMoatrSj1f4CyvuHBeXJELe9RPdzo2PKGNCKVtZxP"
}],
"authentication": [
"did:example:123#key-0"
],
"assertionMethod": [
"did:example:123#key-0"
],
"capabilityDelegation": [
"did:example:123#key-0"
],
"capabilityInvocation": [
"did:example:123#key-0"
]
}
</pre>
</section>
</section>
<section>
<h3>Proof representations</h3>
<section>
<h4>Ed25519Signature2020</h4>
<p>
The `verificationMethod` property of the proof MUST be a URL.
Dereferencing the `verificationMethod` MUST result in an object
containing a `type` property with the value set to
`Ed25519VerificationKey2020`.
</p>
<p>
The `type` property of the proof MUST be `Ed25519Signature2020`.
</p>
<p>
The `created` property of the proof MUST be an [[XMLSCHEMA11-2]]
formatted date string.
</p>
<p>
The `proofPurpose` property of the proof MUST be a string, and MUST
match the verification relationship expressed by the verification method
`controller`.
</p>
<p>
The `proofValue` property of the proof MUST be a detached EdDSA
produced according to [[RFC8032]], encoded according to [[MULTIBASE]] using
the base58-btc base encoding.
</p>
<pre class="example highlight" style="overflow-x:
auto; white-space: pre-wrap; word-wrap: break-word;"
title="An Ed25519 digital signature expressed as a
Ed25519Signature2020">
{
"@context": [
{"title": "https://schema.org/title"},
"https://w3id.org/security/data-integrity/v1"
],
"title": "Hello world!",
"proof": {
"type": "Ed25519Signature2020",
"created": "2020-11-05T19:23:24Z",
"verificationMethod": "https://di.example/issuer#z6MkjLrk3gKS2nnkeWcmcxi
ZPGskmesDpuwRBorgHxUXfxnG",
"proofPurpose": "assertionMethod",
"proofValue": "z4oey5q2M3XKaxup3tmzN4DRFTLVqpLMweBrSxMY2xHX5XTYVQeVbY8nQA
VHMrXFkXJpmEcqdoDwLWxaqA3Q1geV6"
}
}
</pre>
</section>
</section>
</section>
<section>
<h3>Algorithms</h3>
<section>
<h3>Ed25519Signature2020</h3>
<p>
The `Ed25519Signature2020` cryptographic suite takes an input document,
canonicalizes the document using the Universal RDF Dataset Canonicalization
Algorithm [[RDF-CANON]], and then cryptographically hashes and signs the output
resulting in the production of a data integrity proof. The algorithms in this
section also include the verification of such a data integrity proof.
</p>
<section>
<h4>Add Proof (Ed25519Signature2020)</h4>
<p>
To generate a proof, the algorithm in
<a data-cite="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 data-cite="vc-data-integrity#dfn-transformation-algorithm">
transformation algorithm</a> is defined in Section
<a href="#transformation-ed25519signature2020"></a>, the
<a data-cite="vc-data-integrity#dfn-hashing-algorithm">
hashing algorithm</a> is defined in Section <a href="hashing-ed25519signature2020"></a>,
and the
<a data-cite="vc-data-integrity#dfn-proof-serialization-algorithm">
proof serialization algorithm</a> is defined in Section
<a href="#proof-serialization-ed25519signature2020"></a>.
</p>
</section>
<section>
<h4>Verify Proof (Ed25519Signature2020)</h4>
<p>
To verify a proof, the algorithm in
<a data-cite="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 data-cite="vc-data-integrity#dfn-transformation-algorithm">
transformation algorithm</a> is defined in Section
<a href="#transformation-ed25519signature2020"></a>, the
<a data-cite="vc-data-integrity#dfn-hashing-algorithm">
hashing algorithm</a> is defined in Section <a href="#hashing-ed25519signature2020"></a>,
and the
<a data-cite="vc-data-integrity#dfn-proof-serialization-algorithm">
proof verification algorithm</a> is defined in Section
<a href="#proof-verification-ed25519signature2020"></a>.
</p>
</section>
<section>
<h4>Transformation (Ed25519Signature2020)</h4>
<p>
The following algorithm specifies how to transform an unsecured input document
into a transformed document that is ready to be provided as input to the
hashing algorithm in Section <a href="#hashing-ed25519signature2020"></a>.
</p>
<p>
Required inputs to this algorithm are an
<a data-cite="vc-data-integrity#dfn-unsecured-data-document">
unsecured data document</a> (<var>unsecuredDocument</var>) and
transformation options (<var>options</var>). The
transformation options MUST contain a type identifier for the
<a data-cite="vc-data-integrity#dfn-cryptosuite">
cryptographic suite</a> (<var>type</var>) and a cryptosuite
identifier (<var>cryptosuite</var>). A <em>transformed data document</em> is
produced as output. Whenever this algorithm encodes strings, it MUST use UTF-8
encoding.
</p>
<ol class="algorithm">
<li>
If <var>options</var>.<var>type</var> is not set to the string
`Ed25519Signature2020`, then a `PROOF_TRANSFORMATION_ERROR` MUST be raised.
</li>
<li>
Let <var>canonicalDocument</var> be the result of applying the
Universal RDF Dataset Canonicalization Algorithm
[[RDF-CANON]] to the <var>unsecuredDocument</var>.
</li>
<li>
Set <var>output</var> to the value of <var>canonicalDocument</var>.
</li>
<li>
Return <var>canonicalDocument</var> as the <em>transformed data document</em>.
</li>
</ol>
</section>
<section>
<h4>Hashing (Ed25519Signature2020)</h4>
<p>
The following algorithm specifies how to cryptographically hash a
<em>transformed data document</em> and <em>proof configuration</em>
into cryptographic hash data that is ready to be provided as input to the
algorithms in Section <a href="#proof-serialization-ed25519signature2020"></a> or
Section <a href="#proof-verification-ed25519signature2020"></a>.
</p>
<p>
The required inputs to this algorithm are a
<em>transformed data document</em> (<var>transformedDocument</var>) and