Bouncy Castle Cryptography Library 1.45

org.bouncycastle.openpgp
Class PGPSignatureGenerator

java.lang.Object
  extended by org.bouncycastle.openpgp.PGPSignatureGenerator

public class PGPSignatureGenerator
extends java.lang.Object

Generator for PGP Signatures.


Constructor Summary
PGPSignatureGenerator(int keyAlgorithm, int hashAlgorithm, java.security.Provider provider)
           
PGPSignatureGenerator(int keyAlgorithm, int hashAlgorithm, java.lang.String provider)
          Create a generator for the passed in keyAlgorithm and hashAlgorithm codes.
PGPSignatureGenerator(int keyAlgorithm, java.security.Provider sigProvider, int hashAlgorithm, java.security.Provider digProvider)
           
PGPSignatureGenerator(int keyAlgorithm, java.lang.String sigProvider, int hashAlgorithm, java.lang.String digProvider)
          Create a generator for the passed in keyAlgorithm and hashAlgorithm codes.
 
Method Summary
 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.
 void initSign(int signatureType, PGPPrivateKey key)
          Initialise the generator for signing.
 void initSign(int signatureType, PGPPrivateKey key, java.security.SecureRandom random)
          Initialise the generator for signing.
 void setHashedSubpackets(PGPSignatureSubpacketVector hashedPcks)
           
 void setUnhashedSubpackets(PGPSignatureSubpacketVector unhashedPcks)
           
 void update(byte b)
           
 void update(byte[] b)
           
 void update(byte[] b, int off, int len)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PGPSignatureGenerator

public PGPSignatureGenerator(int keyAlgorithm,
                             int hashAlgorithm,
                             java.lang.String provider)
                      throws java.security.NoSuchAlgorithmException,
                             java.security.NoSuchProviderException,
                             PGPException
Create a generator for the passed in keyAlgorithm and hashAlgorithm codes.

Parameters:
keyAlgorithm - keyAlgorithm to use for signing
hashAlgorithm - algorithm to use for digest
provider - provider to use for digest algorithm
Throws:
java.security.NoSuchAlgorithmException
java.security.NoSuchProviderException
PGPException

PGPSignatureGenerator

public PGPSignatureGenerator(int keyAlgorithm,
                             int hashAlgorithm,
                             java.security.Provider provider)
                      throws java.security.NoSuchAlgorithmException,
                             PGPException
Throws:
java.security.NoSuchAlgorithmException
PGPException

PGPSignatureGenerator

public PGPSignatureGenerator(int keyAlgorithm,
                             java.lang.String sigProvider,
                             int hashAlgorithm,
                             java.lang.String digProvider)
                      throws java.security.NoSuchAlgorithmException,
                             java.security.NoSuchProviderException,
                             PGPException
Create a generator for the passed in keyAlgorithm and hashAlgorithm codes.

Parameters:
keyAlgorithm - keyAlgorithm to use for signing
sigProvider - provider to use for signature generation
hashAlgorithm - algorithm to use for digest
digProvider - provider to use for digest algorithm
Throws:
java.security.NoSuchAlgorithmException
java.security.NoSuchProviderException
PGPException

PGPSignatureGenerator

public PGPSignatureGenerator(int keyAlgorithm,
                             java.security.Provider sigProvider,
                             int hashAlgorithm,
                             java.security.Provider digProvider)
                      throws java.security.NoSuchAlgorithmException,
                             PGPException
Throws:
java.security.NoSuchAlgorithmException
PGPException
Method Detail

initSign

public void initSign(int signatureType,
                     PGPPrivateKey key)
              throws PGPException
Initialise the generator for signing.

Parameters:
signatureType -
key -
Throws:
PGPException

initSign

public void initSign(int signatureType,
                     PGPPrivateKey key,
                     java.security.SecureRandom random)
              throws PGPException
Initialise the generator for signing.

Parameters:
signatureType -
key -
random -
Throws:
PGPException

update

public void update(byte b)
            throws java.security.SignatureException
Throws:
java.security.SignatureException

update

public void update(byte[] b)
            throws java.security.SignatureException
Throws:
java.security.SignatureException

update

public void update(byte[] b,
                   int off,
                   int len)
            throws java.security.SignatureException
Throws:
java.security.SignatureException

setHashedSubpackets

public void setHashedSubpackets(PGPSignatureSubpacketVector hashedPcks)

setUnhashedSubpackets

public void setUnhashedSubpackets(PGPSignatureSubpacketVector unhashedPcks)

generateOnePassVersion

public PGPOnePassSignature generateOnePassVersion(boolean isNested)
                                           throws PGPException
Return the one pass header associated with the current signature.

Parameters:
isNested -
Returns:
PGPOnePassSignature
Throws:
PGPException

generate

public PGPSignature generate()
                      throws PGPException,
                             java.security.SignatureException
Return a signature object containing the current signature state.

Returns:
PGPSignature
Throws:
PGPException
java.security.SignatureException

generateCertification

public PGPSignature generateCertification(java.lang.String id,
                                          PGPPublicKey pubKey)
                                   throws java.security.SignatureException,
                                          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:
java.security.SignatureException
PGPException

generateCertification

public PGPSignature generateCertification(PGPUserAttributeSubpacketVector userAttributes,
                                          PGPPublicKey pubKey)
                                   throws java.security.SignatureException,
                                          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:
java.security.SignatureException
PGPException

generateCertification

public PGPSignature generateCertification(PGPPublicKey masterKey,
                                          PGPPublicKey pubKey)
                                   throws java.security.SignatureException,
                                          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:
java.security.SignatureException
PGPException

generateCertification

public PGPSignature generateCertification(PGPPublicKey pubKey)
                                   throws java.security.SignatureException,
                                          PGPException
Generate a certification, such as a revocation, for the passed in key.

Parameters:
pubKey - the key we are certifying.
Returns:
the certification.
Throws:
java.security.SignatureException
PGPException

Bouncy Castle Cryptography Library 1.45