Search code examples
c#.net-corex509certificate.net-5

What structure X509Certificate2.Handle points to in Linux?


I know, that for Windows X509Certificate2 uses Crypt32, and X509Certificate2.Handle points to CERT_CONTEXT structure.

On the other hand in Linux X509Certificate2 uses Open SSL under the hood. So, what structure X509Certificate2.Handle points to in this case?

Is it the same CERT_CONTEXT or something else?


Solution

  • It's an OpenSSL X509* value.

    On all platforms it represents "a pointer that the system cryptographic library produced that represents an X.509 public key certificate". So Windows it's a PCERT_CONTEXT, macOS it's a SecCertificateRef, and Linux it's an X509*.

    On all platforms, you really should have a very good reason before you use the Handle value.