hOpenPGP-3.0.1.1: native Haskell implementation of OpenPGP (RFC9580)
Safe HaskellNone
LanguageHaskell2010

Data.Conduit.OpenPGP.Decrypt

Synopsis

Documentation

data DecryptKeyResolution Source #

Build a stateful PKESKResolver that iterates over a pre-populated candidate list. The returned resolver yields candidates in order and returns ResolveExhausted once the list is depleted. | How to resolve secret keys for PKESK-encrypted messages.

Constructors

DecryptWithoutPKESK

Do not attempt PKESK decryption; fall through to manual session-key input via the passphrase callback instead.

DecryptWithKeyring SecretKeyring

Resolve secret keys from a SecretKeyring. Only unencrypted secret keys (not passphrase-protected) are used. For passphrase-protected keys, use DecryptWithKeyringAndPassphrase.

DecryptWithKeyringAndPassphrase SecretKeyring (SomePKPayload -> IO (Maybe ByteString))

Resolve secret keys from a SecretKeyring, unlocking passphrase- protected keys using the provided callback. The callback receives the public key payload and returns the passphrase, or Nothing to skip.

DecryptWithUnwrapCandidatesCallback (KeyIdentifier -> PubKeyAlgorithm -> IO [PKESKRecipientKey])

Preferred callback form for non-keyring key material. The callback receives a typed key identifier (8-octet key ID, fingerprint, or wildcard) plus the packet public-key algorithm, then returns all matching candidates in priority order. hOpenPGP iterates candidates deterministically without re-calling the callback for each retry.

data PKESKRecipientKey Source #

Constructors

PKESKRecipientKey 

Fields

data DecryptOutcome Source #

Outcome of a checked decrypt conduit run.

Use conduitDecrypt to obtain this value. Because .| preserves the rightmost conduit's return value, callers who also need the decrypted packet stream should use fuseBoth:

(outcome, pkts) <- runConduit $ source .| fuseBoth (conduitDecrypt opts) CL.consume

Constructors

DecryptClean

The integrity-terminating marker (MDC or SEIPD v2 final AEAD tag) was seen and no further packets arrived. The message was well-formed end-to-end.

DecryptTruncated

The input stream ended before any integrity-terminating marker was seen. The ciphertext was incomplete.

DecryptTrailingData

An integrity-terminating marker was seen, but additional packets followed it. Only possible with lenientDecryptPolicy (strict policy reports DecryptMalformedStructure instead). The trailing packets were forwarded downstream unchanged.

DecryptMalformedStructure String

A structural packet-sequencing violation was detected. The String describes the specific violation:

  • PKESK version does not match the SEIPD version (e.g. a v6 PKESK preceding a SEIPDv1 payload, or a v4 SKESK preceding a SEIPDv2 payload).
  • ESK packets arrived in the wrong order relative to the encrypted data packet (e.g. a literal-data packet appeared between a PKESK and the SEIPD it was intended to protect).
  • A packet arrived after the message integrity boundary (trailing data). Under defaultDecryptPolicy this is reported here; under lenientDecryptPolicy it is reported as DecryptTrailingData instead.