// given certificate. If no such certificate can be found or the signature
// doesn't match, it returns nil.
func (s *CertPool) findVerifiedParents(cert *Certificate) (parents []int) {
+ if s == nil {
+ return
+ }
var candidates []int
if len(cert.AuthorityKeyId) > 0 {
roots []string
currentTime int64
dnsName string
+ nilRoots bool
errorCallback func(*testing.T, int, error) bool
expectedChains [][]string
errorCallback: expectHostnameError,
},
+ {
+ leaf: googleLeaf,
+ intermediates: []string{thawteIntermediate},
+ nilRoots: true, // verifies that we don't crash
+ currentTime: 1302726541,
+ dnsName: "www.google.com",
+ errorCallback: expectAuthorityUnknown,
+ },
{
leaf: googleLeaf,
intermediates: []string{thawteIntermediate},
DNSName: test.dnsName,
CurrentTime: time.Unix(test.currentTime, 0),
}
+ if test.nilRoots {
+ opts.Roots = nil
+ }
for j, root := range test.roots {
ok := opts.Roots.AppendCertsFromPEM([]byte(root))