apple / swift-certificates

An implementation of X.509 for Swift
https://swiftpackageindex.com/apple/swift-certificates/main/documentation/x509
Apache License 2.0
223 stars 53 forks source link

Support building `DistinguishedName` from RFC 4514 input #200

Open natevw opened 5 days ago

natevw commented 5 days ago

It would be helpful if DistinguishedName (and perhaps its subcomponents?) could support initialization from RFC 4514–formatted strings.

RelativeDistinguishedName.Attribute and its .Value have a rough sort of reverse form of this in https://github.com/apple/swift-certificates/blob/a846fc71499526eeceae5e3b739235ff249d4433/Sources/X509/RDNAttribute.swift#L211-L233 and https://github.com/apple/swift-certificates/blob/a846fc71499526eeceae5e3b739235ff249d4433/Sources/X509/RDNAttribute.swift#L148C46-L150 and this is highlighted in the docs https://github.com/apple/swift-certificates/blob/a846fc71499526eeceae5e3b739235ff249d4433/Sources/X509/Docs.docc/Examining%20Certificates.md?plain=1#L65-L66 as following the standard, but there is currently no parsing/deserialization offered in the other ddirection

Lukasa commented 5 days ago

Yeah, this sounds like a reasonable feature. I'd be happy to see someone take a swing at implementing this.