org.bouncycastle.openpgp

Class PGPSignature

public class PGPSignature extends Object

A PGP signature object.
Field Summary
static intBINARY_DOCUMENT
static intCANONICAL_TEXT_DOCUMENT
static intCASUAL_CERTIFICATION
static intCERTIFICATION_REVOCATION
static intDEFAULT_CERTIFICATION
static intDIRECT_KEY
static intKEY_REVOCATION
static intNO_CERTIFICATION
static intPOSITIVE_CERTIFICATION
static intSTAND_ALONE
static intSUBKEY_BINDING
static intSUBKEY_REVOCATION
static intTIMESTAMP
Method Summary
voidencode(OutputStream outStream)
DategetCreationTime()
Return the creation time of the signature.
byte[]getEncoded()
intgetHashAlgorithm()
Return the hash algorithm associated with this signature.
PGPSignatureSubpacketVectorgetHashedSubPackets()
intgetKeyAlgorithm()
Return the key algorithm associated with this signature.
longgetKeyID()
Return the id of the key that created the signature.
byte[]getSignature()
byte[]getSignatureTrailer()
intgetSignatureType()
PGPSignatureSubpacketVectorgetUnhashedSubPackets()
intgetVersion()
Return the OpenPGP version number for this signature.
voidinitVerify(PGPPublicKey pubKey, String provider)
voidupdate(byte b)
voidupdate(byte[] bytes)
voidupdate(byte[] bytes, int off, int length)
booleanverify()
booleanverifyCertification(String id, PGPPublicKey key)
Verify the signature as certifying the passed in public key as associated with the passed in id.
booleanverifyCertification(PGPPublicKey masterKey, PGPPublicKey pubKey)
Verify a certification for the passed in key against the passed in master key.
booleanverifyCertification(PGPPublicKey pubKey)
Verify a key certification, such as a revocation, for the passed in key.

Field Detail

BINARY_DOCUMENT

public static final int BINARY_DOCUMENT

CANONICAL_TEXT_DOCUMENT

public static final int CANONICAL_TEXT_DOCUMENT

CASUAL_CERTIFICATION

public static final int CASUAL_CERTIFICATION

CERTIFICATION_REVOCATION

public static final int CERTIFICATION_REVOCATION

DEFAULT_CERTIFICATION

public static final int DEFAULT_CERTIFICATION

DIRECT_KEY

public static final int DIRECT_KEY

KEY_REVOCATION

public static final int KEY_REVOCATION

NO_CERTIFICATION

public static final int NO_CERTIFICATION

POSITIVE_CERTIFICATION

public static final int POSITIVE_CERTIFICATION

STAND_ALONE

public static final int STAND_ALONE

SUBKEY_BINDING

public static final int SUBKEY_BINDING

SUBKEY_REVOCATION

public static final int SUBKEY_REVOCATION

TIMESTAMP

public static final int TIMESTAMP

Method Detail

encode

public void encode(OutputStream outStream)

getCreationTime

public Date getCreationTime()
Return the creation time of the signature.

Returns: the signature creation time.

getEncoded

public byte[] getEncoded()

getHashAlgorithm

public int getHashAlgorithm()
Return the hash algorithm associated with this signature.

Returns: signature hash algorithm.

getHashedSubPackets

public PGPSignatureSubpacketVector getHashedSubPackets()

getKeyAlgorithm

public int getKeyAlgorithm()
Return the key algorithm associated with this signature.

Returns: signature key algorithm.

getKeyID

public long getKeyID()
Return the id of the key that created the signature.

Returns: keyID of the signatures corresponding key.

getSignature

public byte[] getSignature()

getSignatureTrailer

public byte[] getSignatureTrailer()

getSignatureType

public int getSignatureType()

getUnhashedSubPackets

public PGPSignatureSubpacketVector getUnhashedSubPackets()

getVersion

public int getVersion()
Return the OpenPGP version number for this signature.

Returns: signature version number.

initVerify

public void initVerify(PGPPublicKey pubKey, String provider)

update

public void update(byte b)

update

public void update(byte[] bytes)

update

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

verify

public boolean verify()

verifyCertification

public boolean verifyCertification(String id, PGPPublicKey key)
Verify the signature as certifying the passed in public key as associated with the passed in id.

Parameters: id id the key was stored under key the key to be verified.

Returns: true if the signature matches, false otherwise.

Throws: PGPException SignatureException

verifyCertification

public boolean verifyCertification(PGPPublicKey masterKey, PGPPublicKey pubKey)
Verify a certification for the passed in key against the passed in master key.

Parameters: masterKey the key we are verifying against. pubKey the key we are verifying.

Returns: true if the certification is valid, false otherwise.

Throws: SignatureException PGPException

verifyCertification

public boolean verifyCertification(PGPPublicKey pubKey)
Verify a key certification, such as a revocation, for the passed in key.

Parameters: pubKey the key we are checking.

Returns: true if the certification is valid, false otherwise.

Throws: SignatureException PGPException