-
Notifications
You must be signed in to change notification settings - Fork 9
/
index.html
3896 lines (3551 loc) · 150 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>Data Integrity ECDSA Cryptosuites v1.0</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-integrity/common.js"></script>
<script type="text/javascript" class="remove">
var respecConfig = {
subtitle: "Achieving Data Integrity using ECDSA with NIST-compliant curves",
// specification status (e.g. WD, LCWD, NOTE, etc.). If in doubt use ED.
group: "vc",
specStatus: "CR",
// the specification's short name, as in http://www.w3.org/TR/short-name/
shortName: "vc-di-ecdsa",
// if you wish the publication date to be other than today, set this
publishDate: "2024-11-05",
// 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-ecdsa/",
//latestVersion: "https://www.w3.org/community/reports/credentials/CG-FINAL-di-ecdsa-2019-20220724/",
// if this is a LCWD, uncomment and set the end of its review period
implementationReportURI: "https://w3c.github.io/vc-di-ecdsa-test-suite/",
crEnd: "2024-12-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: "Marty Reed",
url: "https://www.linkedin.com/in/marty-reed-b5b2352/",
company: "RANDA Solutions",
companyURL: "https://www.randasolutions.com/",
w3cid: 127611
}, {
name: "Greg Bernstein", url: "https://www.grotto-networking.com/",
company: "Invited Expert", w3cid: 140479
}, {
name: "Sebastian Crane", url: "https://github.com/seabass-labrax",
company: "Invited Expert", w3cid: 140132
}],
// 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: "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
}],
// extend the bibliography entries
//localBiblio: webpayments.localBiblio,
// 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/w3c/vc-di-ecdsa/",
// 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: {
SECG2: {
title: "SEC 2: Recommended Elliptic Curve Domain Parameters",
href: "https://www.secg.org/sec2-v2.pdf",
date: "January 27, 2010",
publisher: "Certicom Research"
},
"NIST-SP-800-186": {
title: "Recommendations for Discrete Logarithm-based Cryptography: Elliptic Curve Domain Parameters",
authors: ["Lily Chen", "Dustin Moody", "Karen Randall", "Andrew Regenscheid", "Angela Robinson"],
date: "February 2023",
publisher: "National Institute of Standards and Technology"
},
"NIST-SP-800-186": {
title: "Recommendations for Discrete Logarithm-based Cryptography: Elliptic Curve Domain Parameters",
authors: ["Lily Chen", "Dustin Moody", "Karen Randall", "Andrew Regenscheid", "Angela Robinson"],
date: "February 2023",
publisher: "National Institute of Standards and Technology"
},
"NIST-SP-800-57-Part-1": {
title: "Recommendation for Key Management: Part 1 – General",
authors: ["Elaine Barker"],
date: "May 2020",
publisher: "National Institute of Standards and Technology",
href: "https://doi.org/10.6028/NIST.SP.800-57pt1r5"
}
},
xref: ["INFRA", "VC-DATA-MODEL-2.0", "VC-DATA-INTEGRITY"],
lint: { "informative-dfn": false },
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: "Controller Documents v1.0",
href: "https://www.w3.org/TR/controller-document/"
}, {
value: "Data Integrity EdDSA Cryptosuites v1.0",
href: "https://www.w3.org/TR/vc-di-eddsa/"
}, {
value: "Data Integrity BBS Cryptosuites v1.0",
href: "https://www.w3.org/TR/vc-di-bbs/"
}]
}]
};
</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 Data Integrity cryptosuites for use when
generating a digital signature using the Elliptic Curve Digital Signature
Algorithm (ECDSA).
</p>
</section>
<section id="sotd">
<p>
The Working Group is actively seeking implementation feedback for this
specification. In order to exit the Candidate Recommendation phase, the
Working Group has set the requirement of at least two independent
implementations for each mandatory feature in the specification. For details
on the conformance testing process, see the test suites listed in the
<a href="https://w3c.github.io/vc-di-ecdsa-test-suite/">
implementation report</a>.
</p>
<p class="atrisk issue"
title="Features with less than two independent implementations">
Any feature with less than two independent implementations in the
<a href="https://w3c.github.io/vc-di-ecdsa-test-suite/">
ECDSA Cryptosuite Implementation Report</a> is an "at risk" feature and might be
removed before the transition to W3C Proposed Recommendation.
</p>
</section>
<section>
<h2>Introduction</h2>
<p>
This specification defines a cryptographic suite for the purpose of creating,
and verifying proofs for ECDSA signatures in conformance with the
Data Integrity [[VC-DATA-INTEGRITY]] specification. ECDSA signatures are
specified in [[FIPS-186-5]] with elliptic curves P-256 and P-384 specified in
[[NIST-SP-800-186]]. [[FIPS-186-5]] includes the <em>deterministic</em> ECDSA
algorithm which is also specified in [[RFC6979]].
</p>
<div class="note">
<p>
The elliptic curves P-256 and P-384 of [[NIST-SP-800-186]] are respectively referred
to as <em>secp256r1</em> and <em>secp384r1</em> in [[SECG2]]. This notation is
sometimes also used by ECDSA software libraries.
</p>
<p>
Developers are cautioned to not confuse <em>secp256<b>r</b>1</em> terms with
<em>secp256<b>k</b>1</em> terms; the latter are from a third, <em>different</em>,
elliptic curve, that is not used by this specification. ECDSA software libraries
might not implement all of these curves, so developers need to take care when
choosing an ECDSA software library for their implementation.
</p>
</div>
<p>
This specification uses either the RDF Dataset Canonicalization Algorithm
[[RDF-CANON]] or the JSON Canonicalization Scheme [[RFC8785]] to transform the
input document into its canonical form. It uses one of two mechanisms to digest
and sign: SHA-256 [[RFC6234]] as the message digest algorithm and ECDSA with
Curve P-256 as the signature algorithm, or SHA-384 [[RFC6234]] as the message
digest algorithm and ECDSA with Curve P-384 as the signature algorithm.
</p>
<section id="terminology">
<h3>Terminology</h3>
<p>
Terminology used throughout this document is defined in the
<a data-cite="VC-DATA-INTEGRITY#terminology">Terminology</a> section of the
[[[VC-DATA-INTEGRITY]]] specification.
</p>
</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
[[[#data-model]]] and [[[#algorithms]]]
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
[=conforming proof=]. 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>
<section>
<h2>Data Model</h2>
<p>
The following sections outline the data model that is used by this specification
to express verification methods, such as cryptographic public keys, and
data integrity proofs, such as digital signatures.
</p>
<section>
<h3>Verification Methods</h3>
<p>
These verification methods are used to verify Data Integrity Proofs
[[VC-DATA-INTEGRITY]] produced using Elliptic Curve cryptographic key material
that is compliant with [[FIPS-186-5]]. The encoding formats for these key types
are provided in this section. Lossless cryptographic key transformation
processes that result in equivalent cryptographic key material MAY be used
during the processing of digital signatures.
</p>
<section>
<h4>Multikey</h4>
<p>
The <a data-cite="controller-document#multikey">Multikey format</a>, defined in
[[[controller-document]]], is used to express public keys for the cryptographic
suites defined in this specification.
</p>
<p>
The `publicKeyMultibase` property represents a Multibase-encoded Multikey
expression of a P-256 or P-384 public key.
</p>
<p>
The `publicKeyMultibase` value of the verification method MUST start with the
base-58-btc prefix (`z`), as defined in the
<a data-cite="controller-document#multibase-0">Multibase section</a> of
[[[controller-document]]]. A Multibase-encoded ECDSA 256-bit public key value or
an ECDSA 384-bit public key value follows, as defined in the
<a data-cite="controller-document#Multikey">Multikey section</a> of
[[[controller-document]]]. 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 `0x1200` or `0x1201` being used in a
`publicKeyMultibase` value.
</p>
<pre class="example nohighlight"
title="An P-256 public key encoded as a Multikey">
{
"id": "https://example.com/issuer/123#key-0",
"type": "Multikey",
"controller": "https://example.com/issuer/123",
"publicKeyMultibase": "zDnaerx9CtbPJ1q36T5Ln5wYt3MQYeGRG5ehnPAmxcf5mDZpv"
}
</pre>
<pre class="example nohighlight"
title="An P-384 public key encoded as a Multikey">
{
"id": "https://example.com/issuer/123#key-0",
"type": "Multikey",
"controller": "https://example.com/issuer/123",
"publicKeyMultibase": "z82LkvCwHNreneWpsgPEbV3gu1C6NFJEBg4srfJ5gdxEsMGRJ
Uz2sG9FE42shbn2xkZJh54"
}
</pre>
<pre class="example nohighlight" title="Two public keys (P-256 and P-384)
encoded as Multikeys in a controller document">
{
"@context": [
"https://www.w3.org/ns/did/v1",
"https://w3id.org/security/multikey/v1"
],
"id": "did:example:123",
"verificationMethod": [{
"id": "https://example.com/issuer/123#key-1",
"type": "Multikey",
"controller": "https://example.com/issuer/123",
"publicKeyMultibase": "zDnaerx9CtbPJ1q36T5Ln5wYt3MQYeGRG5ehnPAmxcf5mDZpv"
}, {
"id": "https://example.com/issuer/123#key-2",
"type": "Multikey",
"controller": "https://example.com/issuer/123",
"publicKeyMultibase": "z82LkvCwHNreneWpsgPEbV3gu1C6NFJEBg4srfJ5gdxEsMGRJ
Uz2sG9FE42shbn2xkZJh54"
}],
"authentication": [
"did:example:123#key-1"
],
"assertionMethod": [
"did:example:123#key-2"
],
"capabilityDelegation": [
"did:example:123#key-2"
],
"capabilityInvocation": [
"did:example:123#key-2"
]
}
</pre>
<p>
The `secretKeyMultibase` property represents a Multibase-encoded Multikey
expression of a P-256 or P-384 secret key (also sometimes referred to as a
private key).
</p>
<p>
The `secretKeyMultibase` value of the verification method MUST start with the
base-58-btc prefix (`z`), as defined in the
<a data-cite="controller-document#multibase-0">Multibase section</a> of
[[[controller-document]]]. A Multibase-encoded ECDSA 256-bit secret key value or
an ECDSA 384-bit secret key value follows, as defined in the
<a data-cite="controller-document#Multikey">Multikey section</a> of
[[[controller-document]]]. Any other encoding MUST NOT be allowed.
</p>
<p class="advisement">
Developers are advised to prevent accidental publication of a representation of a secret
key, and to not export the `secretKeyMultibase` property by default, when serializing
key pairs as Multikey.
</p>
</section>
</section>
<section>
<h3>Proof Representations</h3>
<p>
This section details the proof representation formats that are defined by
this specification.
</p>
<section>
<h4>DataIntegrityProof</h4>
<p>
A proof contains the attributes specified in the
<a href="https://www.w3.org/TR/vc-data-integrity/#proofs">Proofs section</a>
of [[VC-DATA-INTEGRITY]] with the following restrictions.
</p>
<p>
The `type` property MUST be `DataIntegrityProof`.
</p>
<p>
The `cryptosuite` property MUST be `ecdsa-rdfc-2019`,
`ecdsa-jcs-2019`, or `ecdsa-sd-2023`.
</p>
<p>
The value of the `proofValue` property is produced according to
the `cryptosuite` type and is specified in either
Section [[[#create-proof-ecdsa-rdfc-2019]]], or
Section [[[#create-proof-ecdsa-jcs-2019]]], or
Section [[[#create-base-proof-ecdsa-sd-2023]]], or
Section [[[#add-derived-proof-ecdsa-sd-2023]]].
</p>
<pre class="example nohighlight"
title="An ECDSA P-256 digital signature expressed as a
DataIntegrityProof">
{
"@context": [
{"myWebsite": "https://vocabulary.example/myWebsite"},
"https://www.w3.org/ns/credentials/v2"
],
"myWebsite": "https://hello.world.example/",
"proof": {
"type": "DataIntegrityProof",
"cryptosuite": "ecdsa-rdfc-2019",
"created": "2023-02-24T23:36:38Z",
"verificationMethod": "https://vc.example/issuers/5678#zDnaepBuvsQ8cpsWrVKw8
fbpGpvPeNSjVPTWoq6cRqaYzBKVP",
"proofPurpose": "assertionMethod",
"proofValue": "z2iAR3F2Sk3mWfYyrinKzSQpSbvfxnz9kkv7roxxumB5RZDP9JUw5QAXuchUd
huiwE18hyyZTjiEreKmhH3oj9Q8"
}
}
</pre>
</section>
</section>
</section>
<section>
<h2>Algorithms</h2>
<p>
The following section describes multiple Data Integrity cryptographic suites
that utilize the Elliptic Curve Digital Signature Algorithm (ECDSA)
[[FIPS-186-5]]. When generating ECDSA signatures, the signature value MUST be
expressed according to section 7 of [[RFC4754]] (sometimes referred to as the
IEEE P1363 format) and encoded according to the specific cryptosuite proof
generation algorithm. All ECDSA signatures SHOULD use the <em>deterministic</em>
variant of the algorithm defined in [[FIPS-186-5]].
</p>
<p>
Implementations SHOULD fetch and cache verification method information as
early as possible when adding or verifying proofs. Parameters passed to
functions in this section use information from the verification method
— such as the public key size — to determine function parameters
— such as the cryptographic hashing algorithm.
</p>
<p id="canon-and-hash">
When the RDF Dataset Canonicalization Algorithm (RDFC-1.0) [[RDF-CANON]] is used
with ECDSA algorithms, the cryptographic hashing function used by RDFC-1.0 is
chosen based on the size of the associated public key. For P-256 keys, the
default hashing function, SHA-2 with 256 bits of output, MUST be used. For P-384
keys, SHA-2 with 384-bits of output MUST be used, specified via the RDFC-1.0
<a data-cite="RDF-CANON#dfn-hash-algorithm">implementation-specific parameter</a>.
</p>
<p class="advisement">
When the RDF Dataset Canonicalization Algorithm [[RDF-CANON]] is used,
implementations of that algorithm will detect
<a data-cite="RDF-CANON#dataset-poisoning">dataset poisoning</a>
by default, and abort processing upon detection.
</p>
<section>
<h3>Instantiate Cryptosuite</h3>
<p>
This algorithm is used to configure a cryptographic suite to be used by the
<a data-cite="VC-DATA-INTEGRITY#add-proof">Add Proof</a> and
<a href="VC-DATA-INTEGRITY#verify-proof">Verify Proof</a>
functions in [[[VC-DATA-INTEGRITY]]]. The algorithm takes an options object
([=map=] |options|) as input and returns a [=data integrity cryptographic suite
instance|cryptosuite instance=] ([=struct=] |cryptosuite|).
</p>
<ol class="algorithm">
<li>
Initialize |cryptosuite| to an empty [=struct=].
</li>
<li>
If |options|.|type| does not equal `DataIntegrityProof`, return |cryptosuite|.
</li>
<li>
If |options|.|cryptosuite| is `ecdsa-rdfc-2019` then:
<ol class="algorithm">
<li>
Set |cryptosuite|.|createProof| to the algorithm in Section
[[[#create-proof-ecdsa-rdfc-2019]]].
</li>
<li>
Set |cryptosuite|.|verifyProof| to the algorithm in Section
[[[#proof-verification-ecdsa-rdfc-2019]]].
</li>
</ol>
</li>
<li>
If |options|.|cryptosuite| is `ecdsa-jcs-2019` then:
<ol class="algorithm">
<li>
Set |cryptosuite|.|createProof| to the algorithm in Section
[[[#create-proof-ecdsa-jcs-2019]]].
</li>
<li>
Set |cryptosuite|.|verifyProof| to the algorithm in Section
[[[#proof-verification-ecdsa-jcs-2019]]].
</li>
</ol>
</li>
<li>
If |options|.|cryptosuite| is `ecdsa-sd-2023` then:
<ol class="algorithm">
<li>
Set |cryptosuite|.|createProof| to the algorithm in Section
[[[#create-base-proof-ecdsa-sd-2023]]].
</li>
<li>
Set |cryptosuite|.|verifyProof| to the algorithm in Section
[[[#verify-derived-proof-ecdsa-sd-2023]]].
</li>
</ol>
</li>
<li>
Return |cryptosuite|.
</li>
</ol>
</section>
<section>
<h3>ecdsa-rdfc-2019</h3>
<p>
The `ecdsa-rdfc-2019` cryptographic suite takes an input document, canonicalizes
the document using the [[[RDF-CANON]]]
[[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>Create Proof (ecdsa-rdfc-2019)</h4>
<p>
The following algorithm specifies how to create a [=data integrity proof=] given
an <a>unsecured data document</a>. Required inputs are an
<a>unsecured data document</a> ([=map=] |unsecuredDocument|), and a set of proof
options ([=map=] |options|). A [=data integrity proof=] ([=map=]), or an error,
is produced as output.
</p>
<ol class="algorithm">
<li>
Let |proof| be a clone of the proof options, |options|.
</li>
<li>
Let |proofConfig| be the result of running the algorithm in
Section [[[#proof-configuration-ecdsa-rdfc-2019]]] with
|options| passed as a parameter.
</li>
<li>
Let |transformedData| be the result of running the algorithm in Section <a
href="#transformation-ecdsa-rdfc-2019"></a> with |unsecuredDocument|,
|proofConfig|, and |options| passed as parameters.
</li>
<li>
Let |hashData| be the result of running the algorithm in Section
[[[#hashing-ecdsa-rdfc-2019]]] with |transformedData| and |proofConfig|
passed as a parameters.
</li>
<li>
Let |proofBytes| be the result of running the algorithm in Section
[[[#proof-serialization-ecdsa-rdfc-2019]]] with |hashData| and
|options| passed as parameters.
</li>
<li>
Let |proof|.|proofValue| be a <a data-cite="controller-document#multibase-0">
base58-btc-encoded Multibase value</a> of the |proofBytes|.
</li>
<li>
Return |proof| as the [=data integrity proof=].
</li>
</ol>
</section>
<section>
<h4>Verify Proof (ecdsa-rdfc-2019)</h4>
<p>
The following algorithm specifies how to verify a [=data integrity proof=] given
an <a>secured data document</a>. Required inputs are an
<a>secured data document</a> ([=map=] |securedDocument|). This algorithm returns
a <dfn>verification result</dfn>, which is a [=struct=] whose
[=struct/items=] are:
</p>
<dl>
<dt><dfn data-dfn-for="verification result">verified</dfn></dt>
<dd>`true` or `false`</dd>
<dt><dfn data-dfn-for="verification result">verifiedDocument</dfn></dt>
<dd>
<a data-cite="INFRA#nulls">Null</a>, if [=verification result/verified=] is
`false`; otherwise, an [=unsecured data document=]
</dd>
</dl>
<ol class="algorithm">
<li>
Let |unsecuredDocument| be a copy of |securedDocument| with
the `proof` value removed.
</li>
<li>
Let |proofConfig| be a copy of |securedDocument|.|proof| with `proofValue`
removed.
</li>
<li>
Let |proofBytes| be the
<a data-cite="controller-document#multibase-0">Multibase decoded base58-btc
value</a> in |securedDocument|.|proof|.|proofValue|.
</li>
<li>
Let |transformedData| be the result of running the algorithm in Section <a
href="#transformation-ecdsa-rdfc-2019"></a> with |unsecuredDocument| and
|proofConfig| passed as parameters.
</li>
<li>
Let |hashData| be the result of running the algorithm in Section
[[[#hashing-ecdsa-rdfc-2019]]] with |transformedData| and |proofConfig|
passed as a parameters.
</li>
<li>
Let |verified:boolean| be the result of running the algorithm in Section
[[[#proof-verification-ecdsa-rdfc-2019]]] algorithm on |hashData|,
|proofBytes|, and |proofConfig|.
</li>
<li>
Return a [=verification result=] with [=struct/items=]:
<dl data-link-for="verification result">
<dt>[=verified=]</dt>
<dd>|verified|</dd>
<dt>[=verifiedDocument=]</dt>
<dd>
|unsecuredDocument| if |verified| is `true`, otherwise <a data-cite="INFRA#nulls">Null</a></dd>
</dl>
</li>
</ol>
</section>
<section>
<h4>Transformation (ecdsa-rdfc-2019)</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 [[[#hashing-ecdsa-rdfc-2019]]].
</p>
<p>
Required inputs to this algorithm are an
<a data-cite="vc-data-integrity#dfn-unsecured-data-document">
unsecured data document</a> (|unsecuredDocument|) and
transformation options (|options|). The
transformation options MUST contain a type identifier for the
<a data-cite="vc-data-integrity#dfn-cryptosuite">
cryptographic suite</a> (|type|) and a cryptosuite
identifier (|cryptosuite|). 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 |options|.|type| is not set to the string
`DataIntegrityProof` and |options|.|cryptosuite| is not
set to the string `ecdsa-rdfc-2019`,
an error MUST be raised and SHOULD convey an error type of
<a data-cite="VC-DATA-INTEGRITY#PROOF_TRANSFORMATION_ERROR">PROOF_TRANSFORMATION_ERROR</a>.
</li>
<li>
Let |canonicalDocument| be the result of converting |unsecuredDocument| to
<a data-cite="JSON-LD11-API#expansion-algorithm">JSON-LD expanded form</a>
and then <a data-cite="JSON-LD11-API#deserialize-json-ld-to-rdf-algorithm">
to RDF statements</a>, applying the <a data-cite="RDF-CANON#canon-algorithm">RDF Dataset Canonicalization
Algorithm</a> [[RDF-CANON]] to the result, and then serializing the result to a
<a data-cite="RDF-CANON#dfn-serialized-canonical-form">serialized canonical form</a> [[RDF-CANON]].
For canonicalization, one is expected to use a hash algorithm that has an appropriate security level for
the curve used; see <a href="#canon-and-hash">further details</a>.
</li>
<li>
Return |canonicalDocument| as the <em>transformed data document</em>.
</li>
</ol>
</section>
<section>
<h4>Hashing (ecdsa-rdfc-2019)</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 [[[#proof-serialization-ecdsa-rdfc-2019]]] or
Section [[[#proof-verification-ecdsa-rdfc-2019]]]. One must use the hash
algorithm appropriate in security level to the curve used, i.e., for curve
P-256 one uses SHA-256 and for curve P-384 one uses SHA-384.
</p>
<p>
The required inputs to this algorithm are a <em>transformed data document</em>
(|transformedDocument|) and <em>canonical proof configuration</em>
(|canonicalProofConfig|). A single <em>hash data</em> value represented as
series of bytes is produced as output.
</p>
<ol class="algorithm">
<li>
Let |transformedDocumentHash| be the result of applying the
SHA-256 (SHA-2 with 256-bit output) or SHA-384 (SHA-2 with 384-bit output)
cryptographic hashing algorithm [[RFC6234]] to the
respective curve P-256 or curve P-384 |transformedDocument|.
Respective |transformedDocumentHash| will be exactly 32 or 48 bytes
in size.
</li>
<li>
Let |proofConfigHash| be the result of applying the
SHA-256 (SHA-2 with 256-bit output) or SHA-384 (SHA-2 with 384-bit output)
cryptographic hashing algorithm [[RFC6234]] to the respective curve P-256 or curve P-384
|canonicalProofConfig|. Respective |proofConfigHash|
will be exactly 32 or 48 bytes in size.
</li>
<li>
Let |hashData| be the result of joining |proofConfigHash| (the
first hash) with |transformedDocumentHash| (the second hash).
</li>
<li>
Return |hashData| as the <em>hash data</em>.
</li>
</ol>
</section>
<section>
<h4>Proof Configuration (ecdsa-rdfc-2019)</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-ecdsa-rdfc-2019">proof hashing algorithm</a>.
</p>
<p>
The required inputs to this algorithm are <em>proof options</em>
(|options|). The <em>proof options</em> MUST contain a type identifier
for the
<a data-cite="vc-data-integrity#dfn-cryptosuite">
cryptographic suite</a> (|type|) and MUST contain a cryptosuite
identifier (|cryptosuite|). A <em>proof configuration</em>
object is produced as output.
</p>
<ol class="algorithm">
<li>
Let |proofConfig| be a clone of the |options| object.
</li>
<li>
If |proofConfig|.|type| is not set to `DataIntegrityProof` and/or
|proofConfig|.|cryptosuite| is not set to `ecdsa-rdfc-2019`, an
error MUST be raised and SHOULD convey an error type of
<a data-cite="VC-DATA-INTEGRITY#PROOF_GENERATION_ERROR">PROOF_GENERATION_ERROR</a>.
</li>
<li>
If |proofConfig|.|created| is set and if the value is not a
valid [[XMLSCHEMA11-2]] datetime, an error MUST be
raised and SHOULD convey an error type of
<a data-cite="VC-DATA-INTEGRITY#PROOF_GENERATION_ERROR">PROOF_GENERATION_ERROR</a>.
</li>
<li>
Set |proofConfig|.<var>@context</var> to
|unsecuredDocument|.<var>@context</var>.
</li>
<li>
Let |canonicalProofConfig| be the result of applying the
[[[RDF-CANON]]] [[RDF-CANON]] to the |proofConfig|.
</li>
<li>
Return |canonicalProofConfig|.
</li>
</ol>
</section>
<section>
<h4>Proof Serialization (ecdsa-rdfc-2019)</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 (|hashData|) and
<em>proof options</em> (|options|). The
<em>proof options</em> MUST contain a type identifier for the
<a data-cite="vc-data-integrity#dfn-cryptosuite">
cryptographic suite</a> (|type|) and MAY contain a cryptosuite
identifier (|cryptosuite|). A single <em>digital proof</em> value
represented as series of bytes is produced as output.
</p>
<ol class="algorithm">
<li>
Let |privateKeyBytes| be the result of retrieving the
private key bytes (or a signing interface enabling the use of the private key
bytes) associated with the verification method identified by the
|options|.|verificationMethod| value.
</li>
<li>
Let |proofBytes| be the result of applying the Elliptic Curve Digital
Signature Algorithm (ECDSA) [[FIPS-186-5]], with |hashData| as the data
to be signed using the private key specified by |privateKeyBytes|.
|proofBytes| will be exactly 64 bytes in size for a P-256 key, and
96 bytes in size for a P-384 key.
</li>
<li>
Return |proofBytes| as the <em>digital proof</em>.
</li>
</ol>
</section>
<section>
<h4>Proof Verification (ecdsa-rdfc-2019)</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 (|hashData|),
a digital signature (|proofBytes|) and
proof options (|options|). A <em>verification result</em>
represented as a boolean value is produced as output.
</p>
<ol class="algorithm">
<li>
Let |publicKeyBytes| be the result of retrieving the
public key bytes associated with the
|options|.|verificationMethod| value as described in the
[[[controller-document]]] specification,
<a data-cite="controller-document#retrieve-verification-method">
Section: Retrieve Verification Method</a>.
</li>
<li>
Let |verificationResult| be the result of applying the verification
algorithm Elliptic Curve Digital Signature Algorithm (ECDSA) [[FIPS-186-5]],
with |hashData| as the data to be verified against the
|proofBytes| using the public key specified by
|publicKeyBytes|.
</li>
<li>
Return |verificationResult| as the <em>verification result</em>.
</li>
</ol>
</section>
</section>
<section>
<h3>ecdsa-jcs-2019</h3>
<p>
The `ecdsa-jcs-2019` 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 in this
section also include the verification of such a data integrity proof.
</p>
<section>
<h4>Create Proof (ecdsa-jcs-2019)</h4>
<p>
The following algorithm specifies how to create a [=data integrity proof=] given
an <a>unsecured data document</a>. Required inputs are an
<a>unsecured data document</a> ([=map=] |unsecuredDocument|), and a set of proof
options ([=map=] |options|). A [=data integrity proof=] ([=map=]), or an error,
is produced as output.
</p>
<ol class="algorithm">
<li>
Let |proof| be a clone of the proof options, |options|.
</li>
<li>
If <var>unsecuredDocument</var>.<var>@context</var> is present, set
<var>proof</var>.<var>@context</var> to
<var>unsecuredDocument</var>.<var>@context</var>.
</li>
<li>
Let |proofConfig| be the result of running the algorithm in
Section [[[#proof-configuration-ecdsa-jcs-2019]]] with
|proof| passed as the <em>proof options</em> parameter.
</li>
<li>
Let |transformedData| be the result of running the algorithm in Section <a
href="#transformation-ecdsa-jcs-2019"></a> with |unsecuredDocument|
and |options| passed as parameters.
</li>
<li>
Let |hashData| be the result of running the algorithm in Section
[[[#hashing-ecdsa-jcs-2019]]] with |transformedData| and |proofConfig|
passed as a parameters.
</li>
<li>
Let |proofBytes| be the result of running the algorithm in Section
[[[#proof-serialization-ecdsa-jcs-2019]]] with |hashData| and
|options| passed as parameters.
</li>
<li>
Let |proof|.|proofValue| be a <a data-cite="controller-document#multibase-0">
base58-btc-encoded Multibase value</a> of the |proofBytes|.
</li>
<li>
Return |proof| as the [=data integrity proof=].
</li>
</ol>
</section>
<section>
<h4>Verify Proof (ecdsa-jcs-2019)</h4>
<p>
The following algorithm specifies how to verify a [=data integrity proof=] given
an <a>secured data document</a>. Required inputs are an
<a>secured data document</a> ([=map=] |securedDocument|). This algorithm returns
a [=verification result=], which is a [=struct=] whose [=struct/items=] are:
</p>
<dl>
<dt>[=verification result/verified=]</dt>
<dd>`true` or `false`</dd>