12345678910111213141516171819202122232425module juptune.data.x509.asn1convert;
Result x509HandleExtension(
Extension asn1Extension,
SumType!(
X509Extension.Unknown,
X509Extension.AuthorityKeyIdentifier,
X509Extension.SubjectKeyIdentifier,
X509Extension.KeyUsage,
PolicyMappings,
X509Extension.SubjectAltName,
X509Extension.IssuerAltName,
SubjectDirectoryAttributes,
X509Extension.BasicConstraints,
X509Extension.NameConstraints,
X509Extension.PolicyConstraints,
X509Extension.ExtendedKeyUsage,
X509Extension.CrlDistributionPoints,
X509Extension.InhibitAnyPolicy,
X509Extension.FreshestCrl,
AuthorityInfoAccessSyntax,
SubjectInfoAccessSyntax,
CertificatePolicies
) extension
);
Attempts to identify the given extension; flatten it into an easier to work with type, and perform some light validation.
(Phobos' SumType really sucks so please be aware that X509Extension.SumTis a highly unstable part of the API).
A lot of extensions have additional validation requirements that can't be performed by this function due to a lack of context. This function can only perform validation where the extension is viewed in isolation from any other extension.
X509Error.keyUsageTooManyBitsif a Key Usage extension has more bits than expected.
X509Error.keyUsageNoSetBitif a Key Usage extension has no set bits.
X509Error.extendedKeyUsageUnknownUsageif an Extended Key Usage extension specifies an unknown usage.
Various errors from Asn1DecodeError- mainly around trying to convert Asn1Integer into a native ulong.
An errorful Resultif something went wrong.