Top Description Fields Constructors Methods
org.bouncycastle.openpgp

public Class PGPSignatureGenerator

extends Object
Class Inheritance
Imports
java.io.ByteArrayOutputStream, .IOException, .OutputStream, java.math.BigInteger, java.util.Date, org.bouncycastle.bcpg.MPInteger, .OnePassSignaturePacket, .PublicKeyAlgorithmTags, .SignaturePacket, .SignatureSubpacket, .SignatureSubpacketTags, .UserAttributeSubpacket, org.bouncycastle.bcpg.sig.IssuerKeyID, .SignatureCreationTime, 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 byte
private int
private OutputStream
private int
private SignatureSubpacket[]

Constructor Summary

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

Create a signature generator built on the passed in contentSignerBuilder.

Method Summary

Modifier and TypeMethod and Description
private void
blockUpdate(byte[] block, int off, int len)

private void
byteUpdate(byte b)

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.

private byte[]
public void
init(int signatureType, PGPPrivateKey key)

Initialise the generator for signing.

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

public void
public void
public void
update(byte b)

public void
update(byte[] b)

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

private void
updateWithIdData(int header, byte[] idBytes)

private void
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

contentSignerback to summary
private PGPContentSigner contentSigner
contentSignerBuilderback to summary
private PGPContentSignerBuilder contentSignerBuilder
hashedback to summary
private SignatureSubpacket[] hashed
lastbback to summary
private byte lastb
providedKeyAlgorithmback to summary
private int providedKeyAlgorithm
sigOutback to summary
private OutputStream sigOut
sigTypeback to summary
private int sigType
unhashedback to summary
private SignatureSubpacket[] unhashed

Constructor Detail

PGPSignatureGeneratorback to summary
public PGPSignatureGenerator(PGPContentSignerBuilder contentSignerBuilder)

Create a signature generator built on the passed in contentSignerBuilder.

Parameters
contentSignerBuilder:PGPContentSignerBuilder

builder to produce PGPContentSigner objects for generating signatures.

Method Detail

blockUpdateback to summary
private void blockUpdate(byte[] block, int off, int len)
byteUpdateback to summary
private void byteUpdate(byte b)
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

getEncodedPublicKeyback to summary
private byte[] getEncodedPublicKey(PGPPublicKey pubKey) throws PGPException
initback to summary
public void init(int signatureType, PGPPrivateKey key) throws PGPException

Initialise the generator for signing.

insertSubpacketback to summary
private SignatureSubpacket[] insertSubpacket(SignatureSubpacket[] packets, SignatureSubpacket subpacket)
packetPresentback to summary
private boolean packetPresent(SignatureSubpacket[] packets, int type)
setHashedSubpacketsback to summary
public void setHashedSubpackets(PGPSignatureSubpacketVector hashedPcks)
setUnhashedSubpacketsback to summary
public void setUnhashedSubpackets(PGPSignatureSubpacketVector unhashedPcks)
updateback to summary
public void update(byte b)
updateback to summary
public void update(byte[] b)
updateback to summary
public void update(byte[] b, int off, int len)
updateWithIdDataback to summary
private void updateWithIdData(int header, byte[] idBytes)
updateWithPublicKeyback to summary
private void updateWithPublicKey(PGPPublicKey key) throws PGPException