Top Description Fields Constructors Methods
org.bouncycastle.openpgp

public Class PGPSignatureGenerator

extends PGPDefaultSignatureGenerator
Class Inheritance
Imports
java.io.ByteArrayOutputStream, .IOException, java.math.BigInteger, java.util.Date, org.bouncycastle.bcpg.HashUtils, .MPInteger, .OnePassSignaturePacket, .PublicKeyAlgorithmTags, .SignaturePacket, .SignatureSubpacket, .SignatureSubpacketTags, org.bouncycastle.bcpg.sig.IssuerFingerprint, .IssuerKeyID, .SignatureCreationTime, org.bouncycastle.crypto.CryptoServicesRegistrar, org.bouncycastle.openpgp.operator.PGPContentSigner, .PGPContentSignerBuilder, org.bouncycastle.util.Arrays, .Strings

Generator for PGP Signatures.

Field Summary

Modifier and TypeField and Description
private PGPContentSigner
private PGPContentSignerBuilder
private SignatureSubpacket[]
private int
private byte[]
private PGPPublicKey
private SignatureSubpacket[]
Inherited from org.bouncycastle.openpgp.PGPDefaultSignatureGenerator:
lastbsigOutsigTypeversion

Constructor Summary

AccessConstructor and Description
public
PGPSignatureGenerator(PGPContentSignerBuilder
builder to produce PGPContentSigner objects for generating signatures.
contentSignerBuilder
)

Create a version 4 signature generator built on the passed in contentSignerBuilder.

pack-priv
PGPSignatureGenerator(PGPContentSignerBuilder
builder to produce PGPContentSigner objects for generating signatures.
contentSignerBuilder
,
int
signature version
version
)

Create a signature generator built on the passed in contentSignerBuilder.

public
PGPSignatureGenerator(PGPContentSignerBuilder
builder to produce PGPContentSigner objects for generating signatures
contentSignerBuilder
,
PGPPublicKey
signing key
signingKey
)

Create a signature generator built on the passed in contentSignerBuilder.

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

Method Summary

Modifier and TypeMethod and Description
public PGPSignature

Returns:

PGPSignature
generate
()

Return a signature object containing the current signature state.

public PGPSignature

Returns:

the certification.
generateCertification
(String
the id we are certifying against the public key.
id
,
PGPPublicKey
the key we are certifying against the id.
pubKey
)

Generate a certification for the passed in id and key.

public PGPSignature

Returns:

the certification.
generateCertification
(PGPUserAttributeSubpacketVector
the id we are certifying against the public key.
userAttributes
,
PGPPublicKey
the key we are certifying against the id.
pubKey
)

Generate a certification for the passed in userAttributes

public PGPSignature

Returns:

the certification.
generateCertification
(PGPPublicKey
the key we are certifying against.
masterKey
,
PGPPublicKey
the key we are certifying.
pubKey
)

Generate a certification for the passed in key against the passed in master key.

public PGPSignature

Returns:

the certification.
generateCertification
(PGPPublicKey
the key we are certifying.
pubKey
)

Generate a certification, such as a revocation, for the passed in key.

public PGPOnePassSignature

Returns:

PGPOnePassSignature
generateOnePassVersion
(boolean
true if the signature is nested, false otherwise.
isNested
)

Return the one pass header associated with the current signature.

public void
init(int
type of signature
signatureType
,
PGPPrivateKey
private signing key
key
)

Initialise the generator for signing.

private SignatureSubpacket[]
private boolean
packetNotPresent(SignatureSubpacket[] packets, int type)

protected void
public void
setHashedSubpackets(PGPSignatureSubpacketVector
hashed signature subpackets
hashedPcks
)

Set the hashed signature subpackets.

public void
setUnhashedSubpackets(PGPSignatureSubpacketVector
unhashed signature subpackets
unhashedPcks
)

Set the unhashed signature subpackets.

private OnePassSignaturePacket
v3OPSPacket(boolean isNested)

private OnePassSignaturePacket
v6OPSPacket(boolean isNested)

Inherited from org.bouncycastle.openpgp.PGPDefaultSignatureGenerator:
blockUpdategetAttributesHashupdateupdateupdateupdateWithIdDataupdateWithPublicKey

Field Detail

contentSignerback to summary
private PGPContentSigner contentSigner
contentSignerBuilderback to summary
private PGPContentSignerBuilder contentSignerBuilder
hashedback to summary
private SignatureSubpacket[] hashed
providedKeyAlgorithmback to summary
private int providedKeyAlgorithm
saltback to summary
private byte[] salt
signingPubKeyback to summary
private PGPPublicKey signingPubKey
unhashedback to summary
private SignatureSubpacket[] unhashed

Constructor Detail

PGPSignatureGeneratorback to summary
public PGPSignatureGenerator(PGPContentSignerBuilder contentSignerBuilder)

Create a version 4 signature generator built on the passed in contentSignerBuilder.

Parameters
contentSignerBuilder:PGPContentSignerBuilder

builder to produce PGPContentSigner objects for generating signatures.

PGPSignatureGeneratorback to summary
pack-priv PGPSignatureGenerator(PGPContentSignerBuilder contentSignerBuilder, int version)

Create a signature generator built on the passed in contentSignerBuilder.

Parameters
contentSignerBuilder:PGPContentSignerBuilder

builder to produce PGPContentSigner objects for generating signatures.

version:int

signature version

PGPSignatureGeneratorback to summary
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:PGPContentSignerBuilder

builder to produce PGPContentSigner objects for generating signatures

signingKey:PGPPublicKey

signing key

PGPSignatureGeneratorback to summary
public PGPSignatureGenerator(PGPContentSignerBuilder contentSignerBuilder, PGPPublicKey signingKey, int signatureVersion)

Method Detail

generateback to summary
public PGPSignature generate() throws PGPException

Return a signature object containing the current signature state.

Returns:PGPSignature

PGPSignature

generateCertificationback to summary
public PGPSignature generateCertification(String id, PGPPublicKey pubKey) throws PGPException

Generate a certification for the passed in id and key.

Parameters
id:String

the id we are certifying against the public key.

pubKey:PGPPublicKey

the key we are certifying against the id.

Returns:PGPSignature

the certification.

generateCertificationback to summary
public PGPSignature generateCertification(PGPUserAttributeSubpacketVector userAttributes, PGPPublicKey pubKey) throws PGPException

Generate a certification for the passed in userAttributes

Parameters
userAttributes:PGPUserAttributeSubpacketVector

the id we are certifying against the public key.

pubKey:PGPPublicKey

the key we are certifying against the id.

Returns:PGPSignature

the certification.

generateCertificationback to summary
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:PGPPublicKey

the key we are certifying against.

pubKey:PGPPublicKey

the key we are certifying.

Returns:PGPSignature

the certification.

generateCertificationback to summary
public PGPSignature generateCertification(PGPPublicKey pubKey) throws PGPException

Generate a certification, such as a revocation, for the passed in key.

Parameters
pubKey:PGPPublicKey

the key we are certifying.

Returns:PGPSignature

the certification.

generateOnePassVersionback to summary
public PGPOnePassSignature generateOnePassVersion(boolean isNested) throws PGPException

Return the one pass header associated with the current signature.

Parameters
isNested:boolean

true if the signature is nested, false otherwise.

Returns:PGPOnePassSignature

PGPOnePassSignature

initback to summary
public void init(int signatureType, PGPPrivateKey key) throws PGPException

Initialise the generator for signing.

Parameters
signatureType:int

type of signature

key:PGPPrivateKey

private signing key

insertSubpacketback to summary
private SignatureSubpacket[] insertSubpacket(SignatureSubpacket[] packets, SignatureSubpacket subpacket)
packetNotPresentback to summary
private boolean packetNotPresent(SignatureSubpacket[] packets, int type)
prepareSignatureSubpacketsback to summary
protected void prepareSignatureSubpackets() throws PGPException
setHashedSubpacketsback to summary
public void setHashedSubpackets(PGPSignatureSubpacketVector hashedPcks)

Set the hashed signature subpackets. Hashed signature subpackets are covered by the signature.

Parameters
hashedPcks:PGPSignatureSubpacketVector

hashed signature subpackets

setUnhashedSubpacketsback to summary
public void setUnhashedSubpackets(PGPSignatureSubpacketVector unhashedPcks)

Set the unhashed signature subpackets. Unhashed signature subpackets are not covered by the signature.

Parameters
unhashedPcks:PGPSignatureSubpacketVector

unhashed signature subpackets

v3OPSPacketback to summary
private OnePassSignaturePacket v3OPSPacket(boolean isNested)
v6OPSPacketback to summary
private OnePassSignaturePacket v6OPSPacket(boolean isNested)