Table of Contents

Class PgpSignature

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

Remarks

A PGP signature object.

Fields

BinaryDocument

public const int BinaryDocument = 0

Field Value

int

CanonicalTextDocument

public const int CanonicalTextDocument = 1

Field Value

int

CasualCertification

public const int CasualCertification = 18

Field Value

int

CertificationRevocation

public const int CertificationRevocation = 48

Field Value

int

DefaultCertification

public const int DefaultCertification = 16

Field Value

int

DirectKey

public const int DirectKey = 31

Field Value

int

KeyRevocation

public const int KeyRevocation = 32

Field Value

int

NoCertification

public const int NoCertification = 17

Field Value

int

PositiveCertification

public const int PositiveCertification = 19

Field Value

int

PrimaryKeyBinding

public const int PrimaryKeyBinding = 25

Field Value

int

StandAlone

public const int StandAlone = 2

Field Value

int

SubkeyBinding

public const int SubkeyBinding = 24

Field Value

int

SubkeyRevocation

public const int SubkeyRevocation = 40

Field Value

int

ThirdPartyConfirmation

public const int ThirdPartyConfirmation = 80

Field Value

int

Timestamp

public const int Timestamp = 64

Field Value

int

Properties

CreationTime

The creation time of this signature.

public DateTime CreationTime { get; }

Property Value

DateTime

HasSubpackets

Return true if the signature has either hashed or unhashed subpackets.

public bool HasSubpackets { get; }

Property Value

bool

HashAlgorithm

The hash algorithm associated with this signature.

public HashAlgorithmTag HashAlgorithm { get; }

Property Value

HashAlgorithmTag

KeyAlgorithm

The key algorithm associated with this signature.

public PublicKeyAlgorithmTag KeyAlgorithm { get; }

Property Value

PublicKeyAlgorithmTag

KeyId

The ID of the key that created the signature.

public long KeyId { get; }

Property Value

long

SignatureType

public int SignatureType { get; }

Property Value

int

Version

The OpenPGP version number for this signature.

public int Version { get; }

Property Value

int

Methods

Encode(Stream)

public void Encode(Stream outStream)

Parameters

outStream Stream

Encode(Stream, bool)

public void Encode(Stream outStream, bool forTransfer)

Parameters

outStream Stream
forTransfer bool

GetDigestPrefix()

Return the digest prefix of the signature.

public byte[] GetDigestPrefix()

Returns

byte[]

GetEncoded()

public byte[] GetEncoded()

Returns

byte[]

GetHashedSubPackets()

public PgpSignatureSubpacketVector GetHashedSubPackets()

Returns

PgpSignatureSubpacketVector

GetSignature()

public byte[] GetSignature()

Returns

byte[]

GetSignatureTrailer()

public byte[] GetSignatureTrailer()

Returns

byte[]

GetUnhashedSubPackets()

public PgpSignatureSubpacketVector GetUnhashedSubPackets()

Returns

PgpSignatureSubpacketVector

InitVerify(PgpPublicKey)

public void InitVerify(PgpPublicKey pubKey)

Parameters

pubKey PgpPublicKey

IsCertification()

Return true if this signature represents a certification.

public bool IsCertification()

Returns

bool

IsCertification(int)

Return true if the passed in signature type represents a certification, false if the signature type is not.

public static bool IsCertification(int signatureType)

Parameters

signatureType int

Returns

bool

true if signatureType is a certification, false otherwise.

IsSignatureEncodingEqual(PgpSignature, PgpSignature)

public static bool IsSignatureEncodingEqual(PgpSignature sig1, PgpSignature sig2)

Parameters

sig1 PgpSignature
sig2 PgpSignature

Returns

bool

Join(PgpSignature, PgpSignature)

public static PgpSignature Join(PgpSignature sig1, PgpSignature sig2)

Parameters

sig1 PgpSignature
sig2 PgpSignature

Returns

PgpSignature

Update(byte)

public void Update(byte b)

Parameters

b byte

Update(params byte[])

public void Update(params byte[] bytes)

Parameters

bytes byte[]

Update(byte[], int, int)

public void Update(byte[] bytes, int off, int length)

Parameters

bytes byte[]
off int
length int

Update(ReadOnlySpan<byte>)

public void Update(ReadOnlySpan<byte> input)

Parameters

input ReadOnlySpan<byte>

Verify()

public bool Verify()

Returns

bool

VerifyCertification(PgpPublicKey)

Verify a key certification, such as revocation, for the passed in key.

public bool VerifyCertification(PgpPublicKey pubKey)

Parameters

pubKey PgpPublicKey

The key we are checking.

Returns

bool

True, if the certification is valid, false otherwise.

VerifyCertification(PgpPublicKey, PgpPublicKey)

Verify a certification for the passed in key against the passed in master key.

public bool VerifyCertification(PgpPublicKey masterKey, PgpPublicKey pubKey)

Parameters

masterKey PgpPublicKey

The key we are verifying against.

pubKey PgpPublicKey

The key we are verifying.

Returns

bool

True, if the certification is valid, false otherwise.

VerifyCertification(PgpUserAttributeSubpacketVector, PgpPublicKey)

Verify the signature as certifying the passed in public key as associated with the passed in user attributes.

public bool VerifyCertification(PgpUserAttributeSubpacketVector userAttributes, PgpPublicKey key)

Parameters

userAttributes PgpUserAttributeSubpacketVector

User attributes the key was stored under.

key PgpPublicKey

The key to be verified.

Returns

bool

True, if the signature matches, false otherwise.

VerifyCertification(string, PgpPublicKey)

Verify the signature as certifying the passed in public key as associated with the passed in ID.

public bool VerifyCertification(string id, PgpPublicKey key)

Parameters

id string

ID the key was stored under.

key PgpPublicKey

The key to be verified.

Returns

bool

True, if the signature matches, false otherwise.