Bouncy Castle Cryptography Library 1.79

org.bouncycastle.openpgp
Class PGPSignatureGenerator

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

public class PGPSignatureGenerator
extends org.bouncycastle.openpgp.PGPDefaultSignatureGenerator

Generator for PGP Signatures.


Field Summary
protected  byte lastb
           
protected  java.io.OutputStream sigOut
           
protected  int sigType
           
protected  int version
           
 
Constructor Summary
PGPSignatureGenerator(PGPContentSignerBuilder contentSignerBuilder)
          Deprecated. use PGPSignatureGenerator(PGPContentSignerBuilder, PGPPublicKey) instead.
PGPSignatureGenerator(PGPContentSignerBuilder contentSignerBuilder, PGPPublicKey signingKey)
          Create a signature generator built on the passed in contentSignerBuilder.
PGPSignatureGenerator(PGPContentSignerBuilder contentSignerBuilder, PGPPublicKey signingKey, int signatureVersion)
           
 
Method Summary
protected  void blockUpdate(byte[] block, int off, int len)
           
 PGPSignature generate()
          Return a signature object containing the current signature state.
 PGPSignature generateCertification(PGPPublicKey pubKey)
          Generate a certification, such as a revocation, for the passed in key.
 PGPSignature generateCertification(PGPPublicKey masterKey, PGPPublicKey pubKey)
          Generate a certification for the passed in key against the passed in master key.
 PGPSignature generateCertification(PGPUserAttributeSubpacketVector userAttributes, PGPPublicKey pubKey)
          Generate a certification for the passed in userAttributes
 PGPSignature generateCertification(java.lang.String id, PGPPublicKey pubKey)
          Generate a certification for the passed in id and key.
 PGPOnePassSignature generateOnePassVersion(boolean isNested)
          Return the one pass header associated with the current signature.
protected  void getAttributesHash(PGPUserAttributeSubpacketVector userAttributes)
           
 void init(int signatureType, PGPPrivateKey key)
          Initialise the generator for signing.
protected  void prepareSignatureSubpackets()
           
 void setHashedSubpackets(PGPSignatureSubpacketVector hashedPcks)
          Set the hashed signature subpackets.
 void setUnhashedSubpackets(PGPSignatureSubpacketVector unhashedPcks)
          Set the unhashed signature subpackets.
 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)
           
 
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

PGPSignatureGenerator

public PGPSignatureGenerator(PGPContentSignerBuilder contentSignerBuilder)
Deprecated. use PGPSignatureGenerator(PGPContentSignerBuilder, PGPPublicKey) instead.

Create a version 4 signature generator built on the passed in contentSignerBuilder.
Parameters:
contentSignerBuilder - builder to produce PGPContentSigner objects for generating signatures.

PGPSignatureGenerator

public PGPSignatureGenerator(PGPContentSignerBuilder contentSignerBuilder,
                             PGPPublicKey signingKey)
Create a signature generator built on the passed in contentSignerBuilder. The produces signature version will match the version of the passed in signing key.
Parameters:
contentSignerBuilder - builder to produce PGPContentSigner objects for generating signatures
signingKey - signing key

PGPSignatureGenerator

public PGPSignatureGenerator(PGPContentSignerBuilder contentSignerBuilder,
                             PGPPublicKey signingKey,
                             int signatureVersion)
Method Detail

init

public void init(int signatureType,
                 PGPPrivateKey key)
          throws PGPException
Initialise the generator for signing.
Parameters:
signatureType - type of signature
key - private signing key
Throws:
PGPException -  

setHashedSubpackets

public void setHashedSubpackets(PGPSignatureSubpacketVector hashedPcks)
Set the hashed signature subpackets. Hashed signature subpackets are covered by the signature.
Parameters:
hashedPcks - hashed signature subpackets

setUnhashedSubpackets

public void setUnhashedSubpackets(PGPSignatureSubpacketVector unhashedPcks)
Set the unhashed signature subpackets. Unhashed signature subpackets are not covered by the signature.
Parameters:
unhashedPcks - unhashed signature subpackets

generateOnePassVersion

public PGPOnePassSignature generateOnePassVersion(boolean isNested)
                                           throws PGPException
Return the one pass header associated with the current signature.
Parameters:
isNested - true if the signature is nested, false otherwise.
Returns:
PGPOnePassSignature
Throws:
PGPException -  

generate

public PGPSignature generate()
                      throws PGPException
Return a signature object containing the current signature state.
Returns:
PGPSignature
Throws:
PGPException -  

prepareSignatureSubpackets

protected void prepareSignatureSubpackets()
                                   throws PGPException

generateCertification

public PGPSignature generateCertification(java.lang.String id,
                                          PGPPublicKey pubKey)
                                   throws PGPException
Generate a certification for the passed in id and key.
Parameters:
id - the id we are certifying against the public key.
pubKey - the key we are certifying against the id.
Returns:
the certification.
Throws:
PGPException -  

generateCertification

public PGPSignature generateCertification(PGPUserAttributeSubpacketVector userAttributes,
                                          PGPPublicKey pubKey)
                                   throws PGPException
Generate a certification for the passed in userAttributes
Parameters:
userAttributes - the id we are certifying against the public key.
pubKey - the key we are certifying against the id.
Returns:
the certification.
Throws:
PGPException -  

generateCertification

public PGPSignature generateCertification(PGPPublicKey masterKey,
                                          PGPPublicKey pubKey)
                                   throws PGPException
Generate a certification for the passed in key against the passed in master key.
Parameters:
masterKey - the key we are certifying against.
pubKey - the key we are certifying.
Returns:
the certification.
Throws:
PGPException -  

generateCertification

public PGPSignature generateCertification(PGPPublicKey pubKey)
                                   throws PGPException
Generate a certification, such as a revocation, for the passed in key.
Parameters:
pubKey - the key we are certifying.
Returns:
the certification.
Throws:
PGPException -  

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