forked from google/certificate-transparency-rfcs
/
rfc6962-bis.xml
1816 lines (1751 loc) · 108 KB
/
rfc6962-bis.xml
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
<?xml version="1.0" encoding="US-ASCII"?>
<!DOCTYPE rfc SYSTEM "rfc2629.dtd" [
<!ENTITY rfc2119 PUBLIC ''
'http://xml.resource.org/public/rfc/bibxml/reference.RFC.2119.xml'>
]>
<?rfc symrefs="yes"?>
<?rfc toc="yes"?>
<?rfc rfcedstyle="yes"?>
<?rfc compact="yes"?>
<?rfc subcompact="no"?>
<?rfc sortrefs="yes" ?>
<rfc ipr="trust200902" category="std" submissionType="IETF" docName="draft-ietf-trans-rfc6962-bis-12">
<front>
<title>Certificate Transparency</title>
<author initials="B" surname="Laurie" fullname="Ben Laurie">
<organization abbrev="Google">
Google UK Ltd.
</organization>
<address>
<email>benl@google.com</email>
</address>
</author>
<author initials="A" surname="Langley" fullname="Adam Langley">
<organization abbrev="Google">
Google Inc.
</organization>
<address>
<email>agl@google.com</email>
</address>
</author>
<author initials="E" surname="Kasper" fullname="Emilia Kasper">
<organization abbrev="Google">
Google Switzerland GmbH
</organization>
<address>
<email>ekasper@google.com</email>
</address>
</author>
<author initials="E" surname="Messeri" fullname="Eran Messeri">
<organization abbrev="Google">
Google UK Ltd.
</organization>
<address>
<email>eranm@google.com</email>
</address>
</author>
<author initials="R" surname="Stradling" fullname="Rob Stradling">
<organization abbrev="Comodo">
Comodo CA, Ltd.
</organization>
<address>
<email>rob.stradling@comodo.com</email>
</address>
</author>
<date />
<workgroup>Public Notary Transparency Working Group</workgroup>
<abstract>
<t>
This document describes a protocol for publicly logging
the existence of Transport Layer Security (TLS) certificates as they are issued
or observed, in a manner that allows anyone to audit certification authority (CA)
activity and notice the issuance of suspect certificates as well as to audit
the certificate logs themselves. The intent is that eventually clients would
refuse to honor certificates that do not appear in a log, effectively forcing
CAs to add all issued certificates to the logs.
</t>
<t>
Logs are network services that implement the protocol operations for
submissions and queries that are defined in this document.
</t>
</abstract>
</front>
<middle>
<section title="Introduction">
<t>
Certificate transparency aims to mitigate the problem of misissued
certificates by providing append-only logs of issued certificates. The logs
do not need to be trusted because they are publicly auditable. Anyone may verify
the correctness of each log and monitor when new certificates are added to it.
The logs do not themselves prevent misissue, but
they ensure that interested parties (particularly those named in certificates)
can detect such misissuance. Note that this is a general mechanism, but in this
document, we only describe its use for public TLS server certificates issued by
public certification authorities (CAs).
</t>
<t>
Each log consists of certificate chains, which can be submitted by
anyone. It is expected that public CAs will contribute all their newly issued
certificates to one or more logs, however certificate holders
can also contribute their own certificate chains, as can third parties. In order to avoid logs being
rendered useless by submitting large numbers of spurious certificates, it is required that each chain is rooted in a
CA certificate accepted by the log. When a chain is submitted to a log, a signed timestamp is
returned, which can later be used to provide evidence to TLS clients that the chain
has been submitted. TLS clients can thus require that all certificates they accept as valid are accompanied by signed timestamps.
</t>
<t>
Those who are concerned about misissue can monitor the logs, asking
them regularly for all new entries, and can thus check whether domains they are
responsible for have had certificates issued that they did not expect. What
they do with this information, particularly when they find that a misissuance
has happened, is beyond the scope of this document, but broadly speaking, they
can invoke existing business mechanisms for dealing with misissued
certificates, such as working with the CA to get the certificate revoked, or with maintainers of trust anchor lists to get the CA removed. Of course, anyone who wants can monitor the logs and, if they
believe a certificate is incorrectly issued, take action as they see fit.
</t>
<t>
Similarly, those who have seen signed timestamps from a particular log can later demand a proof of inclusion from that log. If the log is unable to provide this (or, indeed, if the corresponding certificate is absent from monitors' copies of that log), that is evidence of the incorrect operation of the log. The checking operation is asynchronous to allow TLS connections to proceed without delay, despite network connectivity issues and the vagaries of firewalls.
</t>
<t>
The append-only property of each log is technically achieved using Merkle Trees, which can be used to show that any particular instance of the log is a superset of any particular previous instance. Likewise, Merkle Trees avoid the need to blindly trust logs: if a log attempts to show different things to different people, this can be efficiently detected by comparing tree roots and consistency proofs. Similarly, other misbehaviors of any log (e.g., issuing signed timestamps for certificates they then don't log) can be efficiently detected and proved to the world at large.
</t>
<section title="Requirements Language">
<t>
The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this document are to be interpreted as described in <xref target="RFC2119">RFC 2119</xref>.
</t>
</section>
<section title="Data Structures">
<t>
Data structures are defined according to the conventions laid out in
Section 4 of <xref target="RFC5246"/>.
</t>
</section>
</section>
<section title="Cryptographic Components">
<section title="Merkle Hash Trees" anchor="mht">
<t>
Logs use a binary Merkle Hash Tree for efficient auditing. The hashing algorithm used by each log is expected to be specified as part of the metadata relating to that log. We have established a registry of acceptable algorithms, see <xref target="hash_algorithms"/>. The hashing algorithm in use is referred to as HASH throughout this document and the size of its output in bytes as HASH_SIZE. The input to the Merkle Tree Hash is a list
of data entries; these entries will be hashed to form the leaves of the Merkle
Hash Tree. The output is a single HASH_SIZE Merkle Tree Hash. Given an ordered
list of n inputs, D[n] = {d(0), d(1), ..., d(n-1)}, the Merkle Tree Hash (MTH)
is thus defined as follows:
</t>
<t>
The hash of an empty list is the hash of an empty string:
<vspace blankLines='1' />
MTH({}) = HASH().
<vspace blankLines='1' />
The hash of a list with one entry (also known as a leaf hash) is:
<vspace blankLines='1' />
MTH({d(0)}) = HASH(0x00 || d(0)).
<vspace blankLines='1' />
For n > 1, let k be the largest power of two smaller than n (i.e., k < n <= 2k). The Merkle Tree Hash of an n-element list D[n] is then defined recursively as
<vspace blankLines='1' />
MTH(D[n]) = HASH(0x01 || MTH(D[0:k]) || MTH(D[k:n])),
<vspace blankLines='1' />
where || is concatenation and D[k1:k2] denotes the list {d(k1), d(k1+1),..., d(k2-1)} of length (k2 - k1). (Note that the hash calculations for leaves and nodes differ. This domain separation is required to give second preimage resistance.)
</t>
<t>
Note that we do not require the length of the input list to be a
power of two. The resulting Merkle Tree may thus not be balanced; however, its
shape is uniquely determined by the number of leaves. (Note: This Merkle Tree is
essentially the same as the <xref target='CrosbyWallach'>history tree</xref>
proposal, except our definition handles non-full trees differently.)
</t>
<section title="Merkle Inclusion Proofs" anchor='merkle_inclusion_proof'>
<t>
A Merkle inclusion proof for a leaf in a Merkle Hash Tree is the shortest
list of additional nodes in the Merkle Tree required to compute the Merkle Tree
Hash for that tree. Each node in the tree is either a leaf node or is computed
from the two nodes immediately below it (i.e., towards the leaves). At each
step up the tree (towards the root), a node from the inclusion proof is combined
with the node computed so far. In other words, the inclusion proof consists of the
list of missing nodes required to compute the nodes leading from a leaf to the
root of the tree. If the root computed from the inclusion proof matches the true
root, then the inclusion proof proves that the leaf exists in the tree.
</t>
<t> Given an ordered list of n inputs to the tree, D[n] = {d(0), ..., d(n-1)}, the Merkle inclusion proof PATH(m, D[n]) for the (m+1)th input d(m), 0 <= m < n, is defined as follows:
</t>
<t>
The proof for the single leaf in a tree with a one-element input list D[1] = {d(0)} is empty:
<vspace blankLines='1' />
PATH(0, {d(0)}) = {}
<vspace blankLines='1' />
For n > 1, let k be the largest power of two smaller than n. The proof for the (m+1)th element d(m) in a list of n > m elements is then defined recursively as
<vspace blankLines='1' />
PATH(m, D[n]) = PATH(m, D[0:k]) : MTH(D[k:n]) for m < k; and
<vspace blankLines='1' />
PATH(m, D[n]) = PATH(m - k, D[k:n]) : MTH(D[0:k]) for m >= k,
<vspace blankLines='1' />
where : is concatenation of lists and D[k1:k2] denotes the length (k2 - k1) list {d(k1), d(k1+1),..., d(k2-1)} as before.
</t>
</section>
<section title="Merkle Consistency Proofs" anchor='consistency'>
<t>
Merkle consistency proofs prove the append-only property of the tree. A Merkle consistency proof for a Merkle Tree Hash MTH(D[n]) and a previously advertised hash MTH(D[0:m]) of the first m leaves, m <= n, is the list of nodes in the Merkle Tree required to verify that the first m inputs D[0:m] are equal in both trees. Thus, a consistency proof must contain a set of intermediate nodes (i.e., commitments to inputs) sufficient to verify MTH(D[n]), such that (a subset of) the same nodes can be used to verify MTH(D[0:m]). We define an algorithm that outputs the (unique) minimal consistency proof.
</t>
<t>
Given an ordered list of n inputs to the tree, D[n] = {d(0), ..., d(n-1)}, the Merkle consistency proof PROOF(m, D[n]) for a previous Merkle Tree Hash MTH(D[0:m]), 0 < m < n, is defined as:
<vspace blankLines='1' />
PROOF(m, D[n]) = SUBPROOF(m, D[n], true)
<vspace blankLines='1' />
The subproof for m = n is empty if m is the value for which PROOF was originally requested (meaning that the subtree Merkle Tree Hash MTH(D[0:m]) is known):
<vspace blankLines='1' />
SUBPROOF(m, D[m], true) = {}
<vspace blankLines='1' />
The subproof for m = n is the Merkle Tree Hash committing inputs D[0:m]; otherwise:
<vspace blankLines='1' />
SUBPROOF(m, D[m], false) = {MTH(D[m])}
<vspace blankLines='1' />
For m < n, let k be the largest power of two smaller than n. The subproof is then defined recursively.
<vspace blankLines='1' />
If m <= k, the right subtree entries D[k:n] only exist in the current tree. We prove that the left subtree entries D[0:k] are consistent and add a commitment to D[k:n]:
<vspace blankLines='1' />
SUBPROOF(m, D[n], b) = SUBPROOF(m, D[0:k], b) : MTH(D[k:n])
<vspace blankLines='1' />
If m > k, the left subtree entries D[0:k] are identical in both trees. We prove that the right subtree entries D[k:n] are consistent and add a commitment to D[0:k].
<vspace blankLines='1' />
SUBPROOF(m, D[n], b) = SUBPROOF(m - k, D[k:n], false) : MTH(D[0:k])
<vspace blankLines='1' />
Here, : is a concatenation of lists, and D[k1:k2] denotes the length (k2 - k1) list {d(k1), d(k1+1),..., d(k2-1)} as before.
</t>
<t>
The number of nodes in the resulting proof is bounded above by ceil(log2(n)) + 1.
</t>
</section>
<section title="Example">
<figure>
<preamble>
The binary Merkle Tree with 7 leaves:
</preamble>
<artwork>
hash
/ \
/ \
/ \
/ \
/ \
k l
/ \ / \
/ \ / \
/ \ / \
g h i j
/ \ / \ / \ |
a b c d e f d6
| | | | | |
d0 d1 d2 d3 d4 d5</artwork>
</figure>
<t>
The inclusion proof for d0 is [b, h, l].
</t>
<t>
The inclusion proof for d3 is [c, g, l].
</t>
<t>
The inclusion proof for d4 is [f, j, k].
</t>
<t>
The inclusion proof for d6 is [i, k].
</t>
<figure>
<preamble>
The same tree, built incrementally in four steps:
</preamble>
<artwork>
hash0 hash1=k
/ \ / \
/ \ / \
/ \ / \
g c g h
/ \ | / \ / \
a b d2 a b c d
| | | | | |
d0 d1 d0 d1 d2 d3
hash2 hash
/ \ / \
/ \ / \
/ \ / \
/ \ / \
/ \ / \
k i k l
/ \ / \ / \ / \
/ \ e f / \ / \
/ \ | | / \ / \
g h d4 d5 g h i j
/ \ / \ / \ / \ / \ |
a b c d a b c d e f d6
| | | | | | | | | |
d0 d1 d2 d3 d0 d1 d2 d3 d4 d5</artwork>
</figure>
<t>
The consistency proof between hash0 and hash is PROOF(3, D[7]) = [c, d, g, l]. c, g are used to verify hash0, and d, l are additionally used to show hash is consistent with hash0.
</t>
<t>
The consistency proof between hash1 and hash is PROOF(4, D[7]) =
[l]. hash can be verified using hash1=k and l.
</t>
<t>
The consistency proof between hash2 and hash is PROOF(6, D[7]) = [i, j, k]. k, i are used to verify hash2, and j is additionally used to show hash is consistent with hash2.
</t>
</section>
<section title="Signatures" anchor="signatures">
<t>
Various data structures are signed. A log MUST use one of the signature algorithms defined in the <xref target="signature_algorithms"/> section.
</t>
</section>
</section>
</section>
<section title="Submitters">
<t>
Submitters submit certificates or precertificates to logs for public auditing, as described below. In order to enable attribution of each logged certificate or precertificate to its issuer, each submission MUST be accompanied by all additional certificates required to verify the chain up to an accepted root certificate. The root certificate itself MAY be omitted from the submission.
</t>
<t>
If a log accepts a submission, it will return a Signed Certificate Timestamp (SCT) (see <xref target="sct"/>). The submitter SHOULD validate the returned SCT as described in <xref target="tls_clients"/> if they understand its format and they intend to use it directly in a TLS handshake or to construct a certificate.
</t>
<section title="Certificates">
<t>
Anyone can <xref target="add-chain">submit a certificate</xref> to a log. Since certificates may not be accepted by TLS clients unless logged, it is expected that certificate owners or their CAs will usually submit them.
</t>
</section>
<section title="Precertificates" anchor="Precertificates">
<t>
Alternatively, (root as well as intermediate) CAs may preannounce a certificate prior to issuance by <xref target="add-pre-chain">submitting a precertificate</xref> that the log can use to create an entry that will be valid against the issued certificate. The CA MAY incorporate the returned SCT in the issued certificate.
</t>
<t>
A precertificate is a CMS <xref target="RFC5652"/> <spanx style="verb">signed-data</spanx> object that conforms to the following requirements:
<list style="symbols">
<t>
It MUST be DER encoded.
</t>
<t>
<spanx style="verb">SignedData.encapContentInfo.eContentType</spanx> MUST be the OID <TBD>.
</t>
<t>
<spanx style="verb">SignedData.encapContentInfo.eContent</spanx> MUST contain a TBSCertificate <xref target="RFC5280"/>, which MAY redact certain domain name labels that will be present in the issued certificate (see <xref target="redacting_subdomains"/>) and MUST NOT contain any SCTs, but which will be otherwise identical to the TBSCertificate in the issued certificate.
</t>
<t>
<spanx style="verb">SignedData.signerInfos</spanx> MUST contain a signature from the same (root or intermediate) CA that will ultimately issue the certificate. This signature indicates the CA's intent to issue the certificate. This intent is considered binding (i.e. misissuance of the precertificate is considered equivalent to misissuance of the certificate). (Note that, because of the structure of CMS, the signature on the CMS object will not be a valid X.509v3 signature and so cannot be used to construct a certificate from the precertificate).
</t>
<t>
<spanx style="verb">SignedData.certificates</spanx> SHOULD be omitted.
</t>
</list>
</t>
</section>
</section>
<section title="Private Domain Name Labels">
<t>
Some regard some DNS domain name labels within their registered domain space as private and security sensitive. Even though these domains are often only accessible within the domain owner's private network, it's common for them to be secured using publicly trusted TLS server certificates. We define a mechanism to allow these private labels to not appear in public logs.
</t>
<section title="Wildcard Certificates">
<t>
A certificate containing a <xref target="RFC6125">DNS-ID</xref> of <spanx style="verb">*.example.com</spanx> could be used to secure the domain <spanx style="verb">topsecret.example.com</spanx>, without revealing the string <spanx style="verb">topsecret</spanx> publicly.
</t>
<t>
Since TLS clients only match the wildcard character to the complete leftmost label of the DNS domain name (see Section 6.4.3 of <xref target="RFC6125"/>), this approach would not work for a DNS-ID such as <spanx style="verb">top.secret.example.com</spanx>. Also, wildcard certificates are prohibited in some cases, such as <xref target="EVSSLGuidelines">Extended Validation Certificates</xref>.
</t>
</section>
<section title="Redacting Domain Name Labels in Precertificates" anchor="redacting_subdomains">
<t>
When creating a precertificate, the CA MAY substitute one or more labels in each DNS-ID with a corresponding number of <spanx style="verb">?</spanx> labels. Every label to the left of a <spanx style="verb">?</spanx> label MUST also be redacted. For example, if a certificate contains a DNS-ID of <spanx style="verb">top.secret.example.com</spanx>, then the corresponding precertificate could contain <spanx style="verb">?.?.example.com</spanx> instead, but not <spanx style="verb">top.?.example.com</spanx> instead.
</t>
<t>
Wildcard <spanx style="verb">*</spanx> labels MUST NOT be redacted. However, if the complete leftmost label of a DNS-ID is <spanx style="verb">*</spanx>, it is considered redacted for the purposes of determining if the label to the right may be redacted. For example, if a certificate contains a DNS-ID of <spanx style="verb">*.top.secret.example.com</spanx>, then the corresponding precertificate could contain <spanx style="verb">*.?.?.example.com</spanx> instead, but not <spanx style="verb">?.?.?.example.com</spanx> instead.
</t>
<t>
When a precertificate contains one or more redacted labels, a non-critical extension (OID 1.3.6.1.4.1.11129.2.4.6, whose extnValue OCTET STRING contains an ASN.1 SEQUENCE OF INTEGERs) MUST be added to the corresponding certificate: the first INTEGER indicates the total number of redacted labels and wildcard <spanx style="verb">*</spanx> labels in the precertificate's first DNS-ID; the second INTEGER does the same for the precertificate's second DNS-ID; etc. There MUST NOT be more INTEGERs than there are DNS-IDs. If there are fewer INTEGERs than there are DNS-IDs, the shortfall is made up by implicitly repeating the last INTEGER. Each INTEGER MUST have a value of zero or more. The purpose of this extension is to enable TLS clients to accurately reconstruct the TBSCertificate component of the precertificate from the certificate without having to perform any guesswork.
</t>
<t>
When a precertificate contains that extension and contains a <xref target="RFC6125">CN-ID</xref>, the CN-ID MUST match the first DNS-ID and have the same labels redacted. TLS clients will use the first entry in the SEQUENCE OF INTEGERs to reconstruct both the first DNS-ID and the CN-ID.
</t>
</section>
<section title="Using a Name-Constrained Intermediate CA" anchor="name_constrained">
<t>
An intermediate CA certificate or intermediate CA precertificate that contains the critical or non-critical <xref target="RFC5280">Name Constraints</xref> extension MAY be logged in place of end-entity certificates issued by that intermediate CA, as long as all of the following conditions are met:
<list style="symbols">
<t>
there MUST be a non-critical extension (OID 1.3.6.1.4.1.11129.2.4.7, whose extnValue OCTET STRING contains ASN.1 NULL data (0x05 0x00)). This extension is an explicit indication that it is acceptable to not log certificates issued by this intermediate CA.
</t>
<t>
permittedSubtrees MUST specify one or more dNSNames.
</t>
<t>
excludedSubtrees MUST specify the entire IPv4 and IPv6 address ranges.
</t>
</list>
</t>
<figure>
<preamble>
Below is an example Name Constraints extension that meets these conditions:
</preamble>
<artwork>
SEQUENCE {
OBJECT IDENTIFIER '2 5 29 30'
OCTET STRING, encapsulates {
SEQUENCE {
[0] {
SEQUENCE {
[2] 'example.com'
}
}
[1] {
SEQUENCE {
[7] 00 00 00 00 00 00 00 00
}
SEQUENCE {
[7]
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
}
}
}
}
}</artwork>
</figure>
</section>
</section>
<section title="Log Format and Operation">
<t>
A log is a single, append-only Merkle Tree of submitted certificate and precertificate entries.
</t>
<t>
When it receives a valid submission, the log MUST return an SCT that corresponds to the submitted certificate or precertificate. If the log has previously seen this valid submission, it MAY return the same SCT as it returned before. (Note that if a certificate was previously logged as a precertificate, then the precertificate's SCT of type <spanx style="verb">precert_sct</spanx> would not be appropriate; instead, a fresh SCT of type <spanx style="verb">x509_sct</spanx> should be generated).
</t>
<t>
An SCT is the log's promise to incorporate the submitted entry in its Merkle Tree no later than a fixed amount of time, known as the Maximum Merge Delay (MMD), after the issuance of the SCT. Periodically, the log MUST append all its new entries to its Merkle Tree and sign the root of the tree.
</t>
<t>
Log operators MUST NOT impose any conditions on retrieving or sharing data from the log.
</t>
<section title="Accepting Submissions">
<t>
Logs MUST verify that each submitted certificate or precertificate has a valid signature chain to an accepted root certificate, using the chain of intermediate CA certificates provided by the submitter. Logs MUST accept certificates and precertificates that are fully valid according to <xref target="RFC5280">RFC 5280</xref> verification rules and are submitted with such a chain. Logs MAY accept certificates and precertificates that have expired, are not yet valid, have been revoked, or are otherwise not fully valid according to RFC 5280 verification rules in order to accommodate quirks of CA certificate-issuing software. However, logs MUST reject submissions without a valid signature chain to an accepted root certificate. Logs MUST also reject precertificates that do not conform to the requirements in <xref target="Precertificates"/>.
</t>
<t>
Logs SHOULD limit the length of chain they will accept. The maximum chain length is specified in the log's metadata.
</t>
<t>
The log SHALL allow retrieval of its list of accepted root certificates (see <xref target="get-roots"/>). This list might usefully be the union of root certificates trusted by major browser vendors.
</t>
</section>
<section title="Log Entries" anchor="log_entries">
<t>
If a submission is accepted and an SCT issued, the accepting log MUST store the entire chain used for verification. This chain MUST include the certificate or precertificate itself, the zero or more intermediate CA certificates provided by the submitter, and the root certificate used to verify the chain (even if it was omitted from the submission). The log MUST present this chain for auditing upon request (see <xref target="get-entries"/>). This chain is required to prevent a CA from avoiding blame by logging a partial or empty chain.
</t>
<figure>
<preamble>
Each certificate entry in a log MUST include a <spanx style="verb">X509ChainEntry</spanx> structure, and each precertificate entry MUST include a <spanx style="verb">PrecertChainEntryV2</spanx> structure:
</preamble>
<artwork>
opaque ASN.1Cert<1..2^24-1>;
struct {
ASN.1Cert leaf_certificate;
ASN.1Cert certificate_chain<0..2^24-1>;
} X509ChainEntry;
opaque CMSPrecert<1..2^24-1>;
struct {
CMSPrecert pre_certificate;
ASN.1Cert precertificate_chain<1..2^24-1>;
} PrecertChainEntryV2;</artwork>
</figure>
<t>
<spanx style="verb">leaf_certificate</spanx> is a submitted certificate that has been accepted by the log.
</t>
<t>
<spanx style="verb">certificate_chain</spanx> is a vector of 0 or more additional certificates required to verify <spanx style="verb">leaf_certificate</spanx>. The first certificate MUST certify <spanx style="verb">leaf_certificate</spanx>. Each following certificate MUST directly certify the one preceding it. The final certificate MUST be a root certificate accepted by the log. If <spanx style="verb">leaf_certificate</spanx> is a root certificate, then this vector is empty.
</t>
<t>
<spanx style="verb">pre_certificate</spanx> is a submitted precertificate that has been accepted by the log.
</t>
<t>
<spanx style="verb">precertificate_chain</spanx> is a vector of 1 or more additional certificates required to verify <spanx style="verb">pre_certificate</spanx>. The first certificate MUST certify <spanx style="verb">pre_certificate</spanx>. Each following certificate MUST directly certify the one preceding it. The final certificate MUST be a root certificate accepted by the log.
</t>
</section>
<section title="Log ID" anchor="log_id">
<figure>
<preamble>
Each log's operator allocates an OID for the purpose of uniquely identifying that log. This OID is specified in the log's metadata. Various data structures include the DER encoding of this OID, excluding the ASN.1 tag and length bytes, in an opaque vector:
</preamble>
<artwork>
opaque LogID<2..127>;</artwork>
</figure>
<t>
Note that the ASN.1 length and the opaque vector length are identical in size (1 byte) and value, so the DER encoding of the OID can be reproduced simply by prepending an OBJECT IDENTIFIER tag (0x06) to the opaque vector length and contents.
</t>
</section>
<section title="The TransItem Structure">
<figure>
<preamble>
Various data structures produced by logs are encapsulated in the <spanx style="verb">TransItem</spanx> structure to ensure that the type and version of each one is identified in a common fashion:
</preamble>
<artwork>
enum {
v1(0), v2(1), (255)
} Version;
enum {
x509_entry(0), precert_entry(1), x509_sct(2), precert_sct(3),
tree_head(4), signed_tree_head(5), consistency_proof(6),
inclusion_proof(7), (65535)
} TransType;
enum {
reserved(65535)
} ItemExtensionType;
struct {
ItemExtensionType item_extension_type;
opaque item_extension_data<0..2^16-1>;
} ItemExtension;
struct {
TransType type;
select (type) {
case x509_entry: TimestampedCertificateEntryDataV2;
case precert_entry: TimestampedCertificateEntryDataV2;
case x509_sct: SignedCertificateTimestampDataV2;
case precert_sct: SignedCertificateTimestampDataV2;
case tree_head: TreeHeadDataV2;
case signed_tree_head: SignedTreeHeadDataV2;
case consistency_proof: ConsistencyProofDataV2;
case inclusion_proof: InclusionProofDataV2;
} data;
ItemExtension item_extensions<0..2^16-1>;
} TransItemV2;
struct {
Version version;
select (version) {
case v1: TransItemV1;
case v2: TransItemV2;
}
} TransItem;</artwork>
</figure>
<t>
<spanx style="verb">version</spanx> is the earliest version of this protocol to which the encapsulated data structure conforms. This document is v2. Note that <xref target="RFC6962">v1</xref> did not define <spanx style="verb">TransItem</spanx>, but this document specifies a mechanism (see <xref target="TransItemV1"/>) for v2 implementations to encapsulate existing v1 objects in the <spanx style="verb">TransItem</spanx> structure. Note also that, since each <spanx style="verb">TransItem</spanx> object is individually versioned, future revisions to this protocol could conceivably update some encapsulated data structures without having to update all of them.
</t>
<t>
<spanx style="verb">type</spanx> is the type of the encapsulated data structure. (Note that <spanx style="verb">TransType</spanx> combines the v1 type enumerations <spanx style="verb">LogEntryType</spanx>, <spanx style="verb">SignatureType</spanx> and <spanx style="verb">MerkleLeafType</spanx>). Future revisions of this protocol may add new <spanx style="verb">TransType</spanx> values.
</t>
<t>
<spanx style="verb">data</spanx> is the encapsulated data structure. The various structures named with the <spanx style="verb">DataV2</spanx> suffix are defined in later sections of this document.
</t>
<t>
<spanx style="verb">item_extension_type</spanx> identifies a single extension from the IANA registry in <xref target="item_extension_types"/>.
</t>
<t>
The interpretation of the <spanx style="verb">item_extension_data</spanx> field is determined solely by the value of the <spanx style="verb">item_extension_type</spanx> field. Each document that registers a new <spanx style="verb">item_extension_type</spanx> must describe how to interpret the corresponding <spanx style="verb">item_extension_data</spanx>.
</t>
<t>
<spanx style="verb">item_extensions</spanx> is a vector of 0 or more item extensions. This vector MUST NOT include more than one extension with the same <spanx style="verb">item_extension_type</spanx>. The extensions in the vector MUST be ordered by the value of the <spanx style="verb">item_extension_type</spanx> field, smallest value first.
</t>
</section>
<section title="Merkle Tree Leaves" anchor="tree_leaves">
<figure>
<preamble>
The leaves of a log's Merkle Tree correspond to the log's entries (see <xref target="log_entries"/>). Each leaf is the <xref target="mht">leaf hash</xref> of a <spanx style="verb">TransItem</spanx> structure of type <spanx style="verb">x509_entry</spanx> or <spanx style="verb">precert_entry</spanx>, which in this version (v2) encapsulates a <spanx style="verb">TimestampedCertificateEntryDataV2</spanx> structure. Note that leaf hashes are calculated as HASH(0x00 || TransItem), where the hashing algorithm is specified in the log's metadata.
</preamble>
<artwork>
opaque TBSCertificate<1..2^24-1>;
struct {
uint64 timestamp;
opaque issuer_key_hash[HASH_SIZE];
TBSCertificate tbs_certificate;
SctExtension sct_extensions<0..2^16-1>;
} TimestampedCertificateEntryDataV2;</artwork>
</figure>
<t>
<spanx style="verb">timestamp</spanx> is the <xref target="RFC5905">NTP Time</xref> at which the certificate or precertificate was accepted by the log, measured in milliseconds since the epoch (January 1, 1970, 00:00), ignoring leap seconds.
</t>
<t>
<spanx style="verb">issuer_key_hash</spanx> is the HASH of the public key of the CA that issued the certificate or precertificate, calculated over the DER encoding of the key represented as <xref target="RFC5280">SubjectPublicKeyInfo</xref>. This is needed to bind the CA to the certificate or precertificate, making it impossible for the corresponding SCT to be valid for any other certificate or precertificate whose TBSCertificate matches <spanx style="verb">tbs_certificate</spanx>.
</t>
<t>
<spanx style="verb">tbs_certificate</spanx> is the DER encoded TBSCertificate from either the <spanx style="verb">leaf_certificate</spanx> (in the case of an <spanx style="verb">X509ChainEntry</spanx>) or the <spanx style="verb">pre_certificate</spanx> (in the case of a <spanx style="verb">PrecertChainEntryV2</spanx>). (Note that a precertificate's TBSCertificate can be reconstructed from the issued certificate's TBSCertificate by redacting the domain name labels indicated by the redacted labels extension, and deleting the SCT list extension and redacted labels extension).
</t>
<t>
<spanx style="verb">sct_extensions</spanx> matches the SCT extensions of the corresponding SCT.
</t>
</section>
<section title="Signed Certificate Timestamp (SCT)" anchor="sct">
<figure>
<preamble>
An SCT is a <spanx style="verb">TransItem</spanx> structure of type <spanx style="verb">x509_sct</spanx> or <spanx style="verb">precert_sct</spanx>, which in this version (v2) encapsulates a <spanx style="verb">SignedCertificateTimestampDataV2</spanx> structure:
</preamble>
<artwork>
enum {
reserved(65535)
} SctExtensionType;
struct {
SctExtensionType sct_extension_type;
opaque sct_extension_data<0..2^16-1>;
} SctExtension;
struct {
LogID log_id;
uint64 timestamp;
SctExtension sct_extensions<0..2^16-1>;
digitally-signed struct {
TransItem timestamped_entry;
} signature;
} SignedCertificateTimestampDataV2;</artwork>
</figure>
<t>
<spanx style="verb">log_id</spanx> is this log's unique ID, encoded in an opaque vector as described in <xref target="log_id"/>.
</t>
<t>
<spanx style="verb">timestamp</spanx> is equal to the timestamp from the <spanx style="verb">TimestampedCertificateEntryDataV2</spanx> structure encapsulated in the <spanx style="verb">timestamped_entry</spanx>.
</t>
<t>
<spanx style="verb">sct_extension_type</spanx> identifies a single extension from the IANA registry in <xref target="sct_extension_types"/>. At the time of writing, no extensions are specified.
</t>
<t>
The interpretation of the <spanx style="verb">sct_extension_data</spanx> field is determined solely by the value of the <spanx style="verb">sct_extension_type</spanx> field. Each document that registers a new <spanx style="verb">sct_extension_type</spanx> must describe how to interpret the corresponding <spanx style="verb">sct_extension_data</spanx>.
</t>
<t>
<spanx style="verb">sct_extensions</spanx> is a vector of 0 or more SCT extensions. This vector MUST NOT include more than one extension with the same <spanx style="verb">sct_extension_type</spanx>. The extensions in the vector MUST be ordered by the value of the <spanx style="verb">sct_extension_type</spanx> field, smallest value first. If an implementation sees an extension that it does not understand, it SHOULD ignore that extension. Furthermore, an implementation MAY choose to ignore any extension(s) that it does understand.
</t>
<t>
The encoding of the digitally-signed element is defined in <xref target='RFC5246'/>.
</t>
<t>
<spanx style="verb">timestamped_entry</spanx> is a <spanx style="verb">TransItem</spanx> structure that MUST be of type <spanx style="verb">x509_entry</spanx> or <spanx style="verb">precert_entry</spanx> (see <xref target="tree_leaves"/>) and MUST have an empty <spanx style="verb">item_extensions</spanx> vector.
</t>
</section>
<section title="Merkle Tree Head" anchor="tree_head">
<figure>
<preamble>
The log stores information about its Merkle Tree in a <spanx style="verb">TransItem</spanx> structure of type <spanx style="verb">tree_head</spanx>, which in this version (v2) encapsulates a <spanx style="verb">TreeHeadDataV2</spanx> structure:
</preamble>
<artwork>
opaque NodeHash[HASH_SIZE];
struct {
uint64 timestamp;
uint64 tree_size;
NodeHash root_hash;
SthExtension sth_extensions<0..2^16-1>;
} TreeHeadDataV2;</artwork>
</figure>
<t>
<spanx style="verb">timestamp</spanx> is the current <xref target="RFC5905">NTP Time</xref>, measured in milliseconds since the epoch (January 1, 1970, 00:00), ignoring leap seconds.
</t>
<t>
<spanx style="verb">tree_size</spanx> is the number of entries currently in the log's Merkle Tree.
</t>
<t>
<spanx style="verb">root_hash</spanx> is the root of the Merkle Hash Tree.
</t>
<t>
<spanx style="verb">sth_extensions</spanx> matches the STH extensions of the corresponding STH.
</t>
</section>
<section title="Signed Tree Head (STH)" anchor="STH">
<t>
Periodically each log SHOULD sign its current tree head information (see <xref target="tree_head"/>) to produce an STH. When a client requests a log's latest STH (see <xref target="get-sth"/>), the log MUST return an STH that is no older than the log's MMD. However, STHs could be used to mark individual clients (by producing a new one for each query), so logs MUST NOT produce them more frequently than is declared in their metadata. In general, there is no need to produce a new STH unless there are new entries in the log; however, in the unlikely event that it receives no new submissions during an MMD period, the log SHALL sign the same Merkle Tree Hash with a fresh timestamp.
</t>
<figure>
<preamble>
An STH is a <spanx style="verb">TransItem</spanx> structure of type <spanx style="verb">signed_tree_head</spanx>, which in this version (v2) encapsulates a <spanx style="verb">SignedTreeHeadDataV2</spanx> structure:
</preamble>
<artwork>
enum {
reserved(65535)
} SthExtensionType;
struct {
SthExtensionType sth_extension_type;
opaque sth_extension_data<0..2^16-1>;
} SthExtension;
struct {
LogID log_id;
uint64 timestamp;
uint64 tree_size;
NodeHash root_hash;
SthExtension sth_extensions<0..2^16-1>;
digitally-signed struct {
TransItem merkle_tree_head;
} signature;
} SignedTreeHeadDataV2;</artwork>
</figure>
<t>
<spanx style="verb">log_id</spanx> is this log's unique ID, encoded in an opaque vector as described in <xref target="log_id"/>.
</t>
<t>
<spanx style="verb">timestamp</spanx> is equal to the timestamp from the <spanx style="verb">TreeHeadDataV2</spanx> structure encapsulated in <spanx style="verb">merkle_tree_head</spanx>. This timestamp MUST be at least as recent as the most recent SCT timestamp in the tree. Each subsequent timestamp MUST be more recent than the timestamp of the previous update.
</t>
<t>
<spanx style="verb">tree_size</spanx> is equal to the tree size from the <spanx style="verb">TreeHeadDataV2</spanx> structure encapsulated in <spanx style="verb">merkle_tree_head</spanx>.
</t>
<t>
<spanx style="verb">root_hash</spanx> is equal to the root hash from the <spanx style="verb">TreeHeadDataV2</spanx> structure encapsulated in <spanx style="verb">merkle_tree_head</spanx>.
</t>
<t>
<spanx style="verb">sth_extension_type</spanx> identifies a single extension from the IANA registry in <xref target="sth_extension_types"/>. At the time of writing, no extensions are specified.
</t>
<t>
The interpretation of the <spanx style="verb">sth_extension_data</spanx> field is determined solely by the value of the <spanx style="verb">sth_extension_type</spanx> field. Each document that registers a new <spanx style="verb">sth_extension_type</spanx> must describe how to interpret the corresponding <spanx style="verb">sth_extension_data</spanx>.
</t>
<t>
<spanx style="verb">sth_extensions</spanx> is a vector of 0 or more STH extensions. This vector MUST NOT include more than one extension with the same <spanx style="verb">sth_extension_type</spanx>. The extensions in the vector MUST be ordered by the value of the <spanx style="verb">sth_extension_type</spanx> field, smallest value first. If an implementation sees an extension that it does not understand, it SHOULD ignore that extension. Furthermore, an implementation MAY choose to ignore any extension(s) that it does understand.
</t>
<t>
<spanx style="verb">merkle_tree_head</spanx> is a <spanx style="verb">TransItem</spanx> structure that MUST be of type <spanx style="verb">tree_head</spanx> (see <xref target="tree_head"/>) and MUST have an empty <spanx style="verb">item_extensions</spanx> vector.
</t>
</section>
<section title="Merkle Consistency Proofs">
<figure>
<preamble>
To prepare a Merkle Consistency Proof for distribution to clients, the log produces a <spanx style="verb">TransItem</spanx> structure of type <spanx style="verb">consistency_proof</spanx>, which in this version (v2) encapsulates a <spanx style="verb">ConsistencyProofDataV2</spanx> structure:
</preamble>
<artwork>
struct {
LogID log_id;
uint64 tree_size_1;
uint64 tree_size_2;
NodeHash consistency_path<1..2^8-1>;
} ConsistencyProofDataV2;</artwork>
</figure>
<t>
<spanx style="verb">log_id</spanx> is this log's unique ID, encoded in an opaque vector as described in <xref target="log_id"/>.
</t>
<t>
<spanx style="verb">tree_size_1</spanx> is the size of the older tree.
</t>
<t>
<spanx style="verb">tree_size_2</spanx> is the size of the newer tree.
</t>
<t>
<spanx style="verb">consistency_path</spanx> is a vector of Merkle Tree nodes proving the consistency of two STHs.
</t>
</section>
<section title="Merkle Inclusion Proofs">
<figure>
<preamble>
To prepare a Merkle Inclusion Proof for distribution to clients, the log produces a <spanx style="verb">TransItem</spanx> structure of type <spanx style="verb">inclusion_proof</spanx>, which in this version (v2) encapsulates an <spanx style="verb">InclusionProofDataV2</spanx> structure:
</preamble>
<artwork>
struct {
LogID log_id;
uint64 tree_size;
uint64 leaf_index;
NodeHash inclusion_path<1..2^8-1>;
} InclusionProofDataV2;</artwork>
</figure>
<t>
<spanx style="verb">log_id</spanx> is this log's unique ID, encoded in an opaque vector as described in <xref target="log_id"/>.
</t>
<t>
<spanx style="verb">tree_size</spanx> is the size of the tree on which this inclusion proof is based.
</t>
<t>
<spanx style="verb">leaf_index</spanx> is the 0-based index of the log entry corresponding to this inclusion proof.
</t>
<t>
<spanx style="verb">inclusion_path</spanx> is a vector of Merkle Tree nodes proving the inclusion of the chosen certificate or precertificate.
</t>
</section>
</section>
<section title="Log Client Messages" anchor="client_messages">
<t>
Messages are sent as HTTPS GET or POST requests. Parameters for POSTs
and all responses are encoded as <xref target="RFC4627">JavaScript Object
Notation (JSON)
objects</xref>. Parameters for GETs are encoded as order-independent key/value
URL parameters, using the "application/x-www-form-urlencoded" format described
in the <xref target="HTML401">"HTML 4.01 Specification"</xref>. Binary data is
<xref target="RFC4648">base64 encoded</xref> as specified in the individual
messages.
</t>
<t>
Note that JSON objects and URL parameters may contain fields not specified here. These extra fields should be ignored.
</t>
<t>
The <log server> prefix, which is part of the log's metadata, MAY include a path as well as a server name and a port.
</t>
<t>
In practice, log servers may include multiple front-end machines. Since it is impractical to keep these machines in perfect sync, errors may occur that are caused by skew between the machines. Where such errors are possible, the front-end will return additional information (as specified below) making it possible for clients to make progress, if progress is possible. Front-ends MUST only serve data that is free of gaps (that is, for example, no front-end will respond with an STH unless it is also able to prove consistency from all log entries logged within that STH).
</t>
<t>
For example, when a consistency proof between two STHs is requested, the front-end reached may not yet be aware of one or both STHs. In the case where it is unaware of both, it will return the latest STH it is aware of. Where it is aware of the first but not the second, it will return the latest STH it is aware of and a consistency proof from the first STH to the returned STH. The case where it knows the second but not the first should not arise (see the "no gaps" requirement above).
</t>
<t>
If the log is unable to process a client's request, it MUST return an HTTP response code of 4xx/5xx (see <xref target="RFC2616"/>), and, in place of the responses outlined in the subsections below, the body SHOULD be a JSON structure containing at least the following field:
<list style="hanging">
<t hangText="error_message:">
A human-readable string describing the error which prevented the log from processing the request.
</t>
<t>
In the case of a malformed request, the string SHOULD provide sufficient detail for the error to be rectified.
</t>
<t hangText="error_code:">
An error code readable by the client. Some codes are generic and are detailed here. Others are detailed in the individual requests. Error codes are fixed text strings.
<list style="hanging">
<t hangText="not compliant">
The request is not compliant with this RFC.
</t>
</list>
</t>
</list>
</t>
<figure>
<preamble>
e.g. In response to a request of <spanx style="verb">/ct/v2/get-entries?start=100&end=99</spanx>, the log would return a <spanx style="verb">400 Bad Request</spanx> response code with a body similar to the following:
</preamble>
<artwork>
{
"error_message": "'start' cannot be greater than 'end'",
"error_code": "not compliant",
}</artwork>
</figure>
<t>
Clients SHOULD treat <spanx style="verb">500 Internal Server Error</spanx> and <spanx style="verb">503 Service Unavailable</spanx> responses as transient failures and MAY retry the same request without modification at a later date. Note that as per <xref target="RFC2616"/>, in the case of a 503 response the log MAY include a <spanx style="verb">Retry-After:</spanx> header in order to request a minimum time for the client to wait before retrying the request.
</t>
<section title="Add Chain to Log" anchor="add-chain">
<t>
POST https://<log server>/ct/v2/add-chain
</t>
<t>
<list style="hanging">
<t hangText="Inputs:">
<list style="hanging">
<t hangText="chain:">
An array of base64 encoded certificates. The first element is the certificate for which the submitter desires an SCT; the second chains to the first and so on to the last, which is either an accepted root certificate or a certificate that chains to an accepted root certificate.
</t>
</list>
</t>
<t hangText="Outputs:">
<list style="hanging">
<t hangText="sct:">
A base64 encoded <spanx style="verb">TransItem</spanx> of type <spanx style="verb">x509_sct</spanx>, signed by this log, that corresponds to the submitted certificate.
</t>
</list>
</t>
<t hangText="Error codes:">
<list style="hanging">
<t hangText="unknown root">
The root of the chain is not one accepted by the log.
</t>
<t hangText="bad chain">
The alleged chain is not actually a chain of certificates.
</t>
<t hangText="bad certificate">
One or more certificates in the chain are not valid (e.g. not properly encoded).
</t>
</list>
</t>
</list>
</t>
<t>
If the version of <spanx style="verb">sct</spanx> is not v2, then a v2 client may be unable to verify the signature. It MUST NOT construe this as an error. This is to avoid forcing an upgrade of compliant v2 clients that do not use the returned SCTs.
</t>
<t>
If a log detects bad encoding in a chain that otherwise verifies correctly then the log MAY still log the certificate but SHOULD NOT return an SCT. It should instead return the "bad certificate" error. Logging the certificate is useful, because <xref target="monitor">monitors</xref> can then detect these encoding errors, which may be accepted by some TLS clients.
</t>
<t>
Note that not all certificate handling software is capable of detecting all encoding errors (e.g. some software will accept BER instead of DER encodings in certificates, or incorrect character encodings, even though these are technically incorrect) .
</t>
</section>
<section title="Add PreCertChain to Log" anchor="add-pre-chain">
<t>
POST https://<log server>/ct/v2/add-pre-chain
</t>
<t>
<list style="hanging">
<t hangText="Inputs:">
<list style="hanging">
<t hangText="precertificate:">
The base64 encoded precertificate.
</t>
<t hangText="chain:">
An array of base64 encoded CA certificates. The first element is the signer of the precertificate; the second chains to the first and so on to the last, which is either an accepted root certificate or a certificate that chains to an accepted root certificate.
</t>
</list>
</t>
<t hangText="Outputs:">
<list style="hanging">
<t hangText="sct:">
A base64 encoded <spanx style="verb">TransItem</spanx> of type <spanx style="verb">precert_sct</spanx>, signed by this log, that corresponds to the submitted precertificate.
</t>
</list>
</t>
</list>
</t>
<t>
Errors are the same as in <xref target="add-chain"/>.
</t>
</section>
<section title="Retrieve Latest Signed Tree Head" anchor="get-sth">
<t>
GET https://<log server>/ct/v2/get-sth
</t>
<t>
No inputs.
</t>
<t>
<list style="hanging">
<t hangText="Outputs:">
<list style="hanging">
<t hangText="sth:">
A base64 encoded <spanx style="verb">TransItem</spanx> of type <spanx style="verb">signed_tree_head</spanx>, signed by this log, that is no older than the log's MMD.
</t>
</list>
</t>
</list>
</t>
</section>
<section title="Retrieve Merkle Consistency Proof between Two Signed Tree Heads" anchor="get-sth-consistency">
<t>
GET https://<log server>/ct/v2/get-sth-consistency
</t>
<t>
<list style="hanging">
<t hangText="Inputs:">
<list style="hanging">
<t hangText="first:">
The tree_size of the older tree, in decimal.
</t>
<t hangText="second:">
The tree_size of the newer tree, in decimal (optional).
</t>
</list>
</t>
<t>
Both tree sizes must be from existing v2 STHs. However, because of skew, the receiving front-end may not know one or both of the existing STHs. If both are known, then only the <spanx style="verb">consistency</spanx> output is returned. If the first is known but the second is not (or has been omitted), then the latest known STH is returned, along with a consistency proof between the first STH and the latest. If neither are known, then the latest known STH is returned without a consistency proof.
</t>
<t hangText="Outputs:">
<list style="hanging">
<t hangText="consistency:">
A base64 encoded <spanx style="verb">TransItem</spanx> of type <spanx style="verb">consistency_proof</spanx>, whose <spanx style="verb">tree_size_1</spanx> MUST match the <spanx style="verb">first</spanx> input. If the <spanx style="verb">sth</spanx> output is omitted, then <spanx style="verb">tree_size_2</spanx> MUST match the <spanx style="verb">second</spanx> input.
</t>
<t hangText="sth:">
A base64 encoded <spanx style="verb">TransItem</spanx> of type <spanx style="verb">signed_tree_head</spanx>, signed by this log.
</t>
</list>
</t>
<t>
Note that no signature is required for the <spanx style="verb">consistency</spanx> output as it is used to verify the consistency between two STHs, which are signed.
</t>
<t hangText="Error codes:">
<list style="hanging">
<t hangText="first unknown">
<spanx style="verb">first</spanx> is before the latest known STH but is not from an existing STH.
</t>
<t hangText="second unknown">
<spanx style="verb">second</spanx> is before the latest known STH but is not from an existing STH.
</t>
</list>
</t>
</list>
</t>
<t>
See <xref target="verify_consistency"/> for an outline of how to use the <spanx style="verb">consistency</spanx> output.
</t>
</section>
<section title="Retrieve Merkle Inclusion Proof from Log by Leaf Hash" anchor="get-proof-by-hash">
<t>
GET https://<log server>/ct/v2/get-proof-by-hash
</t>
<t>
<list style="hanging">
<t hangText="Inputs:">
<list style="hanging">
<t hangText="hash:">
A base64 encoded v1 leaf hash.
</t>
<t hangText="tree_size:">
The tree_size of the tree on which to base the proof, in decimal.
</t>
</list>
</t>
<t>
The <spanx style="verb">hash</spanx> must be calculated as defined in <xref target="tree_leaves"/>. The <spanx style="verb">tree_size</spanx> must designate an existing v2 STH. Because of skew, the front-end may not know the requested STH. In that case, it will return the latest STH it knows, along with an inclusion proof to that STH. If the front-end knows the requested STH then only <spanx style="verb">inclusion</spanx> is returned.
</t>
<t hangText="Outputs:">
<list style="hanging">
<t hangText="inclusion:">
A base64 encoded <spanx style="verb">TransItem</spanx> of type <spanx style="verb">inclusion_proof</spanx> whose <spanx style="verb">inclusion_path</spanx> array of Merkle Tree nodes proves the inclusion of the chosen certificate in the selected STH.
</t>
<t hangText="sth:">
A base64 encoded <spanx style="verb">TransItem</spanx> of type <spanx style="verb">signed_tree_head</spanx>, signed by this log.
</t>
</list>
</t>
<t>
Note that no signature is required for the <spanx style="verb">inclusion</spanx> output as it is used to verify inclusion in the selected STH, which is signed.
</t>
<t hangText="Error codes:">
<list style="hanging">
<t hangText="hash unknown">
<spanx style="verb">hash</spanx> is not the hash of a known leaf (may be caused by skew or by a known certificate not yet merged).
</t>
<t hangText="tree_size unknown">