|
Bouncy Castle Cryptography Library 1.79 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--org.bouncycastle.openpgp.PGPDefaultSignatureGenerator | +--org.bouncycastle.openpgp.PGPSignature
A PGP signature object.
Field Summary | |
static int |
BINARY_DOCUMENT
The signature is made over some binary data. |
static int |
CANONICAL_TEXT_DOCUMENT
The signature is made over text data. |
static int |
CASUAL_CERTIFICATION
Casual certification over a user-id or user-attribute. |
static int |
CERTIFICATION_REVOCATION
The signature is used to revoke a user-id certification signature ( DEFAULT_CERTIFICATION , NO_CERTIFICATION , CASUAL_CERTIFICATION ,
POSITIVE_CERTIFICATION ) or DIRECT_KEY signature. |
static int |
DEFAULT_CERTIFICATION
Generic certification over a user-id or user-attribute. |
static int |
DIRECT_KEY
The signature is made directly over a primary key. |
static int |
KEY_REVOCATION
The signature is used to revoke a primary key (and in turn the whole certificate with all its subkeys). |
protected byte |
lastb
|
static int |
NO_CERTIFICATION
Persona certification over a user-id or user-attribute. |
static int |
POSITIVE_CERTIFICATION
Positive certification over a user-id or user-attribute. |
static int |
PRIMARYKEY_BINDING
Primary-Key Binding Signature to bind a signing-capable subkey to a primary key. |
protected java.io.OutputStream |
sigOut
|
protected int |
sigType
|
static int |
STAND_ALONE
The signature is made only over its own signature subpackets. |
static int |
SUBKEY_BINDING
Subkey Binding Signature to bind a subkey to a primary key. |
static int |
SUBKEY_REVOCATION
The signature is used to revoke the binding of a particular subkey. |
static int |
THIRD_PARTY_CONFIRMATION
This signature is issued over another signature and can act as an attestation of that signature. |
static int |
TIMESTAMP
The signature is only meaningful for the timestamp contained in it. |
protected int |
version
|
Constructor Summary | |
PGPSignature(BCPGInputStream pIn)
Parse a PGPSignature from an OpenPGP packet input stream. |
Method Summary | |
protected void |
blockUpdate(byte[] block,
int off,
int len)
|
void |
encode(java.io.OutputStream outStream)
Encode the signature to an OpenPGP packet stream. |
void |
encode(java.io.OutputStream outStream,
boolean forTransfer)
Encode the signature to outStream, with trust packets stripped out if forTransfer is true. |
protected void |
getAttributesHash(PGPUserAttributeSubpacketVector userAttributes)
|
java.util.Date |
getCreationTime()
Return the creation time of the signature. |
byte[] |
getDigestPrefix()
Return the digest prefix of the signature. |
byte[] |
getEncoded()
Return the OpenPGP packet encoding of the signature. |
byte[] |
getEncoded(boolean forTransfer)
Return an encoding of the signature, with trust packets stripped out if forTransfer is true. |
int |
getHashAlgorithm()
Return the hash algorithm associated with this signature. |
java.util.List |
getHashedKeyIdentifiers()
Return a list of all KeyIdentifiers that could be derived from
any IssuerFingerprint or IssuerKeyID subpackets of the hashed signature
subpacket area. |
PGPSignatureSubpacketVector |
getHashedSubPackets()
Return the hashed subpackets of the signature. |
int |
getKeyAlgorithm()
Return the key algorithm associated with this signature. |
long |
getKeyID()
Return the id of the key that created the signature. |
java.util.List |
getKeyIdentifiers()
Create a list of KeyIdentifier objects, for all IssuerFingerprint
and IssuerKeyID signature subpackets found in either the hashed or unhashed areas
of the signature. |
byte[] |
getSignature()
Return the cryptographic raw signature contained in the OpenPGP signature packet. |
byte[] |
getSignatureTrailer()
|
int |
getSignatureType()
Return the type id of the signature. |
java.util.List |
getUnhashedKeyIdentifiers()
Return a list of all KeyIdentifiers that could be derived from
any IssuerFingerprint or IssuerKeyID subpackets of the unhashed signature
subpacket area. |
PGPSignatureSubpacketVector |
getUnhashedSubPackets()
Return the unhashed subpackets of the signature. |
int |
getVersion()
Return the OpenPGP version number for this signature. |
boolean |
hasSubpackets()
Return true if the signature has either hashed or unhashed subpackets. |
void |
init(PGPContentVerifierBuilderProvider verifierBuilderProvider,
PGPPublicKey pubKey)
Initialize the signature for verification. |
boolean |
isCertification()
Return true if this signature represents a certification. |
static boolean |
isCertification(int signatureType)
Return true if the passed in signature type represents a certification, false if the signature type is not. |
static boolean |
isSignatureEncodingEqual(PGPSignature sig1,
PGPSignature sig2)
Return true, if the cryptographic signature encoding of the two signatures match. |
static PGPSignature |
join(PGPSignature sig1,
PGPSignature sig2)
Join two copies of the same signature. |
void |
update(byte b)
|
void |
update(byte[] b)
|
void |
update(byte[] b,
int off,
int len)
|
protected void |
updateWithIdData(int header,
byte[] idBytes)
|
protected void |
updateWithPublicKey(PGPPublicKey key)
|
boolean |
verify()
Finish the verification and return true if the signature is "correct". |
boolean |
verifyCertification(byte[] rawID,
PGPPublicKey key)
Verify the signature as certifying the passed in public key as associated with the passed in rawID. |
boolean |
verifyCertification(PGPPublicKey pubKey)
Verify a key certification, such as a revocation, for the passed in key. |
boolean |
verifyCertification(PGPPublicKey masterKey,
PGPPublicKey pubKey)
Verify a certification for the passed in key against the passed in master key. |
boolean |
verifyCertification(PGPUserAttributeSubpacketVector userAttributes,
PGPPublicKey key)
Verify the signature as certifying the passed in public key as associated with the passed in user attributes. |
boolean |
verifyCertification(java.lang.String id,
PGPPublicKey key)
Verify the signature as certifying the passed in public key as associated with the passed in id. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public static final int BINARY_DOCUMENT
public static final int CANONICAL_TEXT_DOCUMENT
public static final int STAND_ALONE
public static final int DEFAULT_CERTIFICATION
public static final int NO_CERTIFICATION
public static final int CASUAL_CERTIFICATION
public static final int POSITIVE_CERTIFICATION
public static final int SUBKEY_BINDING
public static final int PRIMARYKEY_BINDING
SUBKEY_BINDING
signature and acts as
a claim by the subkey, stating that it is in fact a subkey of the primary key.public static final int DIRECT_KEY
public static final int KEY_REVOCATION
public static final int SUBKEY_REVOCATION
public static final int CERTIFICATION_REVOCATION
DEFAULT_CERTIFICATION
, NO_CERTIFICATION
, CASUAL_CERTIFICATION
,
POSITIVE_CERTIFICATION
) or DIRECT_KEY
signature.
Issued as a self-signature, it can be used to revoke an identity claim.
Issued over a third-party certificate, it revokes the attestation of the third-party's claim.public static final int TIMESTAMP
public static final int THIRD_PARTY_CONFIRMATION
protected byte lastb
protected java.io.OutputStream sigOut
protected int sigType
protected final int version
Constructor Detail |
public PGPSignature(BCPGInputStream pIn) throws java.io.IOException, PGPException
PGPSignature
from an OpenPGP packet input stream.pIn
- packet input streamjava.io.IOException
- PGPException
- Method Detail |
public int getVersion()
public int getKeyAlgorithm()
public int getHashAlgorithm()
public byte[] getDigestPrefix()
public boolean isCertification()
public void init(PGPContentVerifierBuilderProvider verifierBuilderProvider, PGPPublicKey pubKey) throws PGPException
verifierBuilderProvider
- provide the implementation for signature verificationpubKey
- issuer public keyPGPException
- public boolean verify() throws PGPException
PGPException
- public boolean verifyCertification(PGPUserAttributeSubpacketVector userAttributes, PGPPublicKey key) throws PGPException
userAttributes
- user attributes the key was stored underkey
- the key to be verified.PGPException
- public boolean verifyCertification(java.lang.String id, PGPPublicKey key) throws PGPException
id
- id the key was stored underkey
- the key to be verified.PGPException
- public boolean verifyCertification(byte[] rawID, PGPPublicKey key) throws PGPException
rawID
- id the key was stored under in its raw byte form.key
- the key to be verified.PGPException
- public boolean verifyCertification(PGPPublicKey masterKey, PGPPublicKey pubKey) throws PGPException
masterKey
- the key we are verifying against.pubKey
- the key we are verifying.PGPException
- public boolean verifyCertification(PGPPublicKey pubKey) throws PGPException
pubKey
- the key we are checking.PGPException
- public int getSignatureType()
public long getKeyID()
IssuerKeyID
or IssuerFingerprint
), there is not
a single source of truth for the key-id.
To match any suitable issuer keys, use getKeyIdentifiers()
instead.public java.util.List getKeyIdentifiers()
KeyIdentifier
objects, for all IssuerFingerprint
and IssuerKeyID
signature subpackets found in either the hashed or unhashed areas
of the signature.KeyIdentifiers
public java.util.List getHashedKeyIdentifiers()
KeyIdentifiers
that could be derived from
any IssuerFingerprint
or IssuerKeyID
subpackets of the hashed signature
subpacket area.public java.util.List getUnhashedKeyIdentifiers()
KeyIdentifiers
that could be derived from
any IssuerFingerprint
or IssuerKeyID
subpackets of the unhashed signature
subpacket area.public java.util.Date getCreationTime()
public byte[] getSignatureTrailer()
public boolean hasSubpackets()
public PGPSignatureSubpacketVector getHashedSubPackets()
public PGPSignatureSubpacketVector getUnhashedSubPackets()
IssuerKeyID
or IssuerFingerprint
, whose authenticity can be confirmed by
verifying the signature using the declared key.public byte[] getSignature() throws PGPException
PGPException
- public byte[] getEncoded() throws java.io.IOException
java.io.IOException
- public byte[] getEncoded(boolean forTransfer) throws java.io.IOException
forTransfer
- if the purpose of encoding is to send key to other users.java.io.IOException
- in case of encoding error.public void encode(java.io.OutputStream outStream) throws java.io.IOException
outStream
- packet streamjava.io.IOException
- public void encode(java.io.OutputStream outStream, boolean forTransfer) throws java.io.IOException
outStream
- stream to write the key encoding to.forTransfer
- if the purpose of encoding is to send key to other users.java.io.IOException
- in case of encoding error.public static boolean isCertification(int signatureType)
signatureType
- public static boolean isSignatureEncodingEqual(PGPSignature sig1, PGPSignature sig2)
sig1
- first signaturesig2
- second signaturepublic static PGPSignature join(PGPSignature sig1, PGPSignature sig2) throws PGPException
THIRD_PARTY_CONFIRMATION
signature), an implementation might want to
join an existing instance of a signature with an updated copy, e.g. retrieved from a key server.
This method merges both signature instances by joining unhashed subpackets.sig1
- first signaturesig2
- second signaturePGPException
- public void update(byte b)
public void update(byte[] b)
public void update(byte[] b, int off, int len)
protected void blockUpdate(byte[] block, int off, int len)
protected void updateWithIdData(int header, byte[] idBytes)
protected void updateWithPublicKey(PGPPublicKey key) throws PGPException
protected void getAttributesHash(PGPUserAttributeSubpacketVector userAttributes) throws PGPException
|
Bouncy Castle Cryptography Library 1.79 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |