Parameters for OAEP padding.
Constructors
OAEPParamsoaepHash :: hashhash function to use
oaepMaskGenAlg :: MaskGenAlgorithm seed outputmask Gen algorithm to use
oaepLabel :: Maybe ByteStringoptional label prepended to message
:: a typeCtrl KGHC 10.0.0.20260917 · lts/ghc-10.0.x · aa25b89 · 2026-10-10
Modulecrypton-2.1.7Haskell2010
OAEP padding scheme. See http://en.wikipedia.org/wiki/Optimal_asymmetric_encryption_padding.
Parameters for OAEP padding.
OAEPParamsoaepHash :: hashhash function to use
oaepMaskGenAlg :: MaskGenAlgorithm seed outputmask Gen algorithm to use
oaepLabel :: Maybe ByteStringoptional label prepended to message
Default Params with a specified hash function.
pad :: HashAlgorithm hash=> ByteStringSeed
-> OAEPParams hash ByteString ByteStringOAEP params to use
-> Intsize of public key in bytes
-> ByteStringMessage pad
-> Either Error ByteStringPad a message using OAEP.
unpad :: HashAlgorithm hash=> OAEPParams hash ByteString ByteStringOAEP params to use
-> Intsize of public key in bytes
-> ByteStringencoded message (not encrypted)
-> Either Error ByteStringUn-pad a OAEP encoded message.
The data block is scanned in full rather than up to the 01 octet separating the padding from the message, and the label hash and the leading octet are compared without an early exit, so neither the length of the padding nor where a comparison first differs shows up in how long this takes. This is what Crypto.PubKey.RSA.OAEP does with the same block.
What remains visible is the result itself: whether the block was well formed, and the length of the message when it was. That is the signal Manger's attack needs, so a caller that decrypts attacker-supplied ciphertext must not pass the distinction on.