func()

in calnex/cert/cert.go [172:205]


func (b *Bundle) Verify(hostname string, t time.Time) error {
	if b == nil {
		return ErrBundleNil
	}

	if b.PrivKey == nil {
		return ErrBundleNoPrivKey
	}

	if len(b.Certs) == 0 {
		return ErrBundleNoCerts
	}

	// Confirm one of the certs is for our hostname
	var hostCert *x509.Certificate
	for _, cert := range b.Certs {
		err := cert.VerifyHostname(hostname)
		if err == nil {
			hostCert = cert
		}
	}
	if hostCert == nil {
		return ErrBundleNoCertForHost
	}

	if hostCert.NotBefore.After(t) {
		return ErrCertNotYetValid
	}
	if hostCert.NotAfter.Before(t) {
		return ErrCertExpired
	}

	return nil
}