Skip to content

Commit

Permalink
scion-pki: show ISD-AS in distinguished name
Browse files Browse the repository at this point in the history
Include the ISD-AS in the output of the distinguished name of the
certificate. Previously, the output would show `UnknownOID=1.3.6.1.4.1.55324.1.2.1`
instead of the ISD-AS.

Furthemore, represent the extended key usage for sensitive voting,
regular voting, and cppki root certificates as a human readable string.
  • Loading branch information
oncilla committed Sep 16, 2024
1 parent 22a3c24 commit 0eabb54
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion scion-pki/certs/certinfo.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,8 @@ import (
"time"

"github.com/pkg/errors"

"github.com/scionproto/scion/pkg/scrypto/cppki"
)

// Time formats used
Expand Down Expand Up @@ -154,6 +156,8 @@ func printName(names []pkix.AttributeTypeAndValue, buf *bytes.Buffer) []string {
values = append(values, fmt.Sprintf("DC=%s", name.Value))
} else if oid.Equal(oidUserID) {
values = append(values, fmt.Sprintf("UID=%s", name.Value))
} else if oid.Equal(cppki.OIDNameIA) {
values = append(values, fmt.Sprintf("ISD-AS=%s", name.Value))
} else {
values = append(values, fmt.Sprintf("UnknownOID=%s", name.Type.String()))
}
Expand Down Expand Up @@ -628,7 +632,16 @@ func certificateText(cert *x509.Certificate) (string, error) {
}
}
for _, oid := range cert.UnknownExtKeyUsage {
list = append(list, oid.String())
switch {
case oid.Equal(cppki.OIDExtKeyUsageSensitive):
list = append(list, "Sensitive Voting")
case oid.Equal(cppki.OIDExtKeyUsageRegular):
list = append(list, "Regular Voting")
case oid.Equal(cppki.OIDExtKeyUsageRoot):
list = append(list, "CPPKI Root")
default:
list = append(list, oid.String())
}
}
if len(list) > 0 {
buf.WriteString(fmt.Sprintf("%16s%s", "", list[0]))
Expand Down

0 comments on commit 0eabb54

Please sign in to comment.