Package org.pgpainless.signature.builder
Class AbstractSignatureBuilder<B extends AbstractSignatureBuilder<B>>
java.lang.Object
org.pgpainless.signature.builder.AbstractSignatureBuilder<B>
- Direct Known Subclasses:
DirectKeySelfSignatureBuilder,PrimaryKeyBindingSignatureBuilder,RevocationSignatureBuilder,SelfSignatureBuilder,SubkeyBindingSignatureBuilder,ThirdPartyCertificationSignatureBuilder,ThirdPartyDirectKeySignatureBuilder,UniversalSignatureBuilder
public abstract class AbstractSignatureBuilder<B extends AbstractSignatureBuilder<B>>
extends Object
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected HashAlgorithmprotected SignatureSubpacketsprotected final org.bouncycastle.openpgp.PGPPrivateKeyprotected final org.bouncycastle.openpgp.PGPPublicKeyprotected SignatureTypeprotected SignatureSubpackets -
Constructor Summary
ConstructorsModifierConstructorDescriptionAbstractSignatureBuilder(org.bouncycastle.openpgp.PGPSecretKey certificationKey, SecretKeyRingProtector protector, org.bouncycastle.openpgp.PGPSignature archetypeSignature) AbstractSignatureBuilder(SignatureType signatureType, org.bouncycastle.openpgp.PGPSecretKey signingKey, SecretKeyRingProtector protector) protectedAbstractSignatureBuilder(SignatureType signatureType, org.bouncycastle.openpgp.PGPSecretKey signingKey, SecretKeyRingProtector protector, HashAlgorithm hashAlgorithm, SignatureSubpackets hashedSubpackets, SignatureSubpackets unhashedSubpackets) -
Method Summary
Modifier and TypeMethodDescriptionprotected org.bouncycastle.openpgp.PGPSignatureGeneratorBuild an instance ofPGPSignatureGeneratorinitialized with the signing key and with hashed and unhashed subpackets.protected abstract booleanReturn true if the givenSignatureTypeis a valid choice for the concrete implementation ofAbstractSignatureBuilder.protected static HashAlgorithmnegotiateHashAlgorithm(org.bouncycastle.openpgp.PGPPublicKey publicKey) Negotiate aHashAlgorithmto be used when creating the signature.overrideHashAlgorithm(HashAlgorithm hashAlgorithm) Set the buildersSignatureType.
-
Field Details
-
privateSigningKey
protected final org.bouncycastle.openpgp.PGPPrivateKey privateSigningKey -
publicSigningKey
protected final org.bouncycastle.openpgp.PGPPublicKey publicSigningKey -
hashAlgorithm
-
signatureType
-
unhashedSubpackets
-
hashedSubpackets
-
-
Constructor Details
-
AbstractSignatureBuilder
protected AbstractSignatureBuilder(SignatureType signatureType, org.bouncycastle.openpgp.PGPSecretKey signingKey, SecretKeyRingProtector protector, HashAlgorithm hashAlgorithm, SignatureSubpackets hashedSubpackets, SignatureSubpackets unhashedSubpackets) throws org.bouncycastle.openpgp.PGPException - Throws:
org.bouncycastle.openpgp.PGPException
-
AbstractSignatureBuilder
public AbstractSignatureBuilder(SignatureType signatureType, org.bouncycastle.openpgp.PGPSecretKey signingKey, SecretKeyRingProtector protector) throws org.bouncycastle.openpgp.PGPException - Throws:
org.bouncycastle.openpgp.PGPException
-
AbstractSignatureBuilder
public AbstractSignatureBuilder(org.bouncycastle.openpgp.PGPSecretKey certificationKey, SecretKeyRingProtector protector, org.bouncycastle.openpgp.PGPSignature archetypeSignature) throws org.bouncycastle.openpgp.PGPException - Throws:
org.bouncycastle.openpgp.PGPException
-
-
Method Details
-
negotiateHashAlgorithm
protected static HashAlgorithm negotiateHashAlgorithm(org.bouncycastle.openpgp.PGPPublicKey publicKey) Negotiate aHashAlgorithmto be used when creating the signature.- Parameters:
publicKey- signing public key- Returns:
- hash algorithm
-
overrideHashAlgorithm
-
setSignatureType
Set the buildersSignatureType. Note that only those types who are valid for the concrete subclass of thisAbstractSignatureBuilderare allowed. Invalid choices result in anIllegalArgumentExceptionto be thrown.- Parameters:
type- signature type- Returns:
- builder
-
buildAndInitSignatureGenerator
protected org.bouncycastle.openpgp.PGPSignatureGenerator buildAndInitSignatureGenerator() throws org.bouncycastle.openpgp.PGPExceptionBuild an instance ofPGPSignatureGeneratorinitialized with the signing key and with hashed and unhashed subpackets.- Returns:
- pgp signature generator
- Throws:
org.bouncycastle.openpgp.PGPException- if the signature generator cannot be initialized
-
isValidSignatureType
Return true if the givenSignatureTypeis a valid choice for the concrete implementation ofAbstractSignatureBuilder.- Parameters:
type- type- Returns:
- return true if valid, false otherwise
-