forked from TrueCloudLab/certificates
Verify with roots and intermediates
This commit is contained in:
parent
30c54a555d
commit
a7fcfe0e4e
1 changed files with 8 additions and 5 deletions
|
@ -489,12 +489,15 @@ func TestSoftCAS_CreateCertificate_ec_rsa(t *testing.T) {
|
||||||
t.Errorf("Certificate.SignatureAlgorithm = %v, want %v", iss.SignatureAlgorithm, x509.SHA256WithRSAPSS)
|
t.Errorf("Certificate.SignatureAlgorithm = %v, want %v", iss.SignatureAlgorithm, x509.SHA256WithRSAPSS)
|
||||||
}
|
}
|
||||||
|
|
||||||
pool := x509.NewCertPool()
|
roots := x509.NewCertPool()
|
||||||
pool.AddCert(iss)
|
roots.AddCert(root)
|
||||||
|
intermediates := x509.NewCertPool()
|
||||||
|
intermediates.AddCert(iss)
|
||||||
if _, err = cert.Certificate.Verify(x509.VerifyOptions{
|
if _, err = cert.Certificate.Verify(x509.VerifyOptions{
|
||||||
CurrentTime: time.Now(),
|
CurrentTime: time.Now(),
|
||||||
Roots: pool,
|
Roots: roots,
|
||||||
KeyUsages: []x509.ExtKeyUsage{x509.ExtKeyUsageClientAuth, x509.ExtKeyUsageServerAuth},
|
Intermediates: intermediates,
|
||||||
|
KeyUsages: []x509.ExtKeyUsage{x509.ExtKeyUsageClientAuth, x509.ExtKeyUsageServerAuth},
|
||||||
}); err != nil {
|
}); err != nil {
|
||||||
t.Errorf("Certificate.Verify() error = %v", err)
|
t.Errorf("Certificate.Verify() error = %v", err)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue