Table of Contents

Class PgpSecretKey

Namespace
Enterprises.Org.BouncyCastle.Bcpg.OpenPgp
Assembly
Enterprises.BouncyCastle.Crypto.dll
public class PgpSecretKey
Inheritance
PgpSecretKey
Inherited Members

Constructors

PgpSecretKey(int, PgpKeyPair, string, SymmetricKeyAlgorithmTag, HashAlgorithmTag, bool, char[], bool, PgpSignatureSubpacketVector, PgpSignatureSubpacketVector, SecureRandom)

public PgpSecretKey(int certificationLevel, PgpKeyPair keyPair, string id, SymmetricKeyAlgorithmTag encAlgorithm, HashAlgorithmTag hashAlgorithm, bool utf8PassPhrase, char[] passPhrase, bool useSha1, PgpSignatureSubpacketVector hashedPackets, PgpSignatureSubpacketVector unhashedPackets, SecureRandom rand)

Parameters

certificationLevel int
keyPair PgpKeyPair
id string
encAlgorithm SymmetricKeyAlgorithmTag
hashAlgorithm HashAlgorithmTag
utf8PassPhrase bool
passPhrase char[]
useSha1 bool
hashedPackets PgpSignatureSubpacketVector
unhashedPackets PgpSignatureSubpacketVector
rand SecureRandom

PgpSecretKey(int, PgpKeyPair, string, SymmetricKeyAlgorithmTag, HashAlgorithmTag, byte[], bool, PgpSignatureSubpacketVector, PgpSignatureSubpacketVector, SecureRandom)

public PgpSecretKey(int certificationLevel, PgpKeyPair keyPair, string id, SymmetricKeyAlgorithmTag encAlgorithm, HashAlgorithmTag hashAlgorithm, byte[] rawPassPhrase, bool useSha1, PgpSignatureSubpacketVector hashedPackets, PgpSignatureSubpacketVector unhashedPackets, SecureRandom rand)

Parameters

certificationLevel int
keyPair PgpKeyPair
id string
encAlgorithm SymmetricKeyAlgorithmTag
hashAlgorithm HashAlgorithmTag
rawPassPhrase byte[]
useSha1 bool
hashedPackets PgpSignatureSubpacketVector
unhashedPackets PgpSignatureSubpacketVector
rand SecureRandom

PgpSecretKey(int, PgpKeyPair, string, SymmetricKeyAlgorithmTag, HashAlgorithmTag, char[], bool, PgpSignatureSubpacketVector, PgpSignatureSubpacketVector, SecureRandom)

public PgpSecretKey(int certificationLevel, PgpKeyPair keyPair, string id, SymmetricKeyAlgorithmTag encAlgorithm, HashAlgorithmTag hashAlgorithm, char[] passPhrase, bool useSha1, PgpSignatureSubpacketVector hashedPackets, PgpSignatureSubpacketVector unhashedPackets, SecureRandom rand)

Parameters

certificationLevel int
keyPair PgpKeyPair
id string
encAlgorithm SymmetricKeyAlgorithmTag
hashAlgorithm HashAlgorithmTag
passPhrase char[]
useSha1 bool
hashedPackets PgpSignatureSubpacketVector
unhashedPackets PgpSignatureSubpacketVector
rand SecureRandom

PgpSecretKey(int, PgpKeyPair, string, SymmetricKeyAlgorithmTag, bool, char[], bool, PgpSignatureSubpacketVector, PgpSignatureSubpacketVector, SecureRandom)

public PgpSecretKey(int certificationLevel, PgpKeyPair keyPair, string id, SymmetricKeyAlgorithmTag encAlgorithm, bool utf8PassPhrase, char[] passPhrase, bool useSha1, PgpSignatureSubpacketVector hashedPackets, PgpSignatureSubpacketVector unhashedPackets, SecureRandom rand)

Parameters

certificationLevel int
keyPair PgpKeyPair
id string
encAlgorithm SymmetricKeyAlgorithmTag
utf8PassPhrase bool
passPhrase char[]
useSha1 bool
hashedPackets PgpSignatureSubpacketVector
unhashedPackets PgpSignatureSubpacketVector
rand SecureRandom

PgpSecretKey(int, PgpKeyPair, string, SymmetricKeyAlgorithmTag, byte[], bool, PgpSignatureSubpacketVector, PgpSignatureSubpacketVector, SecureRandom)

public PgpSecretKey(int certificationLevel, PgpKeyPair keyPair, string id, SymmetricKeyAlgorithmTag encAlgorithm, byte[] rawPassPhrase, bool useSha1, PgpSignatureSubpacketVector hashedPackets, PgpSignatureSubpacketVector unhashedPackets, SecureRandom rand)

Parameters

certificationLevel int
keyPair PgpKeyPair
id string
encAlgorithm SymmetricKeyAlgorithmTag
rawPassPhrase byte[]
useSha1 bool
hashedPackets PgpSignatureSubpacketVector
unhashedPackets PgpSignatureSubpacketVector
rand SecureRandom

PgpSecretKey(int, PgpKeyPair, string, SymmetricKeyAlgorithmTag, char[], PgpSignatureSubpacketVector, PgpSignatureSubpacketVector, SecureRandom)

[Obsolete("Use the constructor taking an explicit 'useSha1' parameter instead")]
public PgpSecretKey(int certificationLevel, PgpKeyPair keyPair, string id, SymmetricKeyAlgorithmTag encAlgorithm, char[] passPhrase, PgpSignatureSubpacketVector hashedPackets, PgpSignatureSubpacketVector unhashedPackets, SecureRandom rand)

Parameters

certificationLevel int
keyPair PgpKeyPair
id string
encAlgorithm SymmetricKeyAlgorithmTag
passPhrase char[]
hashedPackets PgpSignatureSubpacketVector
unhashedPackets PgpSignatureSubpacketVector
rand SecureRandom

PgpSecretKey(int, PgpKeyPair, string, SymmetricKeyAlgorithmTag, char[], bool, PgpSignatureSubpacketVector, PgpSignatureSubpacketVector, SecureRandom)

public PgpSecretKey(int certificationLevel, PgpKeyPair keyPair, string id, SymmetricKeyAlgorithmTag encAlgorithm, char[] passPhrase, bool useSha1, PgpSignatureSubpacketVector hashedPackets, PgpSignatureSubpacketVector unhashedPackets, SecureRandom rand)

Parameters

certificationLevel int
keyPair PgpKeyPair
id string
encAlgorithm SymmetricKeyAlgorithmTag
passPhrase char[]
useSha1 bool
hashedPackets PgpSignatureSubpacketVector
unhashedPackets PgpSignatureSubpacketVector
rand SecureRandom

PgpSecretKey(int, PublicKeyAlgorithmTag, AsymmetricKeyParameter, AsymmetricKeyParameter, DateTime, string, SymmetricKeyAlgorithmTag, char[], PgpSignatureSubpacketVector, PgpSignatureSubpacketVector, SecureRandom)

public PgpSecretKey(int certificationLevel, PublicKeyAlgorithmTag algorithm, AsymmetricKeyParameter pubKey, AsymmetricKeyParameter privKey, DateTime time, string id, SymmetricKeyAlgorithmTag encAlgorithm, char[] passPhrase, PgpSignatureSubpacketVector hashedPackets, PgpSignatureSubpacketVector unhashedPackets, SecureRandom rand)

Parameters

certificationLevel int
algorithm PublicKeyAlgorithmTag
pubKey AsymmetricKeyParameter
privKey AsymmetricKeyParameter
time DateTime
id string
encAlgorithm SymmetricKeyAlgorithmTag
passPhrase char[]
hashedPackets PgpSignatureSubpacketVector
unhashedPackets PgpSignatureSubpacketVector
rand SecureRandom

PgpSecretKey(int, PublicKeyAlgorithmTag, AsymmetricKeyParameter, AsymmetricKeyParameter, DateTime, string, SymmetricKeyAlgorithmTag, char[], bool, PgpSignatureSubpacketVector, PgpSignatureSubpacketVector, SecureRandom)

public PgpSecretKey(int certificationLevel, PublicKeyAlgorithmTag algorithm, AsymmetricKeyParameter pubKey, AsymmetricKeyParameter privKey, DateTime time, string id, SymmetricKeyAlgorithmTag encAlgorithm, char[] passPhrase, bool useSha1, PgpSignatureSubpacketVector hashedPackets, PgpSignatureSubpacketVector unhashedPackets, SecureRandom rand)

Parameters

certificationLevel int
algorithm PublicKeyAlgorithmTag
pubKey AsymmetricKeyParameter
privKey AsymmetricKeyParameter
time DateTime
id string
encAlgorithm SymmetricKeyAlgorithmTag
passPhrase char[]
useSha1 bool
hashedPackets PgpSignatureSubpacketVector
unhashedPackets PgpSignatureSubpacketVector
rand SecureRandom

Properties

IsMasterKey

public bool IsMasterKey { get; }

Property Value

bool

IsPrivateKeyEmpty

public bool IsPrivateKeyEmpty { get; }

Property Value

bool

IsSigningKey

public bool IsSigningKey { get; }

Property Value

bool

KeyEncryptionAlgorithm

public SymmetricKeyAlgorithmTag KeyEncryptionAlgorithm { get; }

Property Value

SymmetricKeyAlgorithmTag

KeyId

public long KeyId { get; }

Property Value

long

PublicKey

public PgpPublicKey PublicKey { get; }

Property Value

PgpPublicKey

S2k

public S2k S2k { get; }

Property Value

S2k

S2kUsage

public int S2kUsage { get; }

Property Value

int

UserAttributes

public IEnumerable UserAttributes { get; }

Property Value

IEnumerable

UserIds

public IEnumerable UserIds { get; }

Property Value

IEnumerable

Methods

CopyWithNewPassword(PgpSecretKey, char[], char[], SymmetricKeyAlgorithmTag, SecureRandom)

public static PgpSecretKey CopyWithNewPassword(PgpSecretKey key, char[] oldPassPhrase, char[] newPassPhrase, SymmetricKeyAlgorithmTag newEncAlgorithm, SecureRandom rand)

Parameters

key PgpSecretKey
oldPassPhrase char[]
newPassPhrase char[]
newEncAlgorithm SymmetricKeyAlgorithmTag
rand SecureRandom

Returns

PgpSecretKey

CopyWithNewPasswordRaw(PgpSecretKey, byte[], byte[], SymmetricKeyAlgorithmTag, SecureRandom)

public static PgpSecretKey CopyWithNewPasswordRaw(PgpSecretKey key, byte[] rawOldPassPhrase, byte[] rawNewPassPhrase, SymmetricKeyAlgorithmTag newEncAlgorithm, SecureRandom rand)

Parameters

key PgpSecretKey
rawOldPassPhrase byte[]
rawNewPassPhrase byte[]
newEncAlgorithm SymmetricKeyAlgorithmTag
rand SecureRandom

Returns

PgpSecretKey

CopyWithNewPasswordUtf8(PgpSecretKey, char[], char[], SymmetricKeyAlgorithmTag, SecureRandom)

public static PgpSecretKey CopyWithNewPasswordUtf8(PgpSecretKey key, char[] oldPassPhrase, char[] newPassPhrase, SymmetricKeyAlgorithmTag newEncAlgorithm, SecureRandom rand)

Parameters

key PgpSecretKey
oldPassPhrase char[]
newPassPhrase char[]
newEncAlgorithm SymmetricKeyAlgorithmTag
rand SecureRandom

Returns

PgpSecretKey

Encode(Stream)

public void Encode(Stream outStr)

Parameters

outStr Stream

ExtractPrivateKey(char[])

public PgpPrivateKey ExtractPrivateKey(char[] passPhrase)

Parameters

passPhrase char[]

Returns

PgpPrivateKey

ExtractPrivateKeyRaw(byte[])

public PgpPrivateKey ExtractPrivateKeyRaw(byte[] rawPassPhrase)

Parameters

rawPassPhrase byte[]

Returns

PgpPrivateKey

ExtractPrivateKeyUtf8(char[])

public PgpPrivateKey ExtractPrivateKeyUtf8(char[] passPhrase)

Parameters

passPhrase char[]

Returns

PgpPrivateKey

GetEncoded()

public byte[] GetEncoded()

Returns

byte[]

ParseSecretKeyFromSExpr(Stream, char[])

public static PgpSecretKey ParseSecretKeyFromSExpr(Stream inputStream, char[] passPhrase)

Parameters

inputStream Stream
passPhrase char[]

Returns

PgpSecretKey

ParseSecretKeyFromSExpr(Stream, char[], PgpPublicKey)

public static PgpSecretKey ParseSecretKeyFromSExpr(Stream inputStream, char[] passPhrase, PgpPublicKey pubKey)

Parameters

inputStream Stream
passPhrase char[]
pubKey PgpPublicKey

Returns

PgpSecretKey

ParseSecretKeyFromSExprRaw(Stream, byte[])

public static PgpSecretKey ParseSecretKeyFromSExprRaw(Stream inputStream, byte[] rawPassPhrase)

Parameters

inputStream Stream
rawPassPhrase byte[]

Returns

PgpSecretKey

ParseSecretKeyFromSExprRaw(Stream, byte[], PgpPublicKey)

public static PgpSecretKey ParseSecretKeyFromSExprRaw(Stream inputStream, byte[] rawPassPhrase, PgpPublicKey pubKey)

Parameters

inputStream Stream
rawPassPhrase byte[]
pubKey PgpPublicKey

Returns

PgpSecretKey

ParseSecretKeyFromSExprUtf8(Stream, char[])

public static PgpSecretKey ParseSecretKeyFromSExprUtf8(Stream inputStream, char[] passPhrase)

Parameters

inputStream Stream
passPhrase char[]

Returns

PgpSecretKey

ParseSecretKeyFromSExprUtf8(Stream, char[], PgpPublicKey)

public static PgpSecretKey ParseSecretKeyFromSExprUtf8(Stream inputStream, char[] passPhrase, PgpPublicKey pubKey)

Parameters

inputStream Stream
passPhrase char[]
pubKey PgpPublicKey

Returns

PgpSecretKey

ReplacePublicKey(PgpSecretKey, PgpPublicKey)

public static PgpSecretKey ReplacePublicKey(PgpSecretKey secretKey, PgpPublicKey publicKey)

Parameters

secretKey PgpSecretKey
publicKey PgpPublicKey

Returns

PgpSecretKey