C# Class Org.BouncyCastle.Bcpg.OpenPgp.PgpSecretKey

General class to handle a PGP secret key object.
Show file Open project: red-gate/iTextSharp-4.1.6 Class Usage Examples

Public Methods

Method Description
CopyWithNewPassword ( PgpSecretKey key, char oldPassPhrase, char newPassPhrase, SymmetricKeyAlgorithmTag newEncAlgorithm, SecureRandom rand ) : PgpSecretKey

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

Encode ( Stream outStr ) : void
ExtractPrivateKey ( char passPhrase ) : PgpPrivateKey

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

GetEncoded ( ) : byte[]
PgpSecretKey ( int certificationLevel, PgpKeyPair keyPair, string id, SymmetricKeyAlgorithmTag encAlgorithm, char passPhrase, PgpSignatureSubpacketVector hashedPackets, PgpSignatureSubpacketVector unhashedPackets, SecureRandom rand ) : System
PgpSecretKey ( int certificationLevel, PgpKeyPair keyPair, string id, SymmetricKeyAlgorithmTag encAlgorithm, char passPhrase, bool useSha1, PgpSignatureSubpacketVector hashedPackets, PgpSignatureSubpacketVector unhashedPackets, SecureRandom rand ) : System
PgpSecretKey ( int certificationLevel, PublicKeyAlgorithmTag algorithm, AsymmetricKeyParameter pubKey, AsymmetricKeyParameter privKey, System.DateTime time, string id, SymmetricKeyAlgorithmTag encAlgorithm, char passPhrase, PgpSignatureSubpacketVector hashedPackets, PgpSignatureSubpacketVector unhashedPackets, SecureRandom rand ) : System
PgpSecretKey ( int certificationLevel, PublicKeyAlgorithmTag algorithm, AsymmetricKeyParameter pubKey, AsymmetricKeyParameter privKey, System.DateTime time, string id, SymmetricKeyAlgorithmTag encAlgorithm, char passPhrase, bool useSha1, PgpSignatureSubpacketVector hashedPackets, PgpSignatureSubpacketVector unhashedPackets, SecureRandom rand ) : System
ReplacePublicKey ( PgpSecretKey secretKey, PgpPublicKey publicKey ) : PgpSecretKey

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

Private Methods

Method Description
Checksum ( bool useSha1, byte bytes, int length ) : byte[]
EncryptKeyData ( byte rawKeyData, SymmetricKeyAlgorithmTag encAlgorithm, char passPhrase, SecureRandom random, S2k &s2k, byte &iv ) : byte[]
ExtractKeyData ( char passPhrase ) : byte[]
PgpSecretKey ( PgpPrivateKey privKey, PgpPublicKey pubKey, SymmetricKeyAlgorithmTag encAlgorithm, char passPhrase, bool useSha1, SecureRandom rand ) : System
PgpSecretKey ( PgpPrivateKey privKey, PgpPublicKey pubKey, SymmetricKeyAlgorithmTag encAlgorithm, char passPhrase, bool useSha1, SecureRandom rand, bool isMasterKey ) : System
PgpSecretKey ( SecretKeyPacket secret, PgpPublicKey pub ) : System
certifiedPublicKey ( int certificationLevel, PgpKeyPair keyPair, string id, PgpSignatureSubpacketVector hashedPackets, PgpSignatureSubpacketVector unhashedPackets ) : PgpPublicKey

Method Details

CopyWithNewPassword() public static method

Return a copy of the passed in secret key, encrypted using a new password and the passed in algorithm.
public static CopyWithNewPassword ( PgpSecretKey key, char oldPassPhrase, char newPassPhrase, SymmetricKeyAlgorithmTag newEncAlgorithm, SecureRandom rand ) : PgpSecretKey
key PgpSecretKey The PgpSecretKey to be copied.
oldPassPhrase char The current password for the key.
newPassPhrase char The new password for the key.
newEncAlgorithm SymmetricKeyAlgorithmTag The algorithm to be used for the encryption.
rand Org.BouncyCastle.Security.SecureRandom Source of randomness.
return PgpSecretKey

Encode() public method

public Encode ( Stream outStr ) : void
outStr Stream
return void

ExtractPrivateKey() public method

Extract a PgpPrivateKey from this secret key's encrypted contents.
public ExtractPrivateKey ( char passPhrase ) : PgpPrivateKey
passPhrase char
return PgpPrivateKey

GetEncoded() public method

public GetEncoded ( ) : byte[]
return byte[]

PgpSecretKey() public method

public PgpSecretKey ( int certificationLevel, PgpKeyPair keyPair, string id, SymmetricKeyAlgorithmTag encAlgorithm, char passPhrase, PgpSignatureSubpacketVector hashedPackets, PgpSignatureSubpacketVector unhashedPackets, SecureRandom rand ) : System
certificationLevel int
keyPair PgpKeyPair
id string
encAlgorithm SymmetricKeyAlgorithmTag
passPhrase char
hashedPackets PgpSignatureSubpacketVector
unhashedPackets PgpSignatureSubpacketVector
rand Org.BouncyCastle.Security.SecureRandom
return System

PgpSecretKey() public method

public PgpSecretKey ( int certificationLevel, PgpKeyPair keyPair, string id, SymmetricKeyAlgorithmTag encAlgorithm, char passPhrase, bool useSha1, PgpSignatureSubpacketVector hashedPackets, PgpSignatureSubpacketVector unhashedPackets, SecureRandom rand ) : System
certificationLevel int
keyPair PgpKeyPair
id string
encAlgorithm SymmetricKeyAlgorithmTag
passPhrase char
useSha1 bool
hashedPackets PgpSignatureSubpacketVector
unhashedPackets PgpSignatureSubpacketVector
rand Org.BouncyCastle.Security.SecureRandom
return System

PgpSecretKey() public method

public PgpSecretKey ( int certificationLevel, PublicKeyAlgorithmTag algorithm, AsymmetricKeyParameter pubKey, AsymmetricKeyParameter privKey, System.DateTime time, string id, SymmetricKeyAlgorithmTag encAlgorithm, char passPhrase, PgpSignatureSubpacketVector hashedPackets, PgpSignatureSubpacketVector unhashedPackets, SecureRandom rand ) : System
certificationLevel int
algorithm PublicKeyAlgorithmTag
pubKey Org.BouncyCastle.Crypto.AsymmetricKeyParameter
privKey Org.BouncyCastle.Crypto.AsymmetricKeyParameter
time System.DateTime
id string
encAlgorithm SymmetricKeyAlgorithmTag
passPhrase char
hashedPackets PgpSignatureSubpacketVector
unhashedPackets PgpSignatureSubpacketVector
rand Org.BouncyCastle.Security.SecureRandom
return System

PgpSecretKey() public method

public PgpSecretKey ( int certificationLevel, PublicKeyAlgorithmTag algorithm, AsymmetricKeyParameter pubKey, AsymmetricKeyParameter privKey, System.DateTime time, string id, SymmetricKeyAlgorithmTag encAlgorithm, char passPhrase, bool useSha1, PgpSignatureSubpacketVector hashedPackets, PgpSignatureSubpacketVector unhashedPackets, SecureRandom rand ) : System
certificationLevel int
algorithm PublicKeyAlgorithmTag
pubKey Org.BouncyCastle.Crypto.AsymmetricKeyParameter
privKey Org.BouncyCastle.Crypto.AsymmetricKeyParameter
time System.DateTime
id string
encAlgorithm SymmetricKeyAlgorithmTag
passPhrase char
useSha1 bool
hashedPackets PgpSignatureSubpacketVector
unhashedPackets PgpSignatureSubpacketVector
rand Org.BouncyCastle.Security.SecureRandom
return System

ReplacePublicKey() public static method

Replace the passed the public key on the passed in secret key.
If KeyId's do not match.
public static ReplacePublicKey ( PgpSecretKey secretKey, PgpPublicKey publicKey ) : PgpSecretKey
secretKey PgpSecretKey Secret key to change.
publicKey PgpPublicKey New public key.
return PgpSecretKey