Package org.bouncycastle.openpgp
Class PGPSignatureGenerator
java.lang.Object
org.bouncycastle.openpgp.PGPSignatureGenerator
Generator for PGP Signatures.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected byteprotected OutputStreamprotected intprotected final int -
Constructor Summary
ConstructorsConstructorDescriptionPGPSignatureGenerator(PGPContentSignerBuilder contentSignerBuilder) Deprecated.PGPSignatureGenerator(PGPContentSignerBuilder contentSignerBuilder, PGPPublicKey signingKey) Create a signature generator built on the passed in contentSignerBuilder.PGPSignatureGenerator(PGPContentSignerBuilder contentSignerBuilder, PGPPublicKey signingKey, int signatureVersion) -
Method Summary
Modifier and TypeMethodDescriptionprotected voidblockUpdate(byte[] block, int off, int len) generate()Return a signature object containing the current signature state.generateCertification(String id, PGPPublicKey pubKey) Generate a certification for the passed in id and key.generateCertification(PGPPublicKey pubKey) Generate a certification, such as a revocation, for the passed in key.generateCertification(PGPPublicKey masterKey, PGPPublicKey pubKey) Generate a certification for the passed in key against the passed in master key.generateCertification(PGPUserAttributeSubpacketVector userAttributes, PGPPublicKey pubKey) Generate a certification for the passed in userAttributesgenerateOnePassVersion(boolean isNested) Return the one pass header associated with the current signature.protected voidgetAttributesHash(PGPUserAttributeSubpacketVector userAttributes) voidinit(int signatureType, PGPPrivateKey key) Initialise the generator for signing.protected voidvoidsetHashedSubpackets(PGPSignatureSubpacketVector hashedPcks) Set the hashed signature subpackets.voidsetUnhashedSubpackets(PGPSignatureSubpacketVector unhashedPcks) Set the unhashed signature subpackets.voidupdate(byte b) voidupdate(byte[] b) voidupdate(byte[] b, int off, int len) protected voidupdateWithIdData(int header, byte[] idBytes) protected void
-
Field Details
-
lastb
protected byte lastb -
sigOut
-
sigType
protected int sigType -
version
protected final int version
-
-
Constructor Details
-
PGPSignatureGenerator
Deprecated.Create a version 4 signature generator built on the passed in contentSignerBuilder.- Parameters:
contentSignerBuilder- builder to produce PGPContentSigner objects for generating signatures.
-
PGPSignatureGenerator
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 signaturessigningKey- signing key
-
PGPSignatureGenerator
public PGPSignatureGenerator(PGPContentSignerBuilder contentSignerBuilder, PGPPublicKey signingKey, int signatureVersion)
-
-
Method Details
-
init
Initialise the generator for signing.- Parameters:
signatureType- type of signaturekey- private signing key- Throws:
PGPException
-
setHashedSubpackets
Set the hashed signature subpackets. Hashed signature subpackets are covered by the signature.- Parameters:
hashedPcks- hashed signature subpackets
-
setUnhashedSubpackets
Set the unhashed signature subpackets. Unhashed signature subpackets are not covered by the signature.- Parameters:
unhashedPcks- unhashed signature subpackets
-
generateOnePassVersion
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
Return a signature object containing the current signature state.- Returns:
- PGPSignature
- Throws:
PGPException
-
prepareSignatureSubpackets
- Throws:
PGPException
-
generateCertification
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
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
- Throws:
PGPException
-
getAttributesHash
protected void getAttributesHash(PGPUserAttributeSubpacketVector userAttributes) throws PGPException - Throws:
PGPException
-
PGPSignatureGenerator(PGPContentSignerBuilder, PGPPublicKey)instead.