Class JceExternalPublicKeyDataDecryptorFactoryBuilder.PublicKeyCryptoCallback

java.lang.Object
org.bouncycastle.openpgp.api.operator.jcajce.JceExternalPublicKeyDataDecryptorFactoryBuilder.PublicKeyCryptoCallback
Enclosing class:
JceExternalPublicKeyDataDecryptorFactoryBuilder

public abstract static class JceExternalPublicKeyDataDecryptorFactoryBuilder.PublicKeyCryptoCallback extends Object
Callback isolating the raw public-key operations performed while recovering an OpenPGP session key. This is the JCA binding of the hooks AbstractExternalPublicKeyDataDecryptorFactory drives: ephemeral keys arrive as JCA PublicKey objects built through the configured provider, and no software private key is passed (the key material is held externally). See that class for the split between what the callback does and what the factory does.
  • Constructor Details

    • PublicKeyCryptoCallback

      public PublicKeyCryptoCallback()
  • Method Details

    • decryptRSA

      public abstract byte[] decryptRSA(int keyAlgorithm, byte[] pEnc) throws PGPException
      Perform RSA decryption of an encrypted session key.
      Parameters:
      keyAlgorithm - public key algorithm
      pEnc - encrypted session key
      Returns:
      decrypted session key
      Throws:
      PGPException - if the message cannot be decrypted
    • decryptElGamal

      public abstract byte[] decryptElGamal(int keyAlgorithm, byte[][] secKeyData) throws PGPException
      Perform ElGamal decryption of an encrypted session key.
      Parameters:
      keyAlgorithm - public key algorithm
      secKeyData - encrypted session key data
      Returns:
      decrypted session key
      Throws:
      PGPException - if the message cannot be decrypted
    • decryptECDH

      public abstract byte[] decryptECDH(ECDHPublicBCPGKey pubKey, PublicKey ephemeralKey) throws PGPException
      Perform an ECDH agreement to calculate a shared secret.
      Parameters:
      pubKey - our ECDH public key
      ephemeralKey - the sender's ephemeral public key
      Returns:
      shared secret
      Throws:
      PGPException - if the message cannot be decrypted
    • decryptX25519

      public abstract byte[] decryptX25519(PublicKey ephemeralKey) throws PGPException
      Perform an X25519 agreement to calculate a shared secret.
      Parameters:
      ephemeralKey - the sender's ephemeral X25519 public key
      Returns:
      shared secret
      Throws:
      PGPException - if the message cannot be decrypted
    • decryptX448

      public abstract byte[] decryptX448(PublicKey ephemeralKey) throws PGPException
      Perform an X448 agreement to calculate a shared secret.
      Parameters:
      ephemeralKey - the sender's ephemeral X448 public key
      Returns:
      shared secret
      Throws:
      PGPException - if the message cannot be decrypted