Note

Access to this page requires authorization. You can try signing in or .

Access to this page requires authorization. You can try .

PublicKey Constructors

Definition

Namespace:
System.Security.Cryptography.X509Certificates
Assemblies:
netstandard.dll, System.Security.Cryptography.dll
Assemblies:
netstandard.dll, System.Security.Cryptography.X509Certificates.dll
Assemblies:
netstandard.dll, System.Security.Cryptography.dll, System.Security.Cryptography.X509Certificates.dll
Assembly:
System.Security.Cryptography.X509Certificates.dll
Assembly:
System.dll
Assembly:
netstandard.dll

Important

Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.

Overloads

Name Description
PublicKey(AsymmetricAlgorithm)

Initializes a new instance of the PublicKey class using SubjectPublicKeyInfo from an AsymmetricAlgorithm.

PublicKey(CompositeMLDsa)

Initializes a new instance of the PublicKey class using SubjectPublicKeyInfo from an CompositeMLDsa.

PublicKey(MLDsa)

Initializes a new instance of the PublicKey class using SubjectPublicKeyInfo from an MLDsa.

PublicKey(MLKem)

Initializes a new instance of the PublicKey class using SubjectPublicKeyInfo from an MLKem.

PublicKey(SlhDsa)

Initializes a new instance of the PublicKey class using SubjectPublicKeyInfo from an SlhDsa.

PublicKey(Oid, AsnEncodedData, AsnEncodedData)

Initializes a new instance of the PublicKey class using an object identifier (OID) object of the public key, an ASN.1-encoded representation of the public key parameters, and an ASN.1-encoded representation of the public key value.

PublicKey(AsymmetricAlgorithm)

Source:
PublicKey.cs
Source:
PublicKey.cs
Source:
PublicKey.cs
Source:
PublicKey.cs
Source:
PublicKey.cs

Initializes a new instance of the PublicKey class using SubjectPublicKeyInfo from an AsymmetricAlgorithm.

public:
 PublicKey(System::Security::Cryptography::AsymmetricAlgorithm ^ key);
public PublicKey(System.Security.Cryptography.AsymmetricAlgorithm key);
new System.Security.Cryptography.X509Certificates.PublicKey : System.Security.Cryptography.AsymmetricAlgorithm -> System.Security.Cryptography.X509Certificates.PublicKey
Public Sub New (key As AsymmetricAlgorithm)

Parameters

key
AsymmetricAlgorithm

An asymmetric algorithm to obtain the SubjectPublicKeyInfo from.

Exceptions

The SubjectPublicKeyInfo could not be decoded. The ExportSubjectPublicKeyInfo() must return a valid ASN.1-DER encoded X.509 SubjectPublicKeyInfo.

ExportSubjectPublicKeyInfo() has not been overridden in a derived class.

Applies to

PublicKey(CompositeMLDsa)

Source:
PublicKey.cs
Source:
PublicKey.cs

Initializes a new instance of the PublicKey class using SubjectPublicKeyInfo from an CompositeMLDsa.

public:
 PublicKey(System::Security::Cryptography::CompositeMLDsa ^ key);
[System.Diagnostics.CodeAnalysis.Experimental("SYSLIB5006")]
public PublicKey(System.Security.Cryptography.CompositeMLDsa key);
[<System.Diagnostics.CodeAnalysis.Experimental("SYSLIB5006")>]
new System.Security.Cryptography.X509Certificates.PublicKey : System.Security.Cryptography.CompositeMLDsa -> System.Security.Cryptography.X509Certificates.PublicKey
Public Sub New (key As CompositeMLDsa)

Parameters

key
CompositeMLDsa

An CompositeMLDsa key to obtain the SubjectPublicKeyInfo from.

Attributes

Exceptions

The SubjectPublicKeyInfo could not be decoded. The ExportSubjectPublicKeyInfo() must return a valid ASN.1-DER encoded X.509 SubjectPublicKeyInfo.

Applies to

PublicKey(MLDsa)

Source:
PublicKey.cs
Source:
PublicKey.cs

Initializes a new instance of the PublicKey class using SubjectPublicKeyInfo from an MLDsa.

public:
 PublicKey(System::Security::Cryptography::MLDsa ^ key);
[System.Diagnostics.CodeAnalysis.Experimental("SYSLIB5006")]
public PublicKey(System.Security.Cryptography.MLDsa key);
public PublicKey(System.Security.Cryptography.MLDsa key);
[<System.Diagnostics.CodeAnalysis.Experimental("SYSLIB5006")>]
new System.Security.Cryptography.X509Certificates.PublicKey : System.Security.Cryptography.MLDsa -> System.Security.Cryptography.X509Certificates.PublicKey
new System.Security.Cryptography.X509Certificates.PublicKey : System.Security.Cryptography.MLDsa -> System.Security.Cryptography.X509Certificates.PublicKey
Public Sub New (key As MLDsa)

Parameters

key
MLDsa

An MLDsa key to obtain the SubjectPublicKeyInfo from.

Attributes

Exceptions

The SubjectPublicKeyInfo could not be decoded. The ExportSubjectPublicKeyInfo() must return a valid ASN.1-DER encoded X.509 SubjectPublicKeyInfo.

Applies to

PublicKey(MLKem)

Source:
PublicKey.cs
Source:
PublicKey.cs

Initializes a new instance of the PublicKey class using SubjectPublicKeyInfo from an MLKem.

public:
 PublicKey(System::Security::Cryptography::MLKem ^ key);
[System.Diagnostics.CodeAnalysis.Experimental("SYSLIB5006", UrlFormat="https://aka.ms/dotnet-warnings/{0}")]
public PublicKey(System.Security.Cryptography.MLKem key);
public PublicKey(System.Security.Cryptography.MLKem key);
[<System.Diagnostics.CodeAnalysis.Experimental("SYSLIB5006", UrlFormat="https://aka.ms/dotnet-warnings/{0}")>]
new System.Security.Cryptography.X509Certificates.PublicKey : System.Security.Cryptography.MLKem -> System.Security.Cryptography.X509Certificates.PublicKey
new System.Security.Cryptography.X509Certificates.PublicKey : System.Security.Cryptography.MLKem -> System.Security.Cryptography.X509Certificates.PublicKey
Public Sub New (key As MLKem)

Parameters

key
MLKem

An MLKem key to obtain the SubjectPublicKeyInfo from.

Attributes

Exceptions

The SubjectPublicKeyInfo could not be decoded. The ExportSubjectPublicKeyInfo() must return a valid ASN.1-DER encoded X.509 SubjectPublicKeyInfo.

Applies to

PublicKey(SlhDsa)

Source:
PublicKey.cs
Source:
PublicKey.cs

Initializes a new instance of the PublicKey class using SubjectPublicKeyInfo from an SlhDsa.

public:
 PublicKey(System::Security::Cryptography::SlhDsa ^ key);
[System.Diagnostics.CodeAnalysis.Experimental("SYSLIB5006", UrlFormat="https://aka.ms/dotnet-warnings/{0}")]
public PublicKey(System.Security.Cryptography.SlhDsa key);
[<System.Diagnostics.CodeAnalysis.Experimental("SYSLIB5006", UrlFormat="https://aka.ms/dotnet-warnings/{0}")>]
new System.Security.Cryptography.X509Certificates.PublicKey : System.Security.Cryptography.SlhDsa -> System.Security.Cryptography.X509Certificates.PublicKey
Public Sub New (key As SlhDsa)

Parameters

key
SlhDsa

An SlhDsa key to obtain the SubjectPublicKeyInfo from.

Attributes

Exceptions

The SubjectPublicKeyInfo could not be decoded. The ExportSubjectPublicKeyInfo() must return a valid ASN.1-DER encoded X.509 SubjectPublicKeyInfo.

Applies to

PublicKey(Oid, AsnEncodedData, AsnEncodedData)

Source:
PublicKey.cs
Source:
PublicKey.cs
Source:
PublicKey.cs
Source:
PublicKey.cs
Source:
PublicKey.cs

Initializes a new instance of the PublicKey class using an object identifier (OID) object of the public key, an ASN.1-encoded representation of the public key parameters, and an ASN.1-encoded representation of the public key value.

public:
 PublicKey(System::Security::Cryptography::Oid ^ oid, System::Security::Cryptography::AsnEncodedData ^ parameters, System::Security::Cryptography::AsnEncodedData ^ keyValue);
public PublicKey(System.Security.Cryptography.Oid oid, System.Security.Cryptography.AsnEncodedData? parameters, System.Security.Cryptography.AsnEncodedData keyValue);
public PublicKey(System.Security.Cryptography.Oid oid, System.Security.Cryptography.AsnEncodedData parameters, System.Security.Cryptography.AsnEncodedData keyValue);
new System.Security.Cryptography.X509Certificates.PublicKey : System.Security.Cryptography.Oid * System.Security.Cryptography.AsnEncodedData * System.Security.Cryptography.AsnEncodedData -> System.Security.Cryptography.X509Certificates.PublicKey
Public Sub New (oid As Oid, parameters As AsnEncodedData, keyValue As AsnEncodedData)

Parameters

oid
Oid

An object identifier (OID) object that represents the public key.

parameters
AsnEncodedData

An ASN.1-encoded representation of the public key parameters.

keyValue
AsnEncodedData

An ASN.1-encoded representation of the public key value.

Applies to


Feedback

Was this page helpful?