org.bouncycastle.openpgp

Class PGPSignatureGenerator

public class PGPSignatureGenerator extends Object

Generator for PGP Signatures.
Constructor Summary
PGPSignatureGenerator(int keyAlgorithm, int hashAlgorithm, String provider)
Create a generator for the passed in keyAlgorithm and hashAlgorithm codes.
PGPSignatureGenerator(int keyAlgorithm, String sigProvider, int hashAlgorithm, String provider)
Create a generator for the passed in keyAlgorithm and hashAlgorithm codes.
Method Summary
PGPSignaturegenerate()
Return a signature object containing the current signature state.
PGPSignaturegenerateCertification(String id, PGPPublicKey pubKey)
Generate a certification for the passed in id and key.
PGPSignaturegenerateCertification(PGPPublicKey masterKey, PGPPublicKey pubKey)
Generate a certification for the passed in key against the passed in master key.
PGPSignaturegenerateCertification(PGPPublicKey pubKey)
Generate a certification, such as a revocation, for the passed in key.
PGPOnePassSignaturegenerateOnePassVersion(boolean isNested)
Return the one pass header associated with the current signature.
voidinitSign(int signatureType, PGPPrivateKey key)
Initialise the generator for signing.
voidsetHashedSubpackets(PGPSignatureSubpacketVector hashedPcks)
voidsetUnhashedSubpackets(PGPSignatureSubpacketVector unhashedPcks)
voidupdate(byte b)
voidupdate(byte[] b)
voidupdate(byte[] b, int off, int len)

Constructor Detail

PGPSignatureGenerator

public PGPSignatureGenerator(int keyAlgorithm, int hashAlgorithm, String provider)
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: NoSuchAlgorithmException NoSuchProviderException PGPException

PGPSignatureGenerator

public PGPSignatureGenerator(int keyAlgorithm, String sigProvider, int hashAlgorithm, String provider)
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 provider provider to use for digest algorithm

Throws: NoSuchAlgorithmException NoSuchProviderException PGPException

Method Detail

generate

public PGPSignature generate()
Return a signature object containing the current signature state.

Returns: PGPSignature

Throws: PGPException SignatureException

generateCertification

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

generateCertification

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

generateCertification

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

Parameters: pubKey the key we are certifying.

Returns: the certification.

Throws: SignatureException PGPException

generateOnePassVersion

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

Parameters: isNested

Returns: PGPOnePassSignature

Throws: PGPException

initSign

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

Parameters: signatureType key

Throws: PGPException

setHashedSubpackets

public void setHashedSubpackets(PGPSignatureSubpacketVector hashedPcks)

setUnhashedSubpackets

public void setUnhashedSubpackets(PGPSignatureSubpacketVector unhashedPcks)

update

public void update(byte b)

update

public void update(byte[] b)

update

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