-
Notifications
You must be signed in to change notification settings - Fork 18.5k
Closed
Labels
Milestone
Description
I'm trying to extract an otherName from the subjectAltName of a certificate. Currently the code looks like this
if ext.Id.Equal(subjectAltName) {
var altName asn1.RawValue
asn1.Unmarshal(ext.Value, &altName)
if altName.Class == 0 && altName.Tag == 16 {
data := altName.Bytes
for len(data) > 0 {
var alt asn1.RawValue
data, _ = asn1.Unmarshal(data, &alt)
if alt.Class == 2 {
switch (alt.Tag) {
case 0:
...
}
}
}
}
}
As you can see there's a lot of magic numbers there. Almost all of those are defined constants in asn1/common.go, but they're set to private, so I can't use them. I don't think they should be private since they're well defined ASN.1 constants.