Skip to content

Commit 016904d

Browse files
committed
go: drop Unmarshal*ChainArray() entrypoints
1 parent 2f91c14 commit 016904d

File tree

1 file changed

+0
-58
lines changed

1 file changed

+0
-58
lines changed

go/serialization.go

Lines changed: 0 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
package ct
22

33
import (
4-
"bytes"
5-
"container/list"
64
"crypto"
75
"encoding/binary"
86
"encoding/json"
@@ -96,62 +94,6 @@ func readVarBytes(r io.Reader, numLenBytes int) ([]byte, error) {
9694
return data, nil
9795
}
9896

99-
// Reads a list of ASN1Cert types from |r|
100-
func readASN1CertList(r io.Reader, totalLenBytes int, elementLenBytes int) ([]ASN1Cert, error) {
101-
listBytes, err := readVarBytes(r, totalLenBytes)
102-
if err != nil {
103-
return []ASN1Cert{}, err
104-
}
105-
list := list.New()
106-
listReader := bytes.NewReader(listBytes)
107-
var entry []byte
108-
for err == nil {
109-
entry, err = readVarBytes(listReader, elementLenBytes)
110-
if err != nil {
111-
if err != io.EOF {
112-
return []ASN1Cert{}, err
113-
}
114-
} else {
115-
list.PushBack(entry)
116-
}
117-
}
118-
ret := make([]ASN1Cert, list.Len())
119-
i := 0
120-
for e := list.Front(); e != nil; e = e.Next() {
121-
ret[i] = ASN1Cert{Data: e.Value.([]byte)}
122-
i++
123-
}
124-
return ret, nil
125-
}
126-
127-
// UnmarshalX509ChainArray unmarshalls the contents of the "chain:" entry in a
128-
// GetEntries response in the case where the entry refers to an X509 leaf.
129-
func UnmarshalX509ChainArray(b []byte) ([]ASN1Cert, error) {
130-
return readASN1CertList(bytes.NewReader(b), CertificateChainLengthBytes, CertificateLengthBytes)
131-
}
132-
133-
// UnmarshalPrecertChainArray unmarshalls the contents of the "chain:" entry in
134-
// a GetEntries response in the case where the entry refers to a Precertificate
135-
// leaf.
136-
func UnmarshalPrecertChainArray(b []byte) ([]ASN1Cert, error) {
137-
var chain []ASN1Cert
138-
139-
reader := bytes.NewReader(b)
140-
// read the pre-cert entry:
141-
precert, err := readVarBytes(reader, CertificateLengthBytes)
142-
if err != nil {
143-
return chain, err
144-
}
145-
chain = append(chain, ASN1Cert{Data: precert})
146-
// and then read and return the chain up to the root:
147-
remainingChain, err := readASN1CertList(reader, CertificateChainLengthBytes, CertificateLengthBytes)
148-
if err != nil {
149-
return chain, err
150-
}
151-
chain = append(chain, remainingChain...)
152-
return chain, nil
153-
}
154-
15597
func checkExtensionsFormat(ext CTExtensions) error {
15698
if len(ext) > MaxExtensionsLength {
15799
return errors.New("extensions too large")

0 commit comments

Comments
 (0)