X509Certificate2.HasPrivateKey Property

 

Gets a value that indicates whether an X509Certificate2 object contains a private key.

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

public bool HasPrivateKey { get; }

Property Value

Type: System.Boolean

true if the X509Certificate2 object contains a private key; otherwise, false.

Exception Condition
CryptographicException

The certificate context is invalid.

.NET Framework
Available since 2.0
Return to top
Show: