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

PgpPrivateKey

public class PgpPrivateKey
using Org.BouncyCastle.Crypto; using System; namespace Org.BouncyCastle.Bcpg.OpenPgp { public class PgpPrivateKey { private readonly long keyID; private readonly PublicKeyPacket publicKeyPacket; private readonly AsymmetricKeyParameter privateKey; public long KeyId => keyID; public PublicKeyPacket PublicKeyPacket => publicKeyPacket; public AsymmetricKeyParameter Key => privateKey; public PgpPrivateKey(long keyID, PublicKeyPacket publicKeyPacket, AsymmetricKeyParameter privateKey) { if (!privateKey.IsPrivate) throw new ArgumentException("Expected a private key", "privateKey"); this.keyID = keyID; this.publicKeyPacket = publicKeyPacket; this.privateKey = privateKey; } } }