Package org.pgpainless.signature.builder
Class ThirdPartyCertificationSignatureBuilder
- java.lang.Object
-
- org.pgpainless.signature.builder.AbstractSignatureBuilder<ThirdPartyCertificationSignatureBuilder>
-
- org.pgpainless.signature.builder.ThirdPartyCertificationSignatureBuilder
-
public class ThirdPartyCertificationSignatureBuilder extends AbstractSignatureBuilder<ThirdPartyCertificationSignatureBuilder>
Certification signature builder used to certify other users keys.
-
-
Field Summary
-
Fields inherited from class org.pgpainless.signature.builder.AbstractSignatureBuilder
hashAlgorithm, hashedSubpackets, privateSigningKey, publicSigningKey, signatureType, unhashedSubpackets
-
-
Constructor Summary
Constructors Constructor Description ThirdPartyCertificationSignatureBuilder(org.bouncycastle.openpgp.PGPSecretKey signingKey, SecretKeyRingProtector protector)
Create a new certification signature builder.ThirdPartyCertificationSignatureBuilder(org.bouncycastle.openpgp.PGPSecretKey signingKey, SecretKeyRingProtector protector, org.bouncycastle.openpgp.PGPSignature archetypeSignature)
Create a new certification signature builder.ThirdPartyCertificationSignatureBuilder(SignatureType signatureType, org.bouncycastle.openpgp.PGPSecretKey signingKey, SecretKeyRingProtector protector)
Create a new certification signature builder.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
applyCallback(CertificationSubpackets.Callback callback)
org.bouncycastle.openpgp.PGPSignature
build(org.bouncycastle.openpgp.PGPPublicKeyRing certifiedKey, String userId)
Create a certification signature for the given user-id and the primary key of the given key ring.org.bouncycastle.openpgp.PGPSignature
build(org.bouncycastle.openpgp.PGPPublicKeyRing certifiedKey, org.bouncycastle.openpgp.PGPUserAttributeSubpacketVector userAttribute)
Create a certification signature for the given user attribute and the primary key of the given key ring.CertificationSubpackets
getHashedSubpackets()
CertificationSubpackets
getUnhashedSubpackets()
protected boolean
isValidSignatureType(SignatureType type)
Return true if the givenSignatureType
is a valid choice for the concrete implementation ofAbstractSignatureBuilder
.-
Methods inherited from class org.pgpainless.signature.builder.AbstractSignatureBuilder
buildAndInitSignatureGenerator, negotiateHashAlgorithm, overrideHashAlgorithm, setSignatureType
-
-
-
-
Constructor Detail
-
ThirdPartyCertificationSignatureBuilder
public ThirdPartyCertificationSignatureBuilder(org.bouncycastle.openpgp.PGPSecretKey signingKey, SecretKeyRingProtector protector) throws org.bouncycastle.openpgp.PGPException
Create a new certification signature builder. This constructor usesSignatureType.GENERIC_CERTIFICATION
as signature type.- Parameters:
signingKey
- our own certification keyprotector
- protector to unlock the certification key- Throws:
WrongPassphraseException
- in case of a wrong passphraseorg.bouncycastle.openpgp.PGPException
-
ThirdPartyCertificationSignatureBuilder
public ThirdPartyCertificationSignatureBuilder(SignatureType signatureType, org.bouncycastle.openpgp.PGPSecretKey signingKey, SecretKeyRingProtector protector) throws org.bouncycastle.openpgp.PGPException
Create a new certification signature builder.- Parameters:
signatureType
- type of certificationsigningKey
- our own certification keyprotector
- protector to unlock the certification key- Throws:
WrongPassphraseException
- in case of a wrong passphraseorg.bouncycastle.openpgp.PGPException
-
ThirdPartyCertificationSignatureBuilder
public ThirdPartyCertificationSignatureBuilder(org.bouncycastle.openpgp.PGPSecretKey signingKey, SecretKeyRingProtector protector, org.bouncycastle.openpgp.PGPSignature archetypeSignature) throws org.bouncycastle.openpgp.PGPException
Create a new certification signature builder.- Parameters:
signingKey
- our own certification keyprotector
- protector to unlock the certification keyarchetypeSignature
- signature to use as a template for the new signature- Throws:
WrongPassphraseException
- in case of a wrong passphraseorg.bouncycastle.openpgp.PGPException
-
-
Method Detail
-
getHashedSubpackets
public CertificationSubpackets getHashedSubpackets()
-
getUnhashedSubpackets
public CertificationSubpackets getUnhashedSubpackets()
-
applyCallback
public void applyCallback(@Nullable CertificationSubpackets.Callback callback)
-
build
public org.bouncycastle.openpgp.PGPSignature build(org.bouncycastle.openpgp.PGPPublicKeyRing certifiedKey, String userId) throws org.bouncycastle.openpgp.PGPException
Create a certification signature for the given user-id and the primary key of the given key ring.- Parameters:
certifiedKey
- key ringuserId
- user-id to certify- Returns:
- signature
- Throws:
org.bouncycastle.openpgp.PGPException
-
build
public org.bouncycastle.openpgp.PGPSignature build(org.bouncycastle.openpgp.PGPPublicKeyRing certifiedKey, org.bouncycastle.openpgp.PGPUserAttributeSubpacketVector userAttribute) throws org.bouncycastle.openpgp.PGPException
Create a certification signature for the given user attribute and the primary key of the given key ring.- Parameters:
certifiedKey
- key ringuserAttribute
- user-attributes to certify- Returns:
- signature
- Throws:
org.bouncycastle.openpgp.PGPException
-
isValidSignatureType
protected boolean isValidSignatureType(@Nonnull SignatureType type)
Description copied from class:AbstractSignatureBuilder
Return true if the givenSignatureType
is a valid choice for the concrete implementation ofAbstractSignatureBuilder
.- Specified by:
isValidSignatureType
in classAbstractSignatureBuilder<ThirdPartyCertificationSignatureBuilder>
- Parameters:
type
- type- Returns:
- return true if valid, false otherwise
-
-