Bouncy Castle Cryptography Library 1.79

org.bouncycastle.openpgp
Class PGPOnePassSignature

java.lang.Object
  |
  +--org.bouncycastle.openpgp.PGPDefaultSignatureGenerator
        |
        +--org.bouncycastle.openpgp.PGPOnePassSignature

public class PGPOnePassSignature
extends org.bouncycastle.openpgp.PGPDefaultSignatureGenerator

A one pass signature object.


Field Summary
protected  byte lastb
           
protected  java.io.OutputStream sigOut
           
protected  int sigType
           
protected  int version
           
 
Constructor Summary
PGPOnePassSignature(BCPGInputStream pIn)
           
 
Method Summary
protected  void blockUpdate(byte[] block, int off, int len)
           
 void encode(java.io.OutputStream outStream)
           
protected  void getAttributesHash(PGPUserAttributeSubpacketVector userAttributes)
           
 byte[] getEncoded()
           
 byte[] getFingerprint()
          Return the issuer key fingerprint.
 int getHashAlgorithm()
           
 int getKeyAlgorithm()
           
 long getKeyID()
          Return the key-ID of the issuer signing key.
 KeyIdentifier getKeyIdentifier()
          Return a KeyIdentifier identifying this PGPOnePassSignature.
 byte[] getSalt()
          Return the salt used in the corresponding signature.
 int getSignatureType()
           
 int getVersion()
          Return the packet version.
 void init(PGPContentVerifierBuilderProvider verifierBuilderProvider, PGPPublicKey pubKey)
          Initialise the signature object for verification.
 boolean isContaining()
          Return true, if the signature contains any signatures that follow.
 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(PGPSignature pgpSig)
          Verify the calculated signature against the passed in PGPSignature.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

lastb

protected byte lastb

sigOut

protected java.io.OutputStream sigOut

sigType

protected int sigType

version

protected final int version
Constructor Detail

PGPOnePassSignature

public PGPOnePassSignature(BCPGInputStream pIn)
                    throws java.io.IOException,
                           PGPException
Method Detail

init

public void init(PGPContentVerifierBuilderProvider verifierBuilderProvider,
                 PGPPublicKey pubKey)
          throws PGPException
Initialise the signature object for verification.
Parameters:
verifierBuilderProvider - provider for a content verifier builder for the signature type of interest.
pubKey - the public key to use for verification
Throws:
PGPException - if there's an issue with creating the verifier.

verify

public boolean verify(PGPSignature pgpSig)
               throws PGPException
Verify the calculated signature against the passed in PGPSignature.
Parameters:
pgpSig -  
Returns:
boolean
Throws:
PGPException -  

getVersion

public int getVersion()
Return the packet version.
Returns:
packet version

getKeyID

public long getKeyID()
Return the key-ID of the issuer signing key. For OnePassSignaturePacket.VERSION_6 packets, the key-ID is derived from the fingerprint.
Returns:
key-ID

getFingerprint

public byte[] getFingerprint()
Return the issuer key fingerprint. Only for OnePassSignaturePacket.VERSION_6 packets.
Returns:
fingerprint

getKeyIdentifier

public KeyIdentifier getKeyIdentifier()
Return a KeyIdentifier identifying this PGPOnePassSignature.
Returns:
key identifier

getSalt

public byte[] getSalt()
Return the salt used in the corresponding signature. Only for OnePassSignaturePacket.VERSION_6 packets.
Returns:
salt

getSignatureType

public int getSignatureType()

getHashAlgorithm

public int getHashAlgorithm()

getKeyAlgorithm

public int getKeyAlgorithm()

isContaining

public boolean isContaining()
Return true, if the signature contains any signatures that follow. A bracketing OPS is followed by additional OPS packets and is calculated over all the data between itself and its corresponding signature (it is an attestation for contained signatures).
Returns:
true if containing, false otherwise

getEncoded

public byte[] getEncoded()
                  throws java.io.IOException

encode

public void encode(java.io.OutputStream outStream)
            throws java.io.IOException

update

public void update(byte b)

update

public void update(byte[] b)

update

public void update(byte[] b,
                   int off,
                   int len)

blockUpdate

protected void blockUpdate(byte[] block,
                           int off,
                           int len)

updateWithIdData

protected void updateWithIdData(int header,
                                byte[] idBytes)

updateWithPublicKey

protected void updateWithPublicKey(PGPPublicKey key)
                            throws PGPException

getAttributesHash

protected void getAttributesHash(PGPUserAttributeSubpacketVector userAttributes)
                          throws PGPException

Bouncy Castle Cryptography Library 1.79