I used default X509Extension:
certificateRequest.CertificateExtensions.Add(new X509Extension(new Oid("2.5.29.35"), issuer.GetPublicKey(), false));
But when i decode it, this extension is broken and has a strange order of random symbols. In .NET 7 i have a class X509AuthorityKeyIdentifierExtension, but i need do the same on .NET Framework 4.8. How i can do it?
There is no built-in way to do this in legacy .NET Framework without using 3rd party libraries.
For instance, I have my own PKI extension library for .NET Framework that contains classes for most common certificate extensions. Here is an example of
X509AuthorityKeyIdentifierExtensionclass: https://github.com/PKISolutions/pkix.net/blob/master/PKI/Cryptography/X509Certificates/X509AuthorityKeyIdentifierExtension.csAnd the usage could be:
p.s. I'm the author of pkix.net library.