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
CanonicalTextDocument
public const int CanonicalTextDocument = 1
Field Value
CasualCertification
public const int CasualCertification = 18
Field Value
CertificationRevocation
public const int CertificationRevocation = 48
Field Value
DefaultCertification
public const int DefaultCertification = 16
Field Value
DirectKey
public const int DirectKey = 31
Field Value
KeyRevocation
public const int KeyRevocation = 32
Field Value
NoCertification
public const int NoCertification = 17
Field Value
PositiveCertification
public const int PositiveCertification = 19
Field Value
PrimaryKeyBinding
public const int PrimaryKeyBinding = 25
Field Value
StandAlone
public const int StandAlone = 2
Field Value
SubkeyBinding
public const int SubkeyBinding = 24
Field Value
SubkeyRevocation
public const int SubkeyRevocation = 40
Field Value
ThirdPartyConfirmation
public const int ThirdPartyConfirmation = 80
Field Value
Timestamp
public const int Timestamp = 64
Field Value
Properties
CreationTime
The creation time of this signature.
public DateTime CreationTime { get; }
Property Value
HasSubpackets
Return true if the signature has either hashed or unhashed subpackets.
public bool HasSubpackets { get; }
Property Value
HashAlgorithm
The hash algorithm associated with this signature.
public HashAlgorithmTag HashAlgorithm { get; }
Property Value
KeyAlgorithm
The key algorithm associated with this signature.
public PublicKeyAlgorithmTag KeyAlgorithm { get; }
Property Value
KeyId
The ID of the key that created the signature.
public long KeyId { get; }
Property Value
SignatureType
public int SignatureType { get; }
Property Value
Version
The OpenPGP version number for this signature.
public int Version { get; }
Property Value
Methods
Encode(Stream)
public void Encode(Stream outStream)
Parameters
outStreamStream
Encode(Stream, bool)
public void Encode(Stream outStream, bool forTransfer)
Parameters
GetDigestPrefix()
Return the digest prefix of the signature.
public byte[] GetDigestPrefix()
Returns
- byte[]
GetEncoded()
public byte[] GetEncoded()
Returns
- byte[]
GetHashedSubPackets()
public PgpSignatureSubpacketVector GetHashedSubPackets()
Returns
GetSignature()
public byte[] GetSignature()
Returns
- byte[]
GetSignatureTrailer()
public byte[] GetSignatureTrailer()
Returns
- byte[]
GetUnhashedSubPackets()
public PgpSignatureSubpacketVector GetUnhashedSubPackets()
Returns
InitVerify(PgpPublicKey)
public void InitVerify(PgpPublicKey pubKey)
Parameters
pubKeyPgpPublicKey
IsCertification()
Return true if this signature represents a certification.
public bool IsCertification()
Returns
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
signatureTypeint
Returns
- bool
true if signatureType is a certification, false otherwise.
IsSignatureEncodingEqual(PgpSignature, PgpSignature)
public static bool IsSignatureEncodingEqual(PgpSignature sig1, PgpSignature sig2)
Parameters
sig1PgpSignaturesig2PgpSignature
Returns
Join(PgpSignature, PgpSignature)
public static PgpSignature Join(PgpSignature sig1, PgpSignature sig2)
Parameters
sig1PgpSignaturesig2PgpSignature
Returns
Update(byte)
public void Update(byte b)
Parameters
bbyte
Update(params byte[])
public void Update(params byte[] bytes)
Parameters
bytesbyte[]
Update(byte[], int, int)
public void Update(byte[] bytes, int off, int length)
Parameters
Update(ReadOnlySpan<byte>)
public void Update(ReadOnlySpan<byte> input)
Parameters
inputReadOnlySpan<byte>
Verify()
public bool Verify()
Returns
VerifyCertification(PgpPublicKey)
Verify a key certification, such as revocation, for the passed in key.
public bool VerifyCertification(PgpPublicKey pubKey)
Parameters
pubKeyPgpPublicKeyThe 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
masterKeyPgpPublicKeyThe key we are verifying against.
pubKeyPgpPublicKeyThe 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
userAttributesPgpUserAttributeSubpacketVectorUser attributes the key was stored under.
keyPgpPublicKeyThe 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
idstringID the key was stored under.
keyPgpPublicKeyThe key to be verified.
Returns
- bool
True, if the signature matches, false otherwise.