Interface PublicKeyDataDecryptorFactoryProvider


public interface PublicKeyDataDecryptorFactoryProvider
Provider of PublicKeyDataDecryptorFactory instances for secret keys whose private key material BC cannot use directly - most importantly keys marked SecretKeyPacket.USAGE_EXTERNAL because they live on a hardware token.

Register an implementation with OpenPGPMessageProcessor.addPublicKeyDataDecryptorFactoryProvider(PublicKeyDataDecryptorFactoryProvider) to let the high-level API decrypt messages addressed to such a key.

This interface lives in the api package rather than in operator because it is expressed in terms of the high-level OpenPGPKey and KeyPassphraseProvider types, which are themselves layered on top of operator.

  • Method Details

    • providePublicKeyDataDecryptorFactory

      PublicKeyDataDecryptorFactory providePublicKeyDataDecryptorFactory(OpenPGPKey.OpenPGPSecretKey secretKey, KeyPassphraseProvider passphraseProvider) throws PGPException
      Return a PublicKeyDataDecryptorFactory for the given secret key, or null if this provider cannot serve that key - for example because no matching device is present. Returning null lets the caller try the next registered provider, so it is the right answer for "not mine"; throw a PGPException only when the key is ours and something went wrong.
      Parameters:
      secretKey - secret key the message was encrypted to
      passphraseProvider - callback supplying the key passphrase, or a device PIN
      Returns:
      a decryptor factory, or null if this provider cannot serve the key
      Throws:
      PGPException - if the key is one this provider handles but a factory cannot be built