<PackageReference Include="BouncyCastle.Cryptography" Version="2.7.0-beta.98" />

RsaPublicBcpgKey

Base class for an RSA public key.
using Org.BouncyCastle.Math; namespace Org.BouncyCastle.Bcpg { public class RsaPublicBcpgKey : BcpgObject, IBcpgKey { private readonly MPInteger m_n; private readonly MPInteger m_e; public BigInteger Modulus => m_n.Value; public BigInteger PublicExponent => m_e.Value; public string Format => "PGP"; public RsaPublicBcpgKey(BcpgInputStream bcpgIn) { m_n = new MPInteger(bcpgIn); m_e = new MPInteger(bcpgIn); } public RsaPublicBcpgKey(BigInteger n, BigInteger e) { m_n = new MPInteger(n); m_e = new MPInteger(e); } public override byte[] GetEncoded() { return BcpgOutputStream.GetEncodedOrNull(this); } public override void Encode(BcpgOutputStream bcpgOut) { bcpgOut.WriteObjects(m_n, m_e); } } }