aboutsummaryrefslogtreecommitdiff
path: root/src/crypto/x509/verify_test.go
diff options
context:
space:
mode:
Diffstat (limited to 'src/crypto/x509/verify_test.go')
-rw-r--r--src/crypto/x509/verify_test.go19
1 files changed, 19 insertions, 0 deletions
diff --git a/src/crypto/x509/verify_test.go b/src/crypto/x509/verify_test.go
index 861d2b3890..8a7a5f6e2c 100644
--- a/src/crypto/x509/verify_test.go
+++ b/src/crypto/x509/verify_test.go
@@ -2792,3 +2792,22 @@ func TestVerifyEKURootAsLeaf(t *testing.T) {
}
}
+
+func TestVerifyNilPubKey(t *testing.T) {
+ c := &Certificate{
+ RawIssuer: []byte{1, 2, 3},
+ AuthorityKeyId: []byte{1, 2, 3},
+ }
+ opts := &VerifyOptions{}
+ opts.Roots = NewCertPool()
+ r := &Certificate{
+ RawSubject: []byte{1, 2, 3},
+ SubjectKeyId: []byte{1, 2, 3},
+ }
+ opts.Roots.AddCert(r)
+
+ _, err := c.buildChains([]*Certificate{r}, nil, opts)
+ if _, ok := err.(UnknownAuthorityError); !ok {
+ t.Fatalf("buildChains returned unexpected error, got: %v, want %v", err, UnknownAuthorityError{})
+ }
+}