aboutsummaryrefslogtreecommitdiff
path: root/x509util/x509util.go
diff options
context:
space:
mode:
authorRasmus Dahlberg <rasmus.dahlberg@kau.se>2020-11-27 17:13:41 +0100
committerRasmus Dahlberg <rasmus.dahlberg@kau.se>2020-11-27 17:13:41 +0100
commit782d895d8d6e66938a3fa6914d8e93a79c949771 (patch)
tree8f3c5c21317a34cc6192c979a4fb9c440b941972 /x509util/x509util.go
parent11d95a45d7416d3f8c8a03051588cf8097e7246f (diff)
added ParseDerChain tests
Diffstat (limited to 'x509util/x509util.go')
-rw-r--r--x509util/x509util.go7
1 files changed, 5 insertions, 2 deletions
diff --git a/x509util/x509util.go b/x509util/x509util.go
index f95b136..c3ebd4b 100644
--- a/x509util/x509util.go
+++ b/x509util/x509util.go
@@ -104,8 +104,11 @@ func NewEd25519PrivateKey(data []byte) (ed25519.PrivateKey, error) {
// the remaining ones as its intermediate CertPool.
func ParseDerChain(chain [][]byte) (*x509.Certificate, *x509.CertPool, error) {
certificates, err := ParseDerList(chain)
- if err != nil || len(certificates) == 0 {
- return nil, nil, err // TODO: don't think the len check works now..
+ if err != nil {
+ return nil, nil, err
+ }
+ if len(certificates) == 0 {
+ return nil, nil, fmt.Errorf("empty certificate chain")
}
intermediatePool := x509.NewCertPool()
for _, certificate := range certificates[1:] {