Package org.bouncycastle.openpgp
Class PGPSignatureGenerator
- java.lang.Object
-
- org.bouncycastle.openpgp.PGPSignatureGenerator
-
public class PGPSignatureGenerator extends java.lang.Object
Generator for PGP Signatures.
-
-
Constructor Summary
Constructors Constructor Description PGPSignatureGenerator(PGPContentSignerBuilder contentSignerBuilder)
Create a signature generator built on the passed in contentSignerBuilder.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description PGPSignature
generate()
Return a signature object containing the current signature state.PGPSignature
generateCertification(java.lang.String id, PGPPublicKey pubKey)
Generate a certification for the passed in id and key.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 userAttributesPGPOnePassSignature
generateOnePassVersion(boolean isNested)
Return the one pass header associated with the current signature.void
init(int signatureType, PGPPrivateKey key)
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)
-
-
-
Constructor Detail
-
PGPSignatureGenerator
public PGPSignatureGenerator(PGPContentSignerBuilder contentSignerBuilder)
Create a signature generator built on the passed in contentSignerBuilder.- Parameters:
contentSignerBuilder
- builder to produce PGPContentSigner objects for generating signatures.
-
-
Method Detail
-
init
public void init(int signatureType, PGPPrivateKey key) throws PGPException
Initialise the generator for signing.- Parameters:
signatureType
-key
-- Throws:
PGPException
-
update
public void update(byte b)
-
update
public void update(byte[] b)
-
update
public void update(byte[] b, int off, int len)
-
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
- 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
-
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
-
-