Skip to content

Commit

Permalink
limbo: AKI, SAN test cases
Browse files Browse the repository at this point in the history
Signed-off-by: Andrew Pan <a@tny.town>
  • Loading branch information
tnytown committed Jul 6, 2023
1 parent d0c24a7 commit d30d511
Show file tree
Hide file tree
Showing 6 changed files with 442 additions and 45 deletions.
10 changes: 7 additions & 3 deletions harness/gocryptox509/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -105,9 +105,12 @@ func evaluateTestcase(testcase Testcase) error {

switch testcase.ValidationKind {
case validationKindClient:
// TODO: Support testcases that specify the peer's name.
if testcase.ExpectedPeerName != nil {
return fmt.Errorf("peer name checks not supported yet")
var dnsName string
if peerName, ok := testcase.ExpectedPeerName.(PeerName); ok {
if peerName.Kind.(string) != "DNS" {
return fmt.Errorf("non-DNS peer name checks not supported yet")
}
dnsName = peerName.Value
}
roots, intermediates := x509.NewCertPool(), x509.NewCertPool()
roots.AppendCertsFromPEM(concatPEMCerts(testcase.TrustedCerts))
Expand All @@ -126,6 +129,7 @@ func evaluateTestcase(testcase Testcase) error {
}

opts := x509.VerifyOptions{
DNSName: dnsName,
Intermediates: intermediates,
Roots: roots,
CurrentTime: ts,
Expand Down
Loading

0 comments on commit d30d511

Please sign in to comment.