xref: /freebsd/crypto/openssh/PROTOCOL.krl (revision 535af610a4fdace6d50960c0ad9be0597eea7a1b)
16888a9beSDag-Erling SmørgravThis describes the key/certificate revocation list format for OpenSSH.
26888a9beSDag-Erling Smørgrav
36888a9beSDag-Erling Smørgrav1. Overall format
46888a9beSDag-Erling Smørgrav
56888a9beSDag-Erling SmørgravThe KRL consists of a header and zero or more sections. The header is:
66888a9beSDag-Erling Smørgrav
76888a9beSDag-Erling Smørgrav#define KRL_MAGIC		0x5353484b524c0a00ULL  /* "SSHKRL\n\0" */
86888a9beSDag-Erling Smørgrav#define KRL_FORMAT_VERSION	1
96888a9beSDag-Erling Smørgrav
106888a9beSDag-Erling Smørgrav	uint64	KRL_MAGIC
116888a9beSDag-Erling Smørgrav	uint32	KRL_FORMAT_VERSION
126888a9beSDag-Erling Smørgrav	uint64	krl_version
136888a9beSDag-Erling Smørgrav	uint64	generated_date
146888a9beSDag-Erling Smørgrav	uint64	flags
156888a9beSDag-Erling Smørgrav	string	reserved
166888a9beSDag-Erling Smørgrav	string	comment
176888a9beSDag-Erling Smørgrav
186888a9beSDag-Erling SmørgravWhere "krl_version" is a version number that increases each time the KRL
196888a9beSDag-Erling Smørgravis modified, "generated_date" is the time in seconds since 1970-01-01
206888a9beSDag-Erling Smørgrav00:00:00 UTC that the KRL was generated, "comment" is an optional comment
216888a9beSDag-Erling Smørgravand "reserved" an extension field whose contents are currently ignored.
226888a9beSDag-Erling SmørgravNo "flags" are currently defined.
236888a9beSDag-Erling Smørgrav
246888a9beSDag-Erling SmørgravFollowing the header are zero or more sections, each consisting of:
256888a9beSDag-Erling Smørgrav
266888a9beSDag-Erling Smørgrav	byte	section_type
276888a9beSDag-Erling Smørgrav	string	section_data
286888a9beSDag-Erling Smørgrav
296888a9beSDag-Erling SmørgravWhere "section_type" indicates the type of the "section_data". An exception
306888a9beSDag-Erling Smørgravto this is the KRL_SECTION_SIGNATURE section, that has a slightly different
316888a9beSDag-Erling Smørgravformat (see below).
326888a9beSDag-Erling Smørgrav
336888a9beSDag-Erling SmørgravThe available section types are:
346888a9beSDag-Erling Smørgrav
356888a9beSDag-Erling Smørgrav#define KRL_SECTION_CERTIFICATES		1
366888a9beSDag-Erling Smørgrav#define KRL_SECTION_EXPLICIT_KEY		2
376888a9beSDag-Erling Smørgrav#define KRL_SECTION_FINGERPRINT_SHA1		3
386888a9beSDag-Erling Smørgrav#define KRL_SECTION_SIGNATURE			4
392f513db7SEd Maste#define KRL_SECTION_FINGERPRINT_SHA256		5
40*535af610SEd Maste#define KRL_SECTION_EXTENSION			255
416888a9beSDag-Erling Smørgrav
42bc5531deSDag-Erling Smørgrav2. Certificate section
436888a9beSDag-Erling Smørgrav
446888a9beSDag-Erling SmørgravThese sections use type KRL_SECTION_CERTIFICATES to revoke certificates by
456888a9beSDag-Erling Smørgravserial number or key ID. The consist of the CA key that issued the
466888a9beSDag-Erling Smørgravcertificates to be revoked and a reserved field whose contents is currently
476888a9beSDag-Erling Smørgravignored.
486888a9beSDag-Erling Smørgrav
496888a9beSDag-Erling Smørgrav	string ca_key
506888a9beSDag-Erling Smørgrav	string reserved
516888a9beSDag-Erling Smørgrav
52bc5531deSDag-Erling SmørgravWhere "ca_key" is the standard SSH wire serialisation of the CA's
53bc5531deSDag-Erling Smørgravpublic key. Alternately, "ca_key" may be an empty string to indicate
54bc5531deSDag-Erling Smørgravthe certificate section applies to all CAs (this is most useful when
55bc5531deSDag-Erling Smørgravrevoking key IDs).
56bc5531deSDag-Erling Smørgrav
576888a9beSDag-Erling SmørgravFollowed by one or more sections:
586888a9beSDag-Erling Smørgrav
596888a9beSDag-Erling Smørgrav	byte	cert_section_type
606888a9beSDag-Erling Smørgrav	string	cert_section_data
616888a9beSDag-Erling Smørgrav
626888a9beSDag-Erling SmørgravThe certificate section types are:
636888a9beSDag-Erling Smørgrav
646888a9beSDag-Erling Smørgrav#define KRL_SECTION_CERT_SERIAL_LIST	0x20
656888a9beSDag-Erling Smørgrav#define KRL_SECTION_CERT_SERIAL_RANGE	0x21
666888a9beSDag-Erling Smørgrav#define KRL_SECTION_CERT_SERIAL_BITMAP	0x22
676888a9beSDag-Erling Smørgrav#define KRL_SECTION_CERT_KEY_ID		0x23
68*535af610SEd Maste#define KRL_SECTION_CERT_EXTENSION	0x39
696888a9beSDag-Erling Smørgrav
706888a9beSDag-Erling Smørgrav2.1 Certificate serial list section
716888a9beSDag-Erling Smørgrav
726888a9beSDag-Erling SmørgravThis section is identified as KRL_SECTION_CERT_SERIAL_LIST. It revokes
736888a9beSDag-Erling Smørgravcertificates by listing their serial numbers. The cert_section_data in this
746888a9beSDag-Erling Smørgravcase contains:
756888a9beSDag-Erling Smørgrav
766888a9beSDag-Erling Smørgrav	uint64	revoked_cert_serial
776888a9beSDag-Erling Smørgrav	uint64	...
786888a9beSDag-Erling Smørgrav
796888a9beSDag-Erling SmørgravThis section may appear multiple times.
806888a9beSDag-Erling Smørgrav
816888a9beSDag-Erling Smørgrav2.2. Certificate serial range section
826888a9beSDag-Erling Smørgrav
836888a9beSDag-Erling SmørgravThese sections use type KRL_SECTION_CERT_SERIAL_RANGE and hold
846888a9beSDag-Erling Smørgrava range of serial numbers of certificates:
856888a9beSDag-Erling Smørgrav
866888a9beSDag-Erling Smørgrav	uint64	serial_min
876888a9beSDag-Erling Smørgrav	uint64	serial_max
886888a9beSDag-Erling Smørgrav
896888a9beSDag-Erling SmørgravAll certificates in the range serial_min <= serial <= serial_max are
906888a9beSDag-Erling Smørgravrevoked.
916888a9beSDag-Erling Smørgrav
926888a9beSDag-Erling SmørgravThis section may appear multiple times.
936888a9beSDag-Erling Smørgrav
946888a9beSDag-Erling Smørgrav2.3. Certificate serial bitmap section
956888a9beSDag-Erling Smørgrav
966888a9beSDag-Erling SmørgravBitmap sections use type KRL_SECTION_CERT_SERIAL_BITMAP and revoke keys
976888a9beSDag-Erling Smørgravby listing their serial number in a bitmap.
986888a9beSDag-Erling Smørgrav
996888a9beSDag-Erling Smørgrav	uint64	serial_offset
1006888a9beSDag-Erling Smørgrav	mpint	revoked_keys_bitmap
1016888a9beSDag-Erling Smørgrav
1026888a9beSDag-Erling SmørgravA bit set at index N in the bitmap corresponds to revocation of a keys with
1036888a9beSDag-Erling Smørgravserial number (serial_offset + N).
1046888a9beSDag-Erling Smørgrav
1056888a9beSDag-Erling SmørgravThis section may appear multiple times.
1066888a9beSDag-Erling Smørgrav
1076888a9beSDag-Erling Smørgrav2.4. Revoked key ID sections
1086888a9beSDag-Erling Smørgrav
1096888a9beSDag-Erling SmørgravKRL_SECTION_CERT_KEY_ID sections revoke particular certificate "key
1106888a9beSDag-Erling SmørgravID" strings. This may be useful in revoking all certificates
1116888a9beSDag-Erling Smørgravassociated with a particular identity, e.g. a host or a user.
1126888a9beSDag-Erling Smørgrav
1136888a9beSDag-Erling Smørgrav	string	key_id[0]
1146888a9beSDag-Erling Smørgrav	...
1156888a9beSDag-Erling Smørgrav
1166888a9beSDag-Erling SmørgravThis section must contain at least one "key_id". This section may appear
1176888a9beSDag-Erling Smørgravmultiple times.
1186888a9beSDag-Erling Smørgrav
119*535af610SEd Maste2.5. Certificate Extension subsections
120*535af610SEd Maste
121*535af610SEd MasteThis subsection type provides a generic extension mechanism to the
122*535af610SEd Mastecertificates KRL section that may be used to provide optional or critical
123*535af610SEd Mastedata.
124*535af610SEd Maste
125*535af610SEd MasteExtensions are stored in subsections of type
126*535af610SEd MasteKRL_SECTION_CERT_EXTENSION with the following contents:
127*535af610SEd Maste
128*535af610SEd Maste	string	extension_name
129*535af610SEd Maste	boolean is_critical
130*535af610SEd Maste	string	extension_contents.
131*535af610SEd Maste
132*535af610SEd MasteWhere "extension_name" describes the type of extension. It is
133*535af610SEd Masterecommended that user extensions follow "cert-name@domain.org" naming.
134*535af610SEd Maste
135*535af610SEd MasteThe "is_critical" indicates whether this extension is mandatory or
136*535af610SEd Masteoptional. If true, then any unsupported extension encountered should
137*535af610SEd Masteresult in KRL parsing failure. If false, then it may be safely be
138*535af610SEd Masteignored.
139*535af610SEd Maste
140*535af610SEd MasteThe "extension_contents" contains the body of the extension.
141*535af610SEd Maste
1426888a9beSDag-Erling Smørgrav3. Explicit key sections
1436888a9beSDag-Erling Smørgrav
1446888a9beSDag-Erling SmørgravThese sections, identified as KRL_SECTION_EXPLICIT_KEY, revoke keys
1456888a9beSDag-Erling Smørgrav(not certificates). They are less space efficient than serial numbers,
1466888a9beSDag-Erling Smørgravbut are able to revoke plain keys.
1476888a9beSDag-Erling Smørgrav
1486888a9beSDag-Erling Smørgrav	string	public_key_blob[0]
1496888a9beSDag-Erling Smørgrav	....
1506888a9beSDag-Erling Smørgrav
1516888a9beSDag-Erling SmørgravThis section must contain at least one "public_key_blob". The blob
1526888a9beSDag-Erling Smørgravmust be a raw key (i.e. not a certificate).
1536888a9beSDag-Erling Smørgrav
1546888a9beSDag-Erling SmørgravThis section may appear multiple times.
1556888a9beSDag-Erling Smørgrav
1562f513db7SEd Maste4. SHA1/SHA256 fingerprint sections
1576888a9beSDag-Erling Smørgrav
1582f513db7SEd MasteThese sections, identified as KRL_SECTION_FINGERPRINT_SHA1 and
1592f513db7SEd MasteKRL_SECTION_FINGERPRINT_SHA256, revoke plain keys (i.e. not
1602f513db7SEd Mastecertificates) by listing their hashes:
1616888a9beSDag-Erling Smørgrav
1626888a9beSDag-Erling Smørgrav	string	public_key_hash[0]
1636888a9beSDag-Erling Smørgrav	....
1646888a9beSDag-Erling Smørgrav
1656888a9beSDag-Erling SmørgravThis section must contain at least one "public_key_hash". The hash blob
1662f513db7SEd Masteis obtained by taking the SHA1 or SHA256 hash of the public key blob.
1672f513db7SEd MasteHashes in this section must appear in numeric order, treating each hash
1682f513db7SEd Masteas a big-endian integer.
1696888a9beSDag-Erling Smørgrav
1706888a9beSDag-Erling SmørgravThis section may appear multiple times.
1716888a9beSDag-Erling Smørgrav
172*535af610SEd Maste5. Extension sections
173*535af610SEd Maste
174*535af610SEd MasteThis section type provides a generic extension mechanism to the KRL
175*535af610SEd Masteformat that may be used to provide optional or critical data.
176*535af610SEd Maste
177*535af610SEd MasteExtensions are recorded in sections of type KRL_SECTION_EXTENSION
178*535af610SEd Mastewith the following contents:
179*535af610SEd Maste
180*535af610SEd Maste	string	extension_name
181*535af610SEd Maste	boolean is_critical
182*535af610SEd Maste	string	extension_contents.
183*535af610SEd Maste
184*535af610SEd MasteWhere "extension_name" describes the type of extension. It is
185*535af610SEd Masterecommended that user extensions follow "name@domain.org" naming.
186*535af610SEd Maste
187*535af610SEd MasteThe "is_critical" indicates whether this extension is mandatory or
188*535af610SEd Masteoptional. If true, then any unsupported extension encountered should
189*535af610SEd Masteresult in KRL parsing failure. If false, then it may be safely be
190*535af610SEd Masteignored.
191*535af610SEd Maste
192*535af610SEd MasteThe "extension_contents" contains the body of the extension.
193*535af610SEd Maste
194*535af610SEd Maste6. KRL signature sections
195*535af610SEd Maste
196*535af610SEd MasteNote: KRL signatures are not supported by OpenSSH. OpenSSH >= 9.4 will
197*535af610SEd Masterefuse to load KRLs that contain signatures. We recommend the use
198*535af610SEd Masteof SSHSIG (`ssh-keygen -Y sign ...`) style signatures for KRLs instead.
1996888a9beSDag-Erling Smørgrav
2006888a9beSDag-Erling SmørgravThe KRL_SECTION_SIGNATURE section serves a different purpose to the
201190cef3dSDag-Erling Smørgravpreceding ones: to provide cryptographic authentication of a KRL that
2026888a9beSDag-Erling Smørgravis retrieved over a channel that does not provide integrity protection.
2036888a9beSDag-Erling SmørgravIts format is slightly different to the previously-described sections:
2046888a9beSDag-Erling Smørgravin order to simplify the signature generation, it includes as a "body"
2056888a9beSDag-Erling Smørgravtwo string components instead of one.
2066888a9beSDag-Erling Smørgrav
2076888a9beSDag-Erling Smørgrav	byte	KRL_SECTION_SIGNATURE
2086888a9beSDag-Erling Smørgrav	string	signature_key
2096888a9beSDag-Erling Smørgrav	string	signature
2106888a9beSDag-Erling Smørgrav
2116888a9beSDag-Erling SmørgravThe signature is calculated over the entire KRL from the KRL_MAGIC
2126888a9beSDag-Erling Smørgravto this subsection's "signature_key", including both and using the
2136888a9beSDag-Erling Smørgravsignature generation rules appropriate for the type of "signature_key".
2146888a9beSDag-Erling Smørgrav
2156888a9beSDag-Erling SmørgravThis section must appear last in the KRL. If multiple signature sections
2166888a9beSDag-Erling Smørgravappear, they must appear consecutively at the end of the KRL file.
2176888a9beSDag-Erling Smørgrav
2186888a9beSDag-Erling SmørgravImplementations that retrieve KRLs over untrusted channels must verify
2196888a9beSDag-Erling Smørgravsignatures. Signature sections are optional for KRLs distributed by
2206888a9beSDag-Erling Smørgravtrusted means.
2216888a9beSDag-Erling Smørgrav
222*535af610SEd Maste$OpenBSD: PROTOCOL.krl,v 1.7 2023/07/17 04:01:10 djm Exp $
223