HORIZON HASKELLDocslts/ghc-10.0.xfc4e5982026-10-11Search names, modules, packages, or :: a typeCtrl K

GHC 10.0.0.20260917 · lts/ghc-10.0.x · fc4e598 · 2026-10-11

Modulecrypton-2.1.7Haskell2010

Crypto.PubKey.RSA.OAEP

  • 1 type
  • 5 values
  • Packagecrypton-2.1.7
  • Exports6
  • LanguageHaskell2010
  • LicenceBSD-3-Clause AND MIT AND ISC
  • SourceOAEP.hs

OAEP encryption

2 declarations

OAEP decryption

2 declarations
valuedecrypt
  1. :: HashAlgorithm hash
  2. => Maybe Blinder

    Optional blinder

  3. -> OAEPParams hash ByteString ByteString

    OAEP params to use for decryption

  4. -> PrivateKey

    Private key

  5. -> ByteString

    Cipher text

  6. -> Either Error ByteString
#

Decrypt a ciphertext using OAEP

The blinder is optional and Nothing is accepted, but see Blinder for what it covers and when leaving it out is a decision rather than a default. decryptSafer generates one for you.

Following RFC 8017, the ciphertext is rejected unless it is exactly as long as the modulus (section 7.1.2, step 1) and its integer representative is below the modulus (RSADP, section 5.1.2, step 1). The decryption primitive normalises any multiple of the modulus away, so without the second check c + n would decrypt to the same message as c, and a ciphertext would not be unique to its plaintext. Both checks are made on the ciphertext alone, which is public, and report MessageSizeIncorrect.