func isAUsableCert()

in pkg/internal/crypto/crypto_windows.go [112:127]


func isAUsableCert(cert *CertContext) (usable bool) {
	// First check if the cert has expired
	ended := time.Unix(0, cert.CertInfo.notAfter.Nanoseconds())
	started := time.Unix(0, cert.CertInfo.notBefore.Nanoseconds())
	now := time.Now()
	if now.After(ended) || now.Before(started) {
		return false
	}

	// Check that it has a private key
	if !hasPrivateKey(cert) {
		return false
	}

	return true
}