Table of Contents

Class PgpKeyPair

Namespace
Org.BouncyCastle.Bcpg.OpenPgp
Assembly
BouncyCastle.Cryptography.dll
public class PgpKeyPair
Inheritance
PgpKeyPair
Inherited Members

Remarks

General class to handle JCA key pairs and convert them into OpenPGP ones.

A word for the unwary, the KeyId for an OpenPGP public key is calculated from a hash that includes the time of creation, if you pass a different date to the constructor below with the same public private key pair the KeyIs will not be the same as for previous generations of the key, so ideally you only want to do this once.

Constructors

PgpKeyPair(PgpPublicKey, PgpPrivateKey)

Create a key pair from a PgpPrivateKey and a PgpPublicKey.

public PgpKeyPair(PgpPublicKey pub, PgpPrivateKey priv)

Parameters

pub PgpPublicKey

The public key.

priv PgpPrivateKey

The private key.

PgpKeyPair(PublicKeyAlgorithmTag, AsymmetricCipherKeyPair, DateTime)

public PgpKeyPair(PublicKeyAlgorithmTag algorithm, AsymmetricCipherKeyPair keyPair, DateTime time)

Parameters

algorithm PublicKeyAlgorithmTag
keyPair AsymmetricCipherKeyPair
time DateTime

PgpKeyPair(PublicKeyAlgorithmTag, AsymmetricKeyParameter, AsymmetricKeyParameter, DateTime)

public PgpKeyPair(PublicKeyAlgorithmTag algorithm, AsymmetricKeyParameter pubKey, AsymmetricKeyParameter privKey, DateTime time)

Parameters

algorithm PublicKeyAlgorithmTag
pubKey AsymmetricKeyParameter
privKey AsymmetricKeyParameter
time DateTime

Properties

KeyId

The keyId associated with this key pair.

public long KeyId { get; }

Property Value

long

PrivateKey

public PgpPrivateKey PrivateKey { get; }

Property Value

PgpPrivateKey

PublicKey

public PgpPublicKey PublicKey { get; }

Property Value

PgpPublicKey