Closed lilyball closed 3 years ago
For that matter, many existing types don't expose their parsers. For example, GeneralName
has no from_der()
method, instead being parsed by a private parse_generalname()
function. This makes it very hard for me to add missing extensions like Issuer Alternative Name, even though its value type is identical to the supported SubjectAlternativeName
.
Speaking of SubjectAlternativeName
, it would ideally be defined in terms of a public GeneralNames
type, which contains Vec<GeneralName>
and exposes a from_der()
. This is because giving the SubjectAlternativeName
type itself a from_der()
method seems odd as it's not meant to be a reusable type but rather just a typed wrapper for a specific extension's payload, which means it should itself be defined in terms of a standard type.
I'm trying to add parsing of more extensions myself. Right now I'm adding Subject Directory Attributes since this crate seems to have just forgotten about that entirely, though I need to add custom extensions too. Subject Directory Attributes is defined as
This crate exposes
AttributeTypeAndValue
, which parses a sequence of a single type and value, but it doesn't haveAttribute
, and it doesn't expose its internalparse_attribute_value()
(or the interesting part of that, which is the fallback alternative parserparse_malformed_string()
).This is annoying as I don't want to have to replicate things like
parse_malformed_string()
, but I want to match the behavior of this crate's existing parsers.Ideally, every type definition in Appendix A of RFC 5280 would have some publicly-exposed parser in this crate, so I could use it to parse extensions that this crate doesn't itself support.