diff --git a/subcerts.go b/subcerts.go index a21f901..7c9fbf7 100644 --- a/subcerts.go +++ b/subcerts.go @@ -39,7 +39,7 @@ import ( const ( dcMaxTTLSeconds = 60 * 60 * 24 * 7 // 7 days dcMaxTTL = time.Duration(dcMaxTTLSeconds * time.Second) - dcMaxPublicKeyLen = 1 << 16 // Bytes + dcMaxPublicKeyLen = 1 << 24 // Bytes dcMaxSignatureLen = 1 << 16 // Bytes ) @@ -135,7 +135,7 @@ func (cred *credential) marshal() ([]byte, error) { paramsLen := 8 // 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.PutUint16(serialized[4:], uint16(cred.expectedCertVerifyAlgorithm)) 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") } - // The next 2 bytes are the length of the public key field. - binary.BigEndian.PutUint16(serialized[paramsLen:], uint16(len(serializedPublicKey))) + // The next 3 bytes are the length of the public key field, which may be up + // to 2^24 bytes long. + putUint24(serialized[paramsLen:], len(serializedPublicKey)) // The remaining bytes are the public key itself. serialized = append(serialized, serializedPublicKey...) @@ -164,7 +165,7 @@ func unmarshalCredential(serialized []byte) (*credential, error) { // The number of bytes comprising the DC parameters. 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") } @@ -174,7 +175,7 @@ func unmarshalCredential(serialized []byte) (*credential, error) { version := binary.BigEndian.Uint16(serialized[6:]) // Parse the SubjectPublicKeyInfo. - pk, err := x509.ParsePKIXPublicKey(serialized[paramsLen+2:]) + pk, err := x509.ParsePKIXPublicKey(serialized[paramsLen+3:]) if err != nil { return nil, err } @@ -197,21 +198,22 @@ func unmarshalCredential(serialized []byte) (*credential, error) { // error if the input is too short to contain a credential. func getCredentialLen(serialized []byte) (int, error) { 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") } // First several bytes are the valid_time, scheme, and version fields. serialized = serialized[paramsLen:] - // The next 2 bytes are the length of the serialized public key. - serializedPublicKeyLen := int(binary.BigEndian.Uint16(serialized)) - serialized = serialized[2:] + // The next 3 bytes are the length of the serialized public key, which may + // be up to 2^24 bytes in length. + serializedPublicKeyLen := getUint24(serialized) + serialized = serialized[3:] if len(serialized) < serializedPublicKeyLen { 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. @@ -386,3 +388,16 @@ func prepareDelegation(hash crypto.Hash, cred, delegatorCert []byte, delegatorAl 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) +} diff --git a/subcerts_test.go b/subcerts_test.go index 12535ea..af25bae 100644 --- a/subcerts_test.go +++ b/subcerts_test.go @@ -72,154 +72,105 @@ type dcTestDC struct { // Test data used for testing the TLS handshake with the delegated credential // 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+tS3Nwhldcwq5F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TsNbXlDKca9nDp1xOVXp36I9jrg -nCm3+lYd0J2cPTiHjTZXjjCCATwTBXRsczEyAgIDAwICBAMEga8ACTqABAMDAwBb -MFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAEs/IKFXT7LH1tKHSrXCjk7wIhIigk -YnMNVKX3cvsXUhdDd115Cxwdd3K4gnya9q22daPFewrF+lO9KPv+PIbjyAQDAEYw -RAIgfAVo9yv5NdJLSa5TpvDViDxczalm7EXJP3Dh60EaevICIFCnJKHt8ZZ0i12o -nwvq52TI5LG7tTTKXSc7Un+blF62BHkwdwIBAQQgY00t5UvHWA9b01Alvn9bogNn -4O8MgvWOFEQ/BwTiKH+gCgYIKoZIzj0DAQehRANCAASz8goVdPssfW0odKtcKOTv -AiEiKCRicw1Upfdy+xdSF0N3XXkLHB13criCfJr2rbZ1o8V7CsX6U70o+/48huPI ------END DC TEST DATA----- -` - // Use with maxVersion == VersionTLS13Draft28. // // TODO(henrydcase): Remove this when we drop support for draft28. const DcTestDataDraft28PEM = `-----BEGIN DC TEST DATA----- -MIIIOjCCAUATCXRsczEzcDI1NgICfxwCAgQDBIGvAAk6gAQDfxwAWzBZMBMGByqG -SM49AgEGCCqGSM49AwEHA0IABAOcQMVs6VmVQ1BYyK+YhUAucZqH3LmDQmAaVDs8 -brnePHVmSdOoQCU+Ybp3kgnklW958EFZiJ2oK7iWkIpi4TIEAwBGMEQCIB8w0eko -uXISSCwpIGoYr+NAkBhVTrWOWymYiO2RoIn5AiADY+vYy1BXt+gis/lD9kYrQWo6 -oQJFiUErUKHph6CRxgR5MHcCAQEEIICSvbEkPpYV0/LGzmfUjsNLTWBqS3SvA6G8 -AMS4ECtVoAoGCCqGSM49AwEHoUQDQgAEA5xAxWzpWZVDUFjIr5iFQC5xmofcuYNC -YBpUOzxuud48dWZJ06hAJT5huneSCeSVb3nwQVmInagruJaQimLhMjCCAesTCXRs -czEzcDUyMQICfxwCAgYDBIHzAAk6gAYDfxwAnjCBmzAQBgcqhkj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XgJ5Mop4Spbpp3bjwzQw7Pg6T9vQH0q8Hy +CTG65vcmu2whOu+0nR3eJg7rt9BhcHredcOoUhGbgqbRMIIBPhMGYmFkc2lnAgJ/ +HAICBAMEgbAACTqABAN/HAAAWzBZMBMGByqGSM49AgEGCCqGSM49AwEHA0IABBlb +oANTnMd8jcnuzyCv+I+l51tqVog0wagYMo6L7A2RlTqgTYaz0p7mH3wsHfsv/Py8 +Scv5o7vp/MIQjEbeg8wEAwBGMEQCIDozxK17n3gytnV9h6X9BKz5GsxBgr9+Ympe +9XXppP57AiAPks17U0EhoIhSk6dhmVpgjkoHt9jxn1xYIwJxceGWywR5MHcCAQEE +IH7GjuBRPz5WvrYrmD6dlCHX5Fda2C7faa+f0mmjkOfvoAoGCCqGSM49AwEHoUQD +QgAEGVugA1Ocx3yNye7PIK/4j6XnW2pWiDTBqBgyjovsDZGVOqBNhrPSnuYffCwd ++y/8/LxJy/mju+n8whCMRt6DzDCCAT8TBXRsczEyAgIDAwICBAMEgbIACTqABAMD +AwAAWzBZMBMGByqGSM49AgEGCCqGSM49AwEHA0IABFbRSfoqtGJdMb7NP3hENn6A +b8tzLgr8Cj77JSoSVloy/+XOa+wz1OhEzA2b54WkEhVQor+RAT688z7UwEXFwWsE +AwBIMEYCIQCdahwKMP01K5rvn3IU7JQElg1TjnGw1vZk7zsjg1B0gQIhAMLlhfUA +Zd/eyMHutw9HfBOWX7rlcKN12RwtGuNXvZ1BBHkwdwIBAQQgSSNaIBwdPWauUSKg +LN73E41eUQrWung1lwgTQWV1AhqgCgYIKoZIzj0DAQehRANCAARW0Un6KrRiXTG+ +zT94RDZ+gG/Lcy4K/Ao++yUqElZaMv/lzmvsM9ToRMwNm+eFpBIVUKK/kQE+vPM+ +1MBFxcFr -----END DC TEST DATA----- ` // Use with maxVersion == VersionTLS13. const DcTestDataTLS13PEM = `-----BEGIN DC TEST DATA----- -MIIIOzCCAUATCXRsczEzcDI1NgICAwQCAgQDBIGvAAk6gAQDAwQAWzB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n+ly9mb+hWPp2j0UJKiXwQmMf4vicNOYyjreml8Hf +VQQDAEcwRQIhANfDJ57MDLZqtye+uolguWx39vhfkvB9svEjYZwWTcoKAiALBgkH +OoRxcalH9qbE2p6LHLszqYyYW312aTHHYF0/6QR5MHcCAQEEILFX1gHwKwJwAQI+ +GNisTdlwN0clslAccLogW0ON0gAZoAoGCCqGSM49AwEHoUQDQgAEnsChIIFXdvdO +TFnf3cyvMsHKpSy68X+SbepvhPg+MBrn+ly9mb+hWPp2j0UJKiXwQmMf4vicNOYy +jreml8HfVQ== -----END DC TEST DATA-----` // Parses the input PEM block containing the test DCs. @@ -272,9 +223,7 @@ func init() { // Load the DC test data. var testData []byte switch maxVersion { - case VersionTLS13Draft23: - testData = []byte(DcTestDataDraft23PEM) - case 0x7f00 | 28: // TODO(henrydcase): Fix once draft 28 is implemented + case VersionTLS13Draft28: testData = []byte(DcTestDataDraft28PEM) case 0x0304: // TODO(henrydcase): Fix once the final version is implemented testData = []byte(DcTestDataTLS13PEM)