Class JceExternalPublicKeyDataDecryptorFactoryBuilder
PublicKeyDataDecryptorFactory whose private key material is held outside
the OpenPGP key - typically on a hardware token - as described by
OpenPGP External Secret
Keys and signalled by SecretKeyPacket.USAGE_EXTERNAL. This is the
JCA/JCE analogue of BcExternalPublicKeyDataDecryptorFactory.
All session-key recovery logic (packet parsing, length checks, the RFC 6637 / RFC 9580 KDF and key
unwrap sequencing) is inherited from AbstractExternalPublicKeyDataDecryptorFactory, with the
cryptographic primitives bound to the configured JCA provider; a subclass supplies only the raw
private-key operation by implementing build(OpenPGPKey.OpenPGPSecretKey) with a
JceExternalPublicKeyDataDecryptorFactoryBuilder.PublicKeyCryptoCallback, which receives the sender's ephemeral key as a JCA
PublicKey built through the configured provider.
Note that a secret key handled through this builder need not actually be external: if the supplied key
carries usable software key material, the factory built delegates to
JcePublicKeyDataDecryptorFactoryBuilder so the (much cheaper) in-process path is used instead.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classCallback isolating the raw public-key operations performed while recovering an OpenPGP session key. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionabstract PublicKeyDataDecryptorFactorybuild(OpenPGPKey.OpenPGPSecretKey secretKey) Build a decryptor factory for the given secret key, routing the raw private-key operation to wherever the key material is actually held.protected PublicKeyDataDecryptorFactorybuild(PGPKeyPair keyPair, JceExternalPublicKeyDataDecryptorFactoryBuilder.PublicKeyCryptoCallback cryptoCallback) setContentProvider(String providerName) setContentProvider(Provider provider) setProvider(String providerName) Set the provider name to use for creating cryptographic primitives in the resulting factory the builder produces.setProvider(Provider provider) Set the provider object to use for creating cryptographic primitives in the resulting factory the builder produces.
-
Constructor Details
-
JceExternalPublicKeyDataDecryptorFactoryBuilder
public JceExternalPublicKeyDataDecryptorFactoryBuilder()
-
-
Method Details
-
setProvider
Set the provider object to use for creating cryptographic primitives in the resulting factory the builder produces.- Parameters:
provider- provider object for cryptographic primitives.- Returns:
- the current builder.
-
setProvider
Set the provider name to use for creating cryptographic primitives in the resulting factory the builder produces.- Parameters:
providerName- the name of the provider to reference for cryptographic primitives.- Returns:
- the current builder.
-
setContentProvider
-
setContentProvider
-
build
public abstract PublicKeyDataDecryptorFactory build(OpenPGPKey.OpenPGPSecretKey secretKey) throws PGPException Build a decryptor factory for the given secret key, routing the raw private-key operation to wherever the key material is actually held.- Parameters:
secretKey- the (typically external) OpenPGP secret key- Returns:
- decryptor factory
- Throws:
PGPException- if the key cannot be unlocked
-
build
protected PublicKeyDataDecryptorFactory build(PGPKeyPair keyPair, JceExternalPublicKeyDataDecryptorFactoryBuilder.PublicKeyCryptoCallback cryptoCallback) throws PGPException - Throws:
PGPException
-