<PackageReference Include="Microsoft.Bcl.Cryptography" Version="11.0.0-preview.7.26381.103" />

System.Security.Cryptography.X509Certificates.X509CertificateKeyAccessors

public static class X509CertificateKeyAccessors
Helper methods to access keys on X509Certificate2.
public static X509Certificate2 CopyWithPrivateKey(this X509Certificate2 certificate, MLKem privateKey)

Combines a private key with a certificate containing the associated public key into a new instance that can access the private key.

public static X509Certificate2 CopyWithPrivateKey(this X509Certificate2 certificate, MLDsa privateKey)

Combines a private key with a certificate containing the associated public key into a new instance that can access the private key.

public static X509Certificate2 CopyWithPrivateKey(this X509Certificate2 certificate, SlhDsa privateKey)

Combines a private key with a certificate containing the associated public key into a new instance that can access the private key.

public static X509Certificate2 CopyWithPrivateKey(this X509Certificate2 certificate, CompositeMLDsa privateKey)

Combines a private key with a certificate containing the associated public key into a new instance that can access the private key.

Gets the CompositeMLDsa private key from this certificate.

Gets the CompositeMLDsa public key from this certificate.

public static MLDsa GetMLDsaPrivateKey(this X509Certificate2 certificate)

Gets the MLDsa private key from this certificate.

public static MLDsa GetMLDsaPublicKey(this X509Certificate2 certificate)

Gets the MLDsa public key from this certificate.

public static MLKem GetMLKemPrivateKey(this X509Certificate2 certificate)

Gets the MLKem private key from this certificate.

public static MLKem GetMLKemPublicKey(this X509Certificate2 certificate)

Gets the MLKem public key from this certificate.

public static SlhDsa GetSlhDsaPrivateKey(this X509Certificate2 certificate)

Gets the SlhDsa private key from this certificate.

public static SlhDsa GetSlhDsaPublicKey(this X509Certificate2 certificate)

Gets the SlhDsa public key from this certificate.