Feature/x509 general name#38
Conversation
| /** | ||
| * RFC 5280 `Name`. The currently defined CHOICE has exactly one alternative, an `RDNSequence`. | ||
| */ | ||
| typealias X500Name = List<X500RelativeDistinguishedName> |
There was a problem hiding this comment.
I would vaguely prefer value class, though understand that that might cause more boilerplate than it's worth. I dislike this idea of pretending that a generic container is a "class" and then defining extensions on it, because they will then show up on any generic container that happens to match this "class", even though it's semantically not the same.
There was a problem hiding this comment.
I actually had it as a value class, but reverted. Going back to that is fine for me
| ObjectIdentifier.decodeFromAsn1ContentBytes(it.children.first().asPrimitive().content) | ||
| Asn1.Sequence { it.children.forEach { child -> +child } } | ||
| } | ||
| /**Will be parsed leniently*/ |
There was a problem hiding this comment.
what does this actually mean? the comment doesn't tell me a lot.
There was a problem hiding this comment.
elaborated on all such kdoc comments
| /** | ||
| * Convenience constructor | ||
| */ |
There was a problem hiding this comment.
is this meant to be public (when the primary constructor is private?) on that note, why is the primary constructor private, are we objecting to construction from list of asn1element?
There was a problem hiding this comment.
mishap. primary ctor should be public
There was a problem hiding this comment.
went through all and adapted
| value class Directory private constructor( | ||
| val taggedValue: ExplicitlyTagged<X500Name>, | ||
| ) : X509GeneralName { | ||
| val value: X500Name get() = taggedValue.value //Value classes cannot have delegated props |
There was a problem hiding this comment.
what is the comment telling me? why it's not lazy?
There was a problem hiding this comment.
previsely because of that, it is not lazy. lazy is a delegate, and value classes cannot have that
There was a problem hiding this comment.
i don't think it needs justification (honestly, i think the getter is far cleaner here anyway), but if you want to keep the comment (i'd remove it) then actually spell that out (// not lazy, value classes cannot have delegated props)
There was a problem hiding this comment.
yup, it is better like this anyhow
| /** | ||
| * convenience constructor | ||
| */ | ||
| constructor(value: Asn1Sequence) : this(value.children) |
There was a problem hiding this comment.
same here about the private primary ctor; maybe review in general which of these ctors are public vs private?
There was a problem hiding this comment.
same mishap. i thought a caught all of them, but i'll re-visit
| runWrappingAs(a = ::Asn1Exception) { find(ObjectIdentifier("2.5.29.18"), der)?.let(::X509GeneralNames) } | ||
|
|
||
| private fun List<X509CertificateExtension>.find(oid: ObjectIdentifier): List<Asn1Element>? { | ||
| private fun List<X509CertificateExtension>.find(oid: ObjectIdentifier, der: Der): List<X509GeneralName>? { |
There was a problem hiding this comment.
would prefer if this was called findSingle
…9GeneralNames.kt Co-authored-by: Jakob Heher <jakob.heher@iaik.tugraz.at>
X509GeneralNamehierarchy covering every RFC 5280GeneralNamealternative.otherNameextensible through OID-based open polymorphism. Unknown OIDs use a structural fallback by default, while applications can register semantic subtypes on a customDerinstance or through the startup-onlyDefaultDerregistry.Asn1OpenPolymorphicWithDefaultSerializer, allowing extensible models to provide a structural serializer that is automatically replaced by contextual open-polymorphism registrations when available.catchAllregistration.OtherName, including default-DERstartup registration with test-backed source snippets.