Certificate.PrivateKey property

[CAPICOM is a 32-bit only component that is available for use in the following operating systems: Windows Server 2008, Windows Vista, and Windows XP. Instead, use the X509Certificate2 Class in the System.Security.Cryptography.X509Certificates namespace.]

The PrivateKey property sets or retrieves the private key associated with the certificate. This property was introduced in CAPICOM 2.0.

This property is read/write.

Syntax

Certificate.PrivateKey As PrivateKey

Property value

A PrivateKey object that represents the private key that is associated with the certificate.

Remarks

Setting the PrivateKey property to Nothing removes the association between the private key and the certificate, but it does not delete the private key. To delete the private key, call the PrivateKey.Delete method, and then set this property to Nothing.

This property raises CAPICOM_E_NOT_ALLOWED when it is set from a web-based application.

Requirements

Requirement Value
End of client support
Windows Vista
End of server support
Windows Server 2008
Redistributable
CAPICOM 2.0 or later on Windows Server 2003 and Windows XP
DLL
Capicom.dll

See also

Certificate