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
  
    - certificationLevelint
- keyPairPgpKeyPair
- idstring
- encAlgorithmSymmetricKeyAlgorithmTag
- hashAlgorithmHashAlgorithmTag
- utf8PassPhrasebool
- passPhrasechar[]
- useSha1bool
- hashedPacketsPgpSignatureSubpacketVector
- unhashedPacketsPgpSignatureSubpacketVector
- randSecureRandom
  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
  
    - certificationLevelint
- keyPairPgpKeyPair
- idstring
- encAlgorithmSymmetricKeyAlgorithmTag
- hashAlgorithmHashAlgorithmTag
- rawPassPhrasebyte[]
- useSha1bool
- hashedPacketsPgpSignatureSubpacketVector
- unhashedPacketsPgpSignatureSubpacketVector
- randSecureRandom
  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
  
    - certificationLevelint
- keyPairPgpKeyPair
- idstring
- encAlgorithmSymmetricKeyAlgorithmTag
- hashAlgorithmHashAlgorithmTag
- passPhrasechar[]
- useSha1bool
- hashedPacketsPgpSignatureSubpacketVector
- unhashedPacketsPgpSignatureSubpacketVector
- randSecureRandom
  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
  
    - certificationLevelint
- keyPairPgpKeyPair
- idstring
- encAlgorithmSymmetricKeyAlgorithmTag
- utf8PassPhrasebool
- passPhrasechar[]
- useSha1bool
- hashedPacketsPgpSignatureSubpacketVector
- unhashedPacketsPgpSignatureSubpacketVector
- randSecureRandom
  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
  
    - certificationLevelint
- keyPairPgpKeyPair
- idstring
- encAlgorithmSymmetricKeyAlgorithmTag
- rawPassPhrasebyte[]
- useSha1bool
- hashedPacketsPgpSignatureSubpacketVector
- unhashedPacketsPgpSignatureSubpacketVector
- randSecureRandom
  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
  
    - certificationLevelint
- keyPairPgpKeyPair
- idstring
- encAlgorithmSymmetricKeyAlgorithmTag
- passPhrasechar[]
- hashedPacketsPgpSignatureSubpacketVector
- unhashedPacketsPgpSignatureSubpacketVector
- randSecureRandom
  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
  
    - certificationLevelint
- keyPairPgpKeyPair
- idstring
- encAlgorithmSymmetricKeyAlgorithmTag
- passPhrasechar[]
- useSha1bool
- hashedPacketsPgpSignatureSubpacketVector
- unhashedPacketsPgpSignatureSubpacketVector
- randSecureRandom
  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
  
    - certificationLevelint
- algorithmPublicKeyAlgorithmTag
- pubKeyAsymmetricKeyParameter
- privKeyAsymmetricKeyParameter
- timeDateTime
- idstring
- encAlgorithmSymmetricKeyAlgorithmTag
- passPhrasechar[]
- hashedPacketsPgpSignatureSubpacketVector
- unhashedPacketsPgpSignatureSubpacketVector
- randSecureRandom
  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
  
    - certificationLevelint
- algorithmPublicKeyAlgorithmTag
- pubKeyAsymmetricKeyParameter
- privKeyAsymmetricKeyParameter
- timeDateTime
- idstring
- encAlgorithmSymmetricKeyAlgorithmTag
- passPhrasechar[]
- useSha1bool
- hashedPacketsPgpSignatureSubpacketVector
- unhashedPacketsPgpSignatureSubpacketVector
- randSecureRandom
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
  
  
  
  
  
  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
  
    - keyPgpSecretKey
- oldPassPhrasechar[]
- newPassPhrasechar[]
- newEncAlgorithmSymmetricKeyAlgorithmTag
- randSecureRandom
Returns
  
    - PgpSecretKey
  CopyWithNewPasswordRaw(PgpSecretKey, byte[], byte[], SymmetricKeyAlgorithmTag, SecureRandom)
  
  
  
  
  
    public static PgpSecretKey CopyWithNewPasswordRaw(PgpSecretKey key, byte[] rawOldPassPhrase, byte[] rawNewPassPhrase, SymmetricKeyAlgorithmTag newEncAlgorithm, SecureRandom rand)
   
  Parameters
  
    - keyPgpSecretKey
- rawOldPassPhrasebyte[]
- rawNewPassPhrasebyte[]
- newEncAlgorithmSymmetricKeyAlgorithmTag
- randSecureRandom
Returns
  
    - PgpSecretKey
  CopyWithNewPasswordUtf8(PgpSecretKey, char[], char[], SymmetricKeyAlgorithmTag, SecureRandom)
  
  
  
  
  
    public static PgpSecretKey CopyWithNewPasswordUtf8(PgpSecretKey key, char[] oldPassPhrase, char[] newPassPhrase, SymmetricKeyAlgorithmTag newEncAlgorithm, SecureRandom rand)
   
  Parameters
  
    - keyPgpSecretKey
- oldPassPhrasechar[]
- newPassPhrasechar[]
- newEncAlgorithmSymmetricKeyAlgorithmTag
- randSecureRandom
Returns
  
    - PgpSecretKey
  Encode(Stream)
  
  
  
  
  
    public void Encode(Stream outStr)
   
  Parameters
  
    - outStrStream
    public PgpPrivateKey ExtractPrivateKey(char[] passPhrase)
   
  Parameters
  
    - passPhrasechar[]
Returns
  
    - PgpPrivateKey
    public PgpPrivateKey ExtractPrivateKeyRaw(byte[] rawPassPhrase)
   
  Parameters
  
    - rawPassPhrasebyte[]
Returns
  
    - PgpPrivateKey
    public PgpPrivateKey ExtractPrivateKeyUtf8(char[] passPhrase)
   
  Parameters
  
    - passPhrasechar[]
Returns
  
    - PgpPrivateKey
  GetEncoded()
  
  
  
  
  
    public byte[] GetEncoded()
   
  Returns
  
    - byte[]
  ParseSecretKeyFromSExpr(Stream, char[])
  
  
  
  
  
    public static PgpSecretKey ParseSecretKeyFromSExpr(Stream inputStream, char[] passPhrase)
   
  Parameters
  
    - inputStreamStream
- passPhrasechar[]
Returns
  
    - PgpSecretKey
  ParseSecretKeyFromSExpr(Stream, char[], PgpPublicKey)
  
  
  
  
  
    public static PgpSecretKey ParseSecretKeyFromSExpr(Stream inputStream, char[] passPhrase, PgpPublicKey pubKey)
   
  Parameters
  
    - inputStreamStream
- passPhrasechar[]
- pubKeyPgpPublicKey
Returns
  
    - PgpSecretKey
  ParseSecretKeyFromSExprRaw(Stream, byte[])
  
  
  
  
  
    public static PgpSecretKey ParseSecretKeyFromSExprRaw(Stream inputStream, byte[] rawPassPhrase)
   
  Parameters
  
    - inputStreamStream
- rawPassPhrasebyte[]
Returns
  
    - PgpSecretKey
  ParseSecretKeyFromSExprRaw(Stream, byte[], PgpPublicKey)
  
  
  
  
  
    public static PgpSecretKey ParseSecretKeyFromSExprRaw(Stream inputStream, byte[] rawPassPhrase, PgpPublicKey pubKey)
   
  Parameters
  
    - inputStreamStream
- rawPassPhrasebyte[]
- pubKeyPgpPublicKey
Returns
  
    - PgpSecretKey
  ParseSecretKeyFromSExprUtf8(Stream, char[])
  
  
  
  
  
    public static PgpSecretKey ParseSecretKeyFromSExprUtf8(Stream inputStream, char[] passPhrase)
   
  Parameters
  
    - inputStreamStream
- passPhrasechar[]
Returns
  
    - PgpSecretKey
  ParseSecretKeyFromSExprUtf8(Stream, char[], PgpPublicKey)
  
  
  
  
  
    public static PgpSecretKey ParseSecretKeyFromSExprUtf8(Stream inputStream, char[] passPhrase, PgpPublicKey pubKey)
   
  Parameters
  
    - inputStreamStream
- passPhrasechar[]
- pubKeyPgpPublicKey
Returns
  
    - PgpSecretKey
  ReplacePublicKey(PgpSecretKey, PgpPublicKey)
  
  
  
  
  
    public static PgpSecretKey ReplacePublicKey(PgpSecretKey secretKey, PgpPublicKey publicKey)
   
  Parameters
  
    - secretKeyPgpSecretKey
- publicKeyPgpPublicKey
Returns
  
    - PgpSecretKey