Explorar el Código

Verify with roots and intermediates

Mariano Cano hace 4 años
padre
commit
a7fcfe0e4e
Se han modificado 1 ficheros con 8 adiciones y 5 borrados
  1. 8 5
      cas/softcas/softcas_test.go

+ 8 - 5
cas/softcas/softcas_test.go

@@ -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()
-	pool.AddCert(iss)
+	roots := x509.NewCertPool()
+	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(),
-		Roots:       pool,
-		KeyUsages:   []x509.ExtKeyUsage{x509.ExtKeyUsageClientAuth, x509.ExtKeyUsageServerAuth},
+		CurrentTime:   time.Now(),
+		Roots:         roots,
+		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)
 	}
 	}