<PackageReference Include="BouncyCastle.Cryptography" Version="2.6.2" />

PgpSecretKey

public class PgpSecretKey : PgpObject
public bool IsMasterKey { get; }

True, if this is a master key.

public bool IsPrivateKeyEmpty { get; }

Detect if the Secret Key's Private Key is empty or not

public bool IsSigningKey { get; }

Check if this key has an algorithm type that makes it suitable to use for signing.

The algorithm the key is encrypted with.

public long KeyId { get; }

The key ID of the public key associated with this key.

public PgpPublicKey PublicKey { get; }

The public key associated with this key.

public S2k S2k { get; }

Return the S2K used to process this key.

public int S2kUsage { get; }

Return the S2K usage associated with this key.

Allows enumeration of any user attribute vectors associated with the key.

public IEnumerable<string> UserIds { get; }

Allows enumeration of any user IDs associated with the key.

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

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

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

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

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

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

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

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)

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

Return a copy of the passed in secret key, encrypted using a new password and the passed in algorithm.

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

Return a copy of the passed in secret key, encrypted using a new password and the passed in algorithm.

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

Return a copy of the passed in secret key, encrypted using a new password and the passed in algorithm.

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

Parse a secret key from one of the GPG S expression keys associating it with the passed in public key.

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

Parse a secret key from one of the GPG S expression keys.

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

Parse a secret key from one of the GPG S expression keys associating it with the passed in public key.

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

Parse a secret key from one of the GPG S expression keys.

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

Parse a secret key from one of the GPG S expression keys associating it with the passed in public key.

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

Parse a secret key from one of the GPG S expression keys.

public static PgpSecretKey ReplacePublicKey(PgpSecretKey secretKey, PgpPublicKey publicKey)

Replace the passed the public key on the passed in secret key.

public void Encode(Stream outStr)

public PgpPrivateKey ExtractPrivateKey(char[] passPhrase)

Extract a PgpPrivateKey from this secret key's encrypted contents.

public PgpPrivateKey ExtractPrivateKeyRaw(byte[] rawPassPhrase)

Extract a PgpPrivateKey from this secret key's encrypted contents.

public PgpPrivateKey ExtractPrivateKeyUtf8(char[] passPhrase)

Extract a PgpPrivateKey from this secret key's encrypted contents.

public byte[] GetEncoded()

public byte[] GetFingerprint()

The fingerprint of the public key associated with this key.