Early Preview

This is currently very much a preview. Please feel free to try things out, but don't be upset if anything is not yet working. Feedback is welcome over on our GitHub Dicussions page.

class System.​Security.​Cryptography.​X509Certificates.​PublicKey

Assembly: System.Security.Cryptography

Inheritance: object → PublicKey

Represents a certificate's public key information. This class cannot be inherited.

Properties

EncodedKeyValue
Gets the ASN.1-encoded representation of the public key value.
EncodedParameters
Gets the ASN.1-encoded representation of the public key parameters.
Key
Gets an <see cref="T:System.Security.Cryptography.RSA" /> derived object or a <see cref="T:System.Security.Cryptography.DSA" /> derived object representing the public key.
public Oid
Oid
Gets an object identifier (OID) object of the public key.

Methods

public byte[]
ExportSubjectPublicKeyInfo​()
Returns A byte array containing the X.509 SubjectPublicKeyInfo representation of this key.
Exports the current key in the X.509 SubjectPublicKeyInfo format.
GetCompositeMLDsaPublicKey​()
Returns The public key, or <see langword="null" /> if the key is not a Composite ML-DSA key.
<para>Gets the <see cref="T:System.Security.Cryptography.CompositeMLDsa" /> public key, or <see langword="null" /> if the key is not a Composite ML-DSA key.</para>
public DSA
GetDSAPublicKey​()
Returns The public key, or <see langword="null" /> if the key is not an DSA key.
Gets the <see cref="T:System.Security.Cryptography.DSA" /> public key, or <see langword="null" /> if the key is not an DSA key.
GetECDiffieHellmanPublicKey​()
Returns The public key, or <see langword="null" /> if the key is not an ECDiffieHellman key.
Gets the <see cref="T:System.Security.Cryptography.ECDiffieHellman" /> public key, or <see langword="null" /> if the key is not an ECDiffieHellman key.
public ECDsa
GetECDsaPublicKey​()
Returns The public key, or <see langword="null" /> if the key is not an ECDsa key.
Gets the <see cref="T:System.Security.Cryptography.ECDsa" /> public key, or <see langword="null" /> if the key is not an ECDsa key.
public MLDsa
GetMLDsaPublicKey​()
Returns The public key, or <see langword="null" /> if the key is not an ML-DSA key.
<para>Gets the <see cref="T:System.Security.Cryptography.MLDsa" /> public key, or <see langword="null" /> if the key is not an ML-DSA key.</para>
public MLKem
GetMLKemPublicKey​()
Returns The public key, or <see langword="null" /> if the key is not an ML-KEM key.
<para>Gets the <see cref="T:System.Security.Cryptography.MLKem" /> public key, or <see langword="null" /> if the key is not an ML-KEM key.</para>
public RSA
GetRSAPublicKey​()
Returns The public key, or <see langword="null" /> if the key is not an RSA key.
Gets the <see cref="T:System.Security.Cryptography.RSA" /> public key, or <see langword="null" /> if the key is not an RSA key.
public SlhDsa
GetSlhDsaPublicKey​()
Returns The public key, or <see langword="null" /> if the key is not an SLH-DSA key.
<para>Gets the <see cref="T:System.Security.Cryptography.SlhDsa" /> public key, or <see langword="null" /> if the key is not an SLH-DSA key.</para>
public bool
TryExportSubjectPublicKeyInfo​(Span`1 destination, Int32& bytesWritten)
public bool
Equals​(object obj)
Inherited from object
protected void
Finalize​()
Inherited from object
public int
GetHashCode​()
Inherited from object
public Type
GetType​()
Inherited from object
protected object
MemberwiseClone​()
Inherited from object
public string
ToString​()
Inherited from object