X509Certificate 2ExtensionsGet Private Key As Asymmetric Key Parameter Method
Get the certificate's private key as a BouncyCastle AsymmetricKeyParameter, if available.
Definition
Namespace: MimeKit.Cryptography
Assembly: MimeKit.Cryptography (in MimeKit.Cryptography.dll) Version: 5.0.0
The asymmetric key parameter for the certificate's private key, if available; otherwise, .
Assembly: MimeKit.Cryptography (in MimeKit.Cryptography.dll) Version: 5.0.0
C#
public static AsymmetricKeyParameter? GetPrivateKeyAsAsymmetricKeyParameter(
this X509Certificate2 certificate
)Parameters
- certificate X509Certificate2
- The X.509 certificate.
Return Value
AsymmetricKeyParameterThe asymmetric key parameter for the certificate's private key, if available; otherwise, .
Usage Note
In Visual Basic and C#, you can call this method as an instance method on any object of type X509Certificate2. When you use instance method syntax to call this method, omit the first parameter. For more information, see Extension Methods (Visual Basic) or Extension Methods (C# Programming Guide).Remarks
Gets the certificate's private key as a BouncyCastle AsymmetricKeyParameter, if available.
Exceptions
| ArgumentNullException | certificate is . |