Class AbstractSignatureBuilder<B extends AbstractSignatureBuilder<B>>

    • Field Detail

      • privateSigningKey

        protected final org.bouncycastle.openpgp.PGPPrivateKey privateSigningKey
      • publicSigningKey

        protected final org.bouncycastle.openpgp.PGPPublicKey publicSigningKey
    • Constructor Detail

      • 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 Detail

      • negotiateHashAlgorithm

        protected static HashAlgorithm negotiateHashAlgorithm​(org.bouncycastle.openpgp.PGPPublicKey publicKey)
        Negotiate a HashAlgorithm to be used when creating the signature.
        Parameters:
        publicKey - signing public key
        Returns:
        hash algorithm
      • overrideHashAlgorithm

        public B overrideHashAlgorithm​(@Nonnull
                                       HashAlgorithm hashAlgorithm)
      • setSignatureType

        public B setSignatureType​(SignatureType type)
        Set the builders SignatureType. Note that only those types who are valid for the concrete subclass of this AbstractSignatureBuilder are allowed. Invalid choices result in an IllegalArgumentException to be thrown.
        Parameters:
        type - signature type
        Returns:
        builder
      • buildAndInitSignatureGenerator

        protected org.bouncycastle.openpgp.PGPSignatureGenerator buildAndInitSignatureGenerator()
                                                                                         throws org.bouncycastle.openpgp.PGPException
        Build an instance of PGPSignatureGenerator initialized 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

        protected abstract boolean isValidSignatureType​(SignatureType type)
        Return true if the given SignatureType is a valid choice for the concrete implementation of AbstractSignatureBuilder.
        Parameters:
        type - type
        Returns:
        return true if valid, false otherwise