Show / Hide Table of Contents

Class PrivateKey

Inheritance
Object
PrivateKey
RSAPrivateKey
Inherited Members
Object.ToString()
Object.Equals(Object)
Object.Equals(Object, Object)
Object.ReferenceEquals(Object, Object)
Object.GetHashCode()
Object.GetType()
Object.MemberwiseClone()
Namespace: Lacuna.Pki
Assembly: Lacuna.Pki.dll
Syntax
public abstract class PrivateKey : IPrivateKey

Properties

Algorithm

Declaration
public abstract PKAlgorithm Algorithm { get; }
Property Value
Type Description
PKAlgorithm

Methods

Decode(Byte[])

Decodes private key from ASN1 DER content or PEM file content

Declaration
public static PrivateKey Decode(byte[] content)
Parameters
Type Name Description
Byte[] content
Returns
Type Description
PrivateKey

Decode(Byte[], String)

Decodes encrypted private key from ASN1 DER content or PEM file content

Declaration
public static PrivateKey Decode(byte[] content, string password)
Parameters
Type Name Description
Byte[] content
String password
Returns
Type Description
PrivateKey

Decode(String)

Decodes private key from PEM string or ASN1 DER base64 string

Declaration
public static PrivateKey Decode(string pem)
Parameters
Type Name Description
String pem
Returns
Type Description
PrivateKey

Decode(String, String)

Decodes encrypted private key from PEM string or ASN1 DER base64 string

Declaration
public static PrivateKey Decode(string pem, string password)
Parameters
Type Name Description
String pem
String password
Returns
Type Description
PrivateKey

Export()

Returns the DER-encoded (unencrypted) private key (PKCS #8)

Declaration
public byte[] Export()
Returns
Type Description
Byte[]
Remarks

Not all private keys are exportable. For such keys, an exception will be thrown.

ExportPem()

Returns the PEM-encoded (unencrypted) private key (PKCS #8)

Declaration
public string ExportPem()
Returns
Type Description
String
Remarks

Not all private keys are exportable. For such keys, an exception will be thrown.

GetEncryptionCsp()

Declaration
public abstract IEncryptionCsp GetEncryptionCsp()
Returns
Type Description
IEncryptionCsp
Implements
IPrivateKey.GetEncryptionCsp()

GetInstance(AsymmetricAlgorithm)

Declaration
public static PrivateKey GetInstance(AsymmetricAlgorithm underlyingPrivateKey)
Parameters
Type Name Description
AsymmetricAlgorithm underlyingPrivateKey
Returns
Type Description
PrivateKey

GetInstance(X509Certificate2)

Declaration
public static IPrivateKey GetInstance(X509Certificate2 x509Certificate)
Parameters
Type Name Description
X509Certificate2 x509Certificate
Returns
Type Description
IPrivateKey

GetSignatureCsp(DigestAlgorithm)

Declaration
public abstract ISignatureCsp GetSignatureCsp(DigestAlgorithm digestAlgorithm)
Parameters
Type Name Description
DigestAlgorithm digestAlgorithm
Returns
Type Description
ISignatureCsp
Implements
IPrivateKey.GetSignatureCsp(DigestAlgorithm)
Back to top Copyright © 2015-2020 Lacuna Software