Class PGPSignatureVerifierBuilder

java.lang.Object
org.bouncycastle.openpgp.PGPSignatureVerifierBuilder

public class PGPSignatureVerifierBuilder extends Object
Builder for thread-safe verifiers for a range of PGP signature types.
  • Constructor Details

    • PGPSignatureVerifierBuilder

      public PGPSignatureVerifierBuilder(PGPContentVerifierBuilderProvider verifierBuilderProvider, PGPPublicKey verificationKey)
      Base constructor.
      Parameters:
      verifierBuilderProvider - provider to build verifiers from.
      verificationKey - the public key which corresponds to the signing key generating the signatures we are looking at.
  • Method Details

    • buildDirectKeyVerifier

      public PGPSignatureVerifier buildDirectKeyVerifier(PGPSignature certification, PGPPublicKey publicKey) throws PGPException
      Instantiate a signature verifier for a PGPSignature.DIRECT_KEY signature.
      Parameters:
      certification - the PGP signature containing the certification.
      publicKey - public key subject for the direct key signature.
      Returns:
      a verifier.
      Throws:
      PGPException - if signature type is wrong or there is a problem constructing the verifier.
    • buildKeyRevocationVerifier

      public PGPSignatureVerifier buildKeyRevocationVerifier(PGPSignature certification, PGPPublicKey publicKey) throws PGPException
      Instantiate a signature verifier for a PGPSignature.KEY_REVOCATION signature.
      Parameters:
      certification - the PGP signature containing the certification.
      publicKey - public key subject for key revocation signature.
      Returns:
      a verifier.
      Throws:
      PGPException - if signature type is wrong or there is a problem constructing the verifier.
    • buildPrimaryKeyBindingVerifier

      public PGPSignatureVerifier buildPrimaryKeyBindingVerifier(PGPSignature certification, PGPPublicKey primaryKey, PGPPublicKey subKey) throws PGPException
      Instantiate a signature verifier for a PGPSignature.PRIMARYKEY_BINDING signature.
      Parameters:
      certification - the PGP signature containing the certification.
      primaryKey - primary key for the primary key binding signature.
      subKey - sub-key for the primary key binding signature.
      Returns:
      a verifier.
      Throws:
      PGPException - if signature type is wrong or there is a problem constructing the verifier.
    • buildSubKeyBindingVerifier

      public PGPSignatureVerifier buildSubKeyBindingVerifier(PGPSignature certification, PGPPublicKey primaryKey, PGPPublicKey subKey) throws PGPException
      Instantiate a signature verifier for a PGPSignature.SUBKEY_BINDING signature.
      Parameters:
      certification - the PGP signature containing the certification.
      primaryKey - primary key for the sub-key binding signature.
      subKey - sub-key for the sub-key binding signature.
      Returns:
      a verifier.
      Throws:
      PGPException - if signature type is wrong or there is a problem constructing the verifier.
    • buildSubKeyRevocationVerifier

      public PGPSignatureVerifier buildSubKeyRevocationVerifier(PGPSignature certification, PGPPublicKey primaryKey, PGPPublicKey subKey) throws PGPException
      Instantiate a signature verifier for a PGPSignature.SUBKEY_REVOCATION signature.
      Parameters:
      certification - the PGP signature containing the certification.
      primaryKey - primary key for the sub-key key revocation signature.
      subKey - sub-key for the sub-key key revocation signature.
      Returns:
      a verifier.
      Throws:
      PGPException - if signature type is wrong or there is a problem constructing the verifier.
    • buildCertificationVerifier

      public PGPSignatureVerifier buildCertificationVerifier(PGPSignature certification, String userID, PGPPublicKey publicKey) throws PGPException
      Return a verifier for a signature as certifying the passed in public key as associated with the passed in user ID.
      Parameters:
      userID - the user ID, will be converted to UTF8.
      publicKey - the key to be verified.
      Returns:
      a verifier.
      Throws:
      PGPException - if signature type is wrong or there is a problem constructing the verifier.
    • buildCertificationVerifier

      public PGPSignatureVerifier buildCertificationVerifier(PGPSignature certification, byte[] rawUserID, PGPPublicKey publicKey) throws PGPException
      Return a verifier for a signature as certifying the passed in public key as associated with the passed in raw user ID.
      Parameters:
      rawUserID - raw encoding of the user ID (assumed a UTF8 string, not user attributes)
      publicKey - the key to be verified.
      Returns:
      a verifier.
      Throws:
      PGPException - if signature type is wrong or there is a problem constructing the verifier.
    • buildCertificationVerifier

      public PGPSignatureVerifier buildCertificationVerifier(PGPSignature certification, PGPUserAttributeSubpacketVector userAttributes, PGPPublicKey publicKey) throws PGPException
      Return a verifier for a signature as certifying the passed in public key as associated with the passed in user attributes.
      Parameters:
      userAttributes - user attributes the key was stored under
      publicKey - the key to be verified.
      Returns:
      a verifier.
      Throws:
      PGPException - if signature type is wrong or there is a problem constructing the verifier.