PublicKey Class

 
System_CAPS_noteNote

The .NET API Reference documentation has a new home. Visit the .NET API Browser on docs.microsoft.com to see the new experience.

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

Namespace:   System.Security.Cryptography.X509Certificates
Assembly:  System (in System.dll)

System.Object
  System.Security.Cryptography.X509Certificates.PublicKey

[<Sealed>]
type PublicKey = class end

NameDescription
System_CAPS_pubmethodPublicKey(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.

NameDescription
System_CAPS_pubpropertyEncodedKeyValue

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

System_CAPS_pubpropertyEncodedParameters

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

System_CAPS_pubpropertyKey

Gets an RSACryptoServiceProvider or DSACryptoServiceProvider object representing the public key.

System_CAPS_pubpropertyOid

Gets an object identifier (OID) object of the public key.

NameDescription
System_CAPS_pubmethodEquals(Object)

Determines whether the specified object is equal to the current object.(Inherited from Object.)

System_CAPS_pubmethodGetHashCode()

Serves as the default hash function. (Inherited from Object.)

System_CAPS_pubmethodGetType()

Gets the Type of the current instance.(Inherited from Object.)

System_CAPS_pubmethodToString()

Returns a string that represents the current object.(Inherited from Object.)

The PublicKey object contains the object identifier (Oid) representing the public key algorithm, the ASN-encoded parameters, and the ASN.1-encoded key value.

The following example demonstrates how to use the public key from a X509Certificate2 object to encrypt a file. It also shows how to decrypt the encrypted file using the private key for that certificate.

No code example is currently available or this language may not be supported.

The following example creates a command-line executable that takes a certificate file as an argument and prints various certificate properties to the console.

No code example is currently available or this language may not be supported.

.NET Framework
Available since 2.0

Any public static ( Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

Return to top
Show: