You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
The text was updated successfully, but these errors were encountered:
Considering that asn1.RawValue already exposes them, I'm also in favor of exporting the constants.
If they were public, it might be nice to make them typed constants so they can have methods, but https://golang.org/pkg/encoding/asn1/#RawValue already uses Tag and Class as just int, so I guess typed constants are out.
I'm trying to extract an otherName from the subjectAltName of a certificate. Currently the code looks like this
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.
The text was updated successfully, but these errors were encountered: