-1

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?

1 Answers1

1

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 X509AuthorityKeyIdentifierExtension class: https://github.com/PKISolutions/pkix.net/blob/master/PKI/Cryptography/X509Certificates/X509AuthorityKeyIdentifierExtension.cs

And the usage could be:

var aki = new X509AuthorityKeyIdentifierExtension(issuer, AuthorityKeyIdentifierFlags.KeyIdentifier, false);
certificateRequest.CertificateExtensions.Add(aki);

p.s. I'm the author of pkix.net library.

Crypt32
  • 12,850
  • 2
  • 41
  • 70