aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--client/client.go4
-rw-r--r--x509util/x509util.go10
2 files changed, 7 insertions, 7 deletions
diff --git a/client/client.go b/client/client.go
index d070de9..4658a25 100644
--- a/client/client.go
+++ b/client/client.go
@@ -224,7 +224,7 @@ func (c *Client) GetEntries(ctx context.Context, start, end uint64) ([]*stfe.Get
if item.Format != stfe.StFormatChecksumV1 {
return nil, fmt.Errorf("bad StFormat: %v (%v)", err, entry)
}
- if chain, err := x509util.ParseDerChainToList(entry.Chain); err != nil {
+ if chain, err := x509util.ParseDerList(entry.Chain); err != nil {
return nil, fmt.Errorf("bad certificate chain: %v (%v)", err, entry)
} else if err := x509util.VerifyChain(chain); err != nil {
return nil, fmt.Errorf("invalid certificate chain: %v (%v)", err, entry)
@@ -246,7 +246,7 @@ func (c *Client) GetAnchors(ctx context.Context) ([]*x509.Certificate, error) {
if err := c.doRequest(ctx, req, &rsp); err != nil {
return nil, err
}
- return x509util.ParseDerChainToList(rsp)
+ return x509util.ParseDerList(rsp)
}
func (c *Client) chain() [][]byte {
diff --git a/x509util/x509util.go b/x509util/x509util.go
index c005bed..37688ad 100644
--- a/x509util/x509util.go
+++ b/x509util/x509util.go
@@ -112,7 +112,7 @@ func ParseChain(rest []byte) ([]*x509.Certificate, error) {
// first (zero-index) string is interpretted as an end-entity certificate and
// the remaining ones as the an intermediate CertPool.
func ParseDerChain(chain [][]byte) (*x509.Certificate, *x509.CertPool, error) {
- certificates, err := ParseDerChainToList(chain)
+ certificates, err := ParseDerList(chain)
if err != nil || len(certificates) == 0 {
return nil, nil, err
}
@@ -123,10 +123,10 @@ func ParseDerChain(chain [][]byte) (*x509.Certificate, *x509.CertPool, error) {
return certificates[0], intermediatePool, nil
}
-// ParseDerChainToList parses a list of DER-encoded certificates
-func ParseDerChainToList(chain [][]byte) ([]*x509.Certificate, error) {
- ret := make([]*x509.Certificate, 0, len(chain))
- for _, der := range chain {
+// ParseDerList parses a list of DER-encoded certificates
+func ParseDerList(certificates [][]byte) ([]*x509.Certificate, error) {
+ ret := make([]*x509.Certificate, 0, len(certificates))
+ for _, der := range certificates {
c, err := x509.ParseCertificate(der)
if err != nil {
return nil, fmt.Errorf("certificate decoding failed: %v", err)