Added Dehydrated TLS Certificates spec.

pull/24/head
JeremyRand 8 years ago
parent 6a7832b19d
commit c37aeda351

@ -1,17 +1,19 @@
IFA Proposals
=============
| Number | Title | Type | Status |
|--------------|-------------------------------|----------|----------|
| [0000][0000] | Proposal Guidelines & Process | Process | Draft |
| [0001][0001] | Domain Names | Standard | Draft |
| [0002][0002] | Domain Names - Non-DNS Types | Standard | Draft |
| Number | Title | Type | Status |
|--------------|--------------------------------------------|----------|----------|
| [0000][0000] | Proposal Guidelines & Process | Process | Draft |
| [0001][0001] | Domain Names | Standard | Draft |
| [0002][0002] | Domain Names - Non-DNS Types | Standard | Draft |
| [0003][0003] | Domain Names - Dehydrated TLS Certificates | Standard | Draft |
*This list does not contain proposals that have been deferred, rejected, or withdrawn.*
[0000]:https://github.com/ifa-wg/proposals/blob/master/ifa-0000.md
[0001]:https://github.com/ifa-wg/proposals/blob/master/ifa-0001.md
[0002]:https://github.com/ifa-wg/proposals/blob/master/ifa-0002.md
[0003]:https://github.com/ifa-wg/proposals/blob/master/ifa-0003.md
How-To
=======

@ -0,0 +1,179 @@
Domain Names — Dehydrated TLS Certificates
==========================================
IFA Proposal No. 3
Title: Domain Names — Dehydrated TLS Certificates
Status: Draft
Type: Standards Track
Created: 2016-06-12
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 RFC 2119.
This document is released into the public domain.
This document was authored by Jeremy Rand, with input from Ryan Castellucci and Hugo Landau.
<!-- START doctoc generated TOC please keep comment here to allow auto update -->
<!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE -->
**Table of Contents**
- [Introduction](#introduction)
- [Dehydrated "tls" Items](#dehydrated-tls-items)
- [Design Goals](#design-goals)
- [Changes to Processing Rules](#changes-to-processing-rules)
- [Changes to Domain Name Owner Recommendations](#changes-to-domain-name-owner-recommendations)
- [Changelog](#changelog)
<!-- END doctoc generated TOC please keep comment here to allow auto update -->
Introduction
------------
This document extends the Domain Names specification, IFA-0001. It specifies an additional format of encoding the "tls" item type. This format is more suited for integrating "tls" item support into mainstream certificate trust stores, given the API limitations of those trust stores.
Dehydrated "tls" Items
----------------------
A dehydrated certificate in JSON format looks like:
```
["MFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAEJlmDLitmolpxbKFQxRSj5AbF7VOip9XOyAC9HfmTWibGMpODJQH7LXyEo5o/wc2fHB+7aoKcW+eZ74+3ZN+4SA==",4838688,5154336,10,"MEYCIQCtBKJDjBg3M+RuHecPWgdo99wyPASBXsLMIlG3OYKJywIhAMXPMA+mDqNhgsLGdiyLQ09hsYbwami2hkvM9ijDPJj7"]
```
It is a JSON list of 5 items.
1. a base64 string representing the public key. Typically an EC public key, not RSA, because EC is much more compact. The public key is not compressed, because compressed EC public keys are not widely supported by libraries (particularly the Golang standard library).
2. an integer representing the "not before" part of the validity period, in units of 5 minutes. 5 minutes essentially divides the number by 300, which eliminates slightly more than 1 byte.
3. an integer representing the "not after" part of the validity period, in units of 5 minutes. 5 minutes essentially divides the number by 300, which eliminates slightly more than 1 byte.
4. an integer representing the signature algorithm. Typically ECDSA with SHA256.
5. a base64 string representing the signature. Typically ECDSA with SHA256.
These 5 items are chosen for 3 reasons:
1. A valid certificate can be rehydrated from these 5 items (plus a domain name). This means that TLS applications that require possessing a full certificate (not just a public key hash) in order to set up an override can be configured without out-of-band retrieval of a certificate.
2. These items are much smaller than the rehydrated certificate would be, and therefore can comfortably fit into a datastore where storage is expensive (e.g. a Namecoin value).
3. Rehydrated certificates are minimally trusted. For example, rehydrated certificates cannot be valid for other domain names or uses (via SAN, the CA flag, etc.) than the one which the user retrieving a TLSA record expects. As a result, these certificates can be added to a root CA trust store with minimal security implications.
To rehydrate into a full certificate, construct a self-signed certificate with the following fields:
* NotBefore: based on dehydrated data, after converting units.
* NotAfter: based on dehydrated data, after converting units.
* KeyUsage: KeyUsageDigitalSignature
* ExtKeyUsage: ExtKeyUsageServerAuth
* BasicConstraintsValid: true
* SignatureAlgorithm: based on dehydrated data
* PublicKey: based on dehydrated data
* Signature: based on dehydrated data
* Subject Organization: the .bit domain in use
* Subject SerialNumber: "Namecoin TLS Certificate"
* DNSNames: the .bit domain in use
* SerialNumber: first 19 bytes of SHA256(SHA256(the .bit domain in use) | SHA256(PublicKey) | SHA256(big-endian int64 of NotBefore in units of 5 minutes) | SHA256(big-endian int64 of NotAfter in units of 5 minutes))
The certificate shown above in JSON, for the domain name "www.veclabs.bit", looks like this:
```
$ cat cert.pem | openssl x509 -text
Certificate:
Data:
Version: 3 (0x2)
Serial Number:
3a:f7:1d:51:bc:af:96:ca:96:a7:a7:2e:28:65:18:dc:dc:f9:8d
Signature Algorithm: ecdsa-with-SHA256
Issuer: O=www.veclabs.bit/serialNumber=Namecoin TLS Certificate
Validity
Not Before: Jan 1 00:00:00 2016 GMT
Not After : Jan 1 00:00:00 2019 GMT
Subject: O=www.veclabs.bit/serialNumber=Namecoin TLS Certificate
Subject Public Key Info:
Public Key Algorithm: id-ecPublicKey
Public-Key: (256 bit)
pub:
04:26:59:83:2e:2b:66:a2:5a:71:6c:a1:50:c5:14:
a3:e4:06:c5:ed:53:a2:a7:d5:ce:c8:00:bd:1d:f9:
93:5a:26:c6:32:93:83:25:01:fb:2d:7c:84:a3:9a:
3f:c1:cd:9f:1c:1f:bb:6a:82:9c:5b:e7:99:ef:8f:
b7:64:df:b8:48
ASN1 OID: prime256v1
X509v3 extensions:
X509v3 Key Usage: critical
Digital Signature
X509v3 Extended Key Usage:
TLS Web Server Authentication
X509v3 Basic Constraints: critical
CA:FALSE
X509v3 Subject Alternative Name:
DNS:www.veclabs.bit
Signature Algorithm: ecdsa-with-SHA256
30:46:02:21:00:ad:04:a2:43:8c:18:37:33:e4:6e:1d:e7:0f:
5a:07:68:f7:dc:32:3c:04:81:5e:c2:cc:22:51:b7:39:82:89:
cb:02:21:00:c5:cf:30:0f:a6:0e:a3:61:82:c2:c6:76:2c:8b:
43:4f:61:b1:86:f0:6a:68:b6:86:4b:cc:f6:28:c3:3c:98:fb
-----BEGIN CERTIFICATE-----
MIIBzTCCAXKgAwIBAgITOvcdUbyvlsqWp6cuKGUY3Nz5jTAKBggqhkjOPQQDAjA9
MRgwFgYDVQQKEw93d3cudmVjbGFicy5iaXQxITAfBgNVBAUTGE5hbWVjb2luIFRM
UyBDZXJ0aWZpY2F0ZTAeFw0xNjAxMDEwMDAwMDBaFw0xOTAxMDEwMDAwMDBaMD0x
GDAWBgNVBAoTD3d3dy52ZWNsYWJzLmJpdDEhMB8GA1UEBRMYTmFtZWNvaW4gVExT
IENlcnRpZmljYXRlMFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAEJlmDLitmolpx
bKFQxRSj5AbF7VOip9XOyAC9HfmTWibGMpODJQH7LXyEo5o/wc2fHB+7aoKcW+eZ
74+3ZN+4SKNRME8wDgYDVR0PAQH/BAQDAgeAMBMGA1UdJQQMMAoGCCsGAQUFBwMB
MAwGA1UdEwEB/wQCMAAwGgYDVR0RBBMwEYIPd3d3LnZlY2xhYnMuYml0MAoGCCqG
SM49BAMCA0kAMEYCIQCtBKJDjBg3M+RuHecPWgdo99wyPASBXsLMIlG3OYKJywIh
AMXPMA+mDqNhgsLGdiyLQ09hsYbwami2hkvM9ijDPJj7
-----END CERTIFICATE-----
```
Note that a canonical implementation (in Go) of this scheme is being added to ncdns. Because the signatures will fail if the certificate is not constructed deterministically, the canonical implementation of certificate construction takes precedence over this spec and any examples. (Please report any inconsistencies.)
An IFA-0001-based JSON value which uses the above dehydrated certificate looks like this:
```
{
"map":{
"www":{
"map":{
"_tcp":{
"map":{
"_443":{
"tls":[
[
"d8",
0,
0,
[
"MFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAEJlmDLitmolpxbKFQxRSj5AbF7VOip9XOyAC9HfmTWibGMpODJQH7LXyEo5o/wc2fHB+7aoKcW+eZ74+3ZN+4SA==",
4838688,
5154336,
10,
"MEYCIQCtBKJDjBg3M+RuHecPWgdo99wyPASBXsLMIlG3OYKJywIhAMXPMA+mDqNhgsLGdiyLQ09hsYbwami2hkvM9ijDPJj7"
]
]
]
}
}
}
}
}
}
}
```
The "d8", 0, 0 before the certificate data is a magic indicator that this is a dehydrated certificate rather than a format based on RFC 6698 (DANE). "d8" is an abbreviation for how "dehydrate" is pronounced in English, and will not collide with future revisions to DANE because DANE uses an integer here while this spec uses a string. The latter 0 is intended as a version field. The former 0 is reserved, and is only present so that the number of elements in a "tls" record is constant regardless of whether it's dehydrated or DANE-based.
Design Goals
------------
The primary goal is to fit comfortably into a Namecoin value (which is limited to 520 bytes) when combined with IP addresses or other data. We believe that it achieves this. The goal is **not** to achieve optimal compression at this time. We expect to improve on the scalability of Namecoin values in the future, via proposals such as CBOR encoding, value compression, and segregated name values; improvements in dehydrated certificate encoding (e.g. compressed public keys and removing the overhead of base64 and decimal encoding) are fair game for those future efforts. We are choosing not to fully optimize at this time because we believe that the current proposal is currently sufficient, and future revisions to this spec are affected by ecosystem elements out of the scope of this proposal, including uncertainty about the above scalability improvements, and also including uncertainty about how TLS implementations may change their requirements in the future (for example, Mozilla's WebExtensions spec is still up in the air).
Changes to Processing Rules
---------------------------
There are no changes to item suppression or other processing rules.
Changes to Domain Name Owner Recommendations
--------------------------------------------
Dehydrated "tls" items are more widely compatible with currently deployed TLS implementations, e.g. Google Chrome and Mozilla Firefox. However, because their encoding contains more data than a public key hash, dehydrated "tls" items will incur higher storage costs than the encoding specified in IFA-0001. Domain name owners are advised to consider the tradeoffs between compatibility and storage costs when choosing how to encode their "tls" items. It is our belief that, in most publicly deployed website configurations, the improved compatibility of dehydrated "tls" items makes their usage preferable, and that their increased storage costs are negligible in such configurations.
Changelog
---------
- 20160612: Initial revision.
Loading…
Cancel
Save