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
{{ message }}
Repository navigation
proposal: crypto/x509: provide function to convert from x509.OID to asn1.ObjectIdentifier #81363
It would have to return either a bool or an error, since OID supports elements > 31bits, whereas asn1.ObjectIdentifier does not not. I think bool would be enough here, since there is only a single error condition.
Activity
gabyhelp commentedon Sep 4, 2026
Related Issues
(Emoji vote if this was helpful or unhelpful; more detailed feedback welcome in this discussion.)
mateusz834 commentedon Sep 5, 2026
It would have to return either a
boolor anerror, since OID supports elements > 31bits, whereasasn1.ObjectIdentifierdoes not not. I thinkboolwould be enough here, since there is only a single error condition.FiloSottile commentedon Sep 5, 2026
Not necessarily opposed, but where do you need the asn1.ObjectIdentifier? Because ideally we'd instead add support for x509.OID there.
RufusJWB commentedon Sep 5, 2026
encoding/asn1 fails when marshalling a x509.oid. Please see the following repros:
This is especially annoying since OIDs and ASN.1 are closely related with each other.
RufusJWB commentedon Sep 10, 2026
@FiloSottile do you think we could strive to enhance the https://pkg.go.dev/encoding/asn1#Marshal function to support also x509.OIDs?
mateusz834 commentedon Sep 10, 2026
No, since this would cause a circular dep. We could move
OIDtoasn1and makex509.OIDan alias though.FiloSottile commentedon Sep 10, 2026
I mean, we could cheat, like asserting against
and go from there.
It definitely is surprising that encoding/asn1 can't encode crypto/x509.OID.
mateusz834 commentedon Sep 10, 2026
I think we could also cheat by moving OID to an internal package and making crypto.X509 an alias to it.
FiloSottile commentedon Sep 10, 2026
Yeah but that makes the methods move to the internal package's godoc page.
RufusJWB commentedon Sep 24, 2026
how would we proceed with this topic?