DC draft-02, last minute change (#121)

* Drop DC test data for draft23

* DC: Change public key type

There was a last minute change to spec that changes the public key type
from a byte string of length at most 2^16 to a byte string of length at
most 2^24.
This commit is contained in:
Christopher Patton 2018-08-10 00:34:10 -07:00 committed by Kris Kwiatkowski
parent e77e39e7aa
commit a2fe2d9a71
2 changed files with 117 additions and 153 deletions

View File

@ -39,7 +39,7 @@ import (
const ( const (
dcMaxTTLSeconds = 60 * 60 * 24 * 7 // 7 days dcMaxTTLSeconds = 60 * 60 * 24 * 7 // 7 days
dcMaxTTL = time.Duration(dcMaxTTLSeconds * time.Second) dcMaxTTL = time.Duration(dcMaxTTLSeconds * time.Second)
dcMaxPublicKeyLen = 1 << 16 // Bytes dcMaxPublicKeyLen = 1 << 24 // Bytes
dcMaxSignatureLen = 1 << 16 // Bytes dcMaxSignatureLen = 1 << 16 // Bytes
) )
@ -135,7 +135,7 @@ func (cred *credential) marshal() ([]byte, error) {
paramsLen := 8 paramsLen := 8
// The first 4 bytes are the valid_time, scheme, and version fields. // The first 4 bytes are the valid_time, scheme, and version fields.
serialized := make([]byte, paramsLen+2) serialized := make([]byte, paramsLen+3) // +3 for the length of the public key field
binary.BigEndian.PutUint32(serialized, uint32(cred.validTime/time.Second)) binary.BigEndian.PutUint32(serialized, uint32(cred.validTime/time.Second))
binary.BigEndian.PutUint16(serialized[4:], uint16(cred.expectedCertVerifyAlgorithm)) binary.BigEndian.PutUint16(serialized[4:], uint16(cred.expectedCertVerifyAlgorithm))
binary.BigEndian.PutUint16(serialized[6:], cred.expectedVersion) binary.BigEndian.PutUint16(serialized[6:], cred.expectedVersion)
@ -150,8 +150,9 @@ func (cred *credential) marshal() ([]byte, error) {
return nil, errors.New("public key is too long") return nil, errors.New("public key is too long")
} }
// The next 2 bytes are the length of the public key field. // The next 3 bytes are the length of the public key field, which may be up
binary.BigEndian.PutUint16(serialized[paramsLen:], uint16(len(serializedPublicKey))) // to 2^24 bytes long.
putUint24(serialized[paramsLen:], len(serializedPublicKey))
// The remaining bytes are the public key itself. // The remaining bytes are the public key itself.
serialized = append(serialized, serializedPublicKey...) serialized = append(serialized, serializedPublicKey...)
@ -164,7 +165,7 @@ func unmarshalCredential(serialized []byte) (*credential, error) {
// The number of bytes comprising the DC parameters. // The number of bytes comprising the DC parameters.
paramsLen := 8 paramsLen := 8
if len(serialized) < paramsLen+2 { if len(serialized) < paramsLen+3 { // +3 bytes for the public key length
return nil, errors.New("credential is too short") return nil, errors.New("credential is too short")
} }
@ -174,7 +175,7 @@ func unmarshalCredential(serialized []byte) (*credential, error) {
version := binary.BigEndian.Uint16(serialized[6:]) version := binary.BigEndian.Uint16(serialized[6:])
// Parse the SubjectPublicKeyInfo. // Parse the SubjectPublicKeyInfo.
pk, err := x509.ParsePKIXPublicKey(serialized[paramsLen+2:]) pk, err := x509.ParsePKIXPublicKey(serialized[paramsLen+3:])
if err != nil { if err != nil {
return nil, err return nil, err
} }
@ -197,21 +198,22 @@ func unmarshalCredential(serialized []byte) (*credential, error) {
// error if the input is too short to contain a credential. // error if the input is too short to contain a credential.
func getCredentialLen(serialized []byte) (int, error) { func getCredentialLen(serialized []byte) (int, error) {
paramsLen := 8 paramsLen := 8
if len(serialized) < paramsLen+2 { if len(serialized) < paramsLen+3 { // +3 for the public key length
return 0, errors.New("credential is too short") return 0, errors.New("credential is too short")
} }
// First several bytes are the valid_time, scheme, and version fields. // First several bytes are the valid_time, scheme, and version fields.
serialized = serialized[paramsLen:] serialized = serialized[paramsLen:]
// The next 2 bytes are the length of the serialized public key. // The next 3 bytes are the length of the serialized public key, which may
serializedPublicKeyLen := int(binary.BigEndian.Uint16(serialized)) // be up to 2^24 bytes in length.
serialized = serialized[2:] serializedPublicKeyLen := getUint24(serialized)
serialized = serialized[3:]
if len(serialized) < serializedPublicKeyLen { if len(serialized) < serializedPublicKeyLen {
return 0, errors.New("public key of credential is too short") return 0, errors.New("public key of credential is too short")
} }
return paramsLen + 2 + serializedPublicKeyLen, nil return paramsLen + 3 + serializedPublicKeyLen, nil
} }
// delegatedCredential stores a credential and its delegation. // delegatedCredential stores a credential and its delegation.
@ -386,3 +388,16 @@ func prepareDelegation(hash crypto.Hash, cred, delegatorCert []byte, delegatorAl
return h.Sum(nil) return h.Sum(nil)
} }
func getUint24(b []byte) int {
n := int(b[2])
n += int(b[1] << 8)
n += int(b[0] << 16)
return n
}
func putUint24(b []byte, n int) {
b[0] = byte(n >> 16)
b[1] = byte(n >> 8)
b[2] = byte(n & 0xff)
}

View File

@ -72,154 +72,105 @@ type dcTestDC struct {
// Test data used for testing the TLS handshake with the delegated credential // Test data used for testing the TLS handshake with the delegated credential
// extension. The PEM block encodes a DER encoded slice of dcTestDCs. // extension. The PEM block encodes a DER encoded slice of dcTestDCs.
// Use with maxVersion == VersionTLS13Draft23.
//
// TODO(henrydcase): Remove this when we drop support for draft23.
const DcTestDataDraft23PEM = `-----BEGIN DC TEST DATA-----
MIIIPDCCAUETCXRsczEzcDI1NgICfxcCAgQDBIGwAAk6gAQDfxcAWzBZMBMGByqG
SM49AgEGCCqGSM49AwEHA0IABDFeK+EcMQWKDM6xZJqHEHLcIWE0iHTAL1xAB5r6
bkm7GLlz1HLWcTy28PNsb9KQLV3Yeay2WYA2d2zGQjNbEhcEAwBHMEUCIQDnXyP4
dOv3a20MDpRX2aNDoY5oQa+tS3Nwhldcwq5F0AIgRtHijJhhCNYFIEygT3VDUqiD
tr9HO2rW7nd8htAkfAsEeTB3AgEBBCA0Xr2CPlkYhONrwcKzIMa4049vzIJqEKrq
lyj8wbBwsKAKBggqhkjOPQMBB6FEA0IABDFeK+EcMQWKDM6xZJqHEHLcIWE0iHTA
L1xAB5r6bkm7GLlz1HLWcTy28PNsb9KQLV3Yeay2WYA2d2zGQjNbEhcwggHsEwl0
bHMxM3A1MjECAn8XAgIGAwSB9AAJOoAGA38XAJ4wgZswEAYHKoZIzj0CAQYFK4EE
ACMDgYYABAGxCv0cyyjBcTIJL793BaStJjp6fgKkycPmXcJJzakqFzh6BU1X9btL
E6fE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TiKH+gCgYIKoZIzj0DAQehRANCAASz8goVdPssfW0odKtcKOTv
AiEiKCRicw1Upfdy+xdSF0N3XXkLHB13criCfJr2rbZ1o8V7CsX6U70o+/48huPI
-----END DC TEST DATA-----
`
// Use with maxVersion == VersionTLS13Draft28. // Use with maxVersion == VersionTLS13Draft28.
// //
// TODO(henrydcase): Remove this when we drop support for draft28. // TODO(henrydcase): Remove this when we drop support for draft28.
const DcTestDataDraft28PEM = `-----BEGIN DC TEST DATA----- const DcTestDataDraft28PEM = `-----BEGIN DC TEST DATA-----
MIIIOjCCAUATCXRsczEzcDI1NgICfxwCAgQDBIGvAAk6gAQDfxwAWzBZMBMGByqG MIIIQjCCAUETCXRsczEzcDI1NgICfxwCAgQDBIGwAAk6gAQDfxwAAFswWTATBgcq
SM49AgEGCCqGSM49AwEHA0IABAOcQMVs6VmVQ1BYyK+YhUAucZqH3LmDQmAaVDs8 hkjOPQIBBggqhkjOPQMBBwNCAASfXv9/jTDWOG9nwKmIN1GrFqF0p0frgMl6rxvy
brnePHVmSdOoQCU+Ybp3kgnklW958EFZiJ2oK7iWkIpi4TIEAwBGMEQCIB8w0eko fu/58dkS0ZduzOUBG7qHsu+jHE8T29jH8SCH4Otl+3abna8IBAMARjBEAiAtDM7j
uXISSCwpIGoYr+NAkBhVTrWOWymYiO2RoIn5AiADY+vYy1BXt+gis/lD9kYrQWo6 w0bNce3QrVupL3wh5CUhIsTAwoYuWLls+1U8mwIgb/MHyZbcA7tALI0mNIJ1WRwy
oQJFiUErUKHph6CRxgR5MHcCAQEEIICSvbEkPpYV0/LGzmfUjsNLTWBqS3SvA6G8 V7tByFYV21ataGTa+6UEeTB3AgEBBCDXxru/xm8LfdX+VVZBhBrb4kYrtVU28SNe
AMS4ECtVoAoGCCqGSM49AwEHoUQDQgAEA5xAxWzpWZVDUFjIr5iFQC5xmofcuYNC q4TcMhvxUKAKBggqhkjOPQMBB6FEA0IABJ9e/3+NMNY4b2fAqYg3UasWoXSnR+uA
YBpU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Ic9Xm9LPRCjgW8cISf/wAoEAwBGMEQC b8tzLgr8Cj77JSoSVloy/+XOa+wz1OhEzA2b54WkEhVQor+RAT688z7UwEXFwWsE
IHgrVPo+J2whYBSslQ3toPCZ9Hygwdhho5d0aB5Q6f6PAiB0bXvL/2+VUE4D/lh3 AwBIMEYCIQCdahwKMP01K5rvn3IU7JQElg1TjnGw1vZk7zsjg1B0gQIhAMLlhfUA
TzNtizaKQZHlwQlrXX07cwqbKAR5MHcCAQEEIB0YHNFp2BdagajAMWHsPizrVzvk Zd/eyMHutw9HfBOWX7rlcKN12RwtGuNXvZ1BBHkwdwIBAQQgSSNaIBwdPWauUSKg
Sw7EmPfUU6ECjwpOoAoGCCqGSM49AwEHoUQDQgAE8SQ9imdKVT9UQ8MjevF27vyX LN73E41eUQrWung1lwgTQWV1AhqgCgYIKoZIzj0DAQehRANCAARW0Un6KrRiXTG+
x/tlNfATUGmFQGwPug4RyWVux22dGrn81/SsIXJ8hz1eb0s9EKOBbxwhJ//ACg== zT94RDZ+gG/Lcy4K/Ao++yUqElZaMv/lzmvsM9ToRMwNm+eFpBIVUKK/kQE+vPM+
1MBFxcFr
-----END DC TEST DATA----- -----END DC TEST DATA-----
` `
// Use with maxVersion == VersionTLS13. // Use with maxVersion == VersionTLS13.
const DcTestDataTLS13PEM = `-----BEGIN DC TEST DATA----- const DcTestDataTLS13PEM = `-----BEGIN DC TEST DATA-----
MIIIOzCCAUATCXRsczEzcDI1NgICAwQCAgQDBIGvAAk6gAQDAwQAWzBZMBMGByqG MIIIQzCCAUMTCXRsczEzcDI1NgICAwQCAgQDBIGyAAk6gAQDAwQAAFswWTATBgcq
SM49AgEGCCqGSM49AwEHA0IABFTImzqflLfyu3rqlCVsezSv45fKJglhjDYcwJ3H hkjOPQIBBggqhkjOPQMBBwNCAAQpQtUm8AWOzCN+aGUVsoKH9lZWNqkQCBGhpVtT
ylqX6rFCupeCwKmMhFvxRkkWAOobv2DZxLYALFgggC8KckkEAwBGMEQCIBW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DC TEST DATA-----` -----END DC TEST DATA-----`
// Parses the input PEM block containing the test DCs. // Parses the input PEM block containing the test DCs.
@ -272,9 +223,7 @@ func init() {
// Load the DC test data. // Load the DC test data.
var testData []byte var testData []byte
switch maxVersion { switch maxVersion {
case VersionTLS13Draft23: case VersionTLS13Draft28:
testData = []byte(DcTestDataDraft23PEM)
case 0x7f00 | 28: // TODO(henrydcase): Fix once draft 28 is implemented
testData = []byte(DcTestDataDraft28PEM) testData = []byte(DcTestDataDraft28PEM)
case 0x0304: // TODO(henrydcase): Fix once the final version is implemented case 0x0304: // TODO(henrydcase): Fix once the final version is implemented
testData = []byte(DcTestDataTLS13PEM) testData = []byte(DcTestDataTLS13PEM)