using System; using Org.BouncyCastle.Crypto; namespace Org.BouncyCastle.Bcpg.OpenPgp { /// General class to contain a private key for use with other OpenPGP objects. public class PgpPrivateKey { private readonly long keyId; private readonly AsymmetricKeyParameter privateKey; /// /// Create a PgpPrivateKey from a regular private key and the ID of its /// associated public key. /// /// Private key to use. /// ID of the corresponding public key. public PgpPrivateKey( AsymmetricKeyParameter privateKey, long keyId) { if (!privateKey.IsPrivate) throw new ArgumentException("Expected a private key", "privateKey"); this.privateKey = privateKey; this.keyId = keyId; } /// The keyId associated with the contained private key. public long KeyId { get { return keyId; } } /// The contained private key. public AsymmetricKeyParameter Key { get { return privateKey; } } } }