crypton-1.0.1: Cryptography Primitives sink

License | BSD-style
Maintainer | Carlos Rodriguez-Vega <crodveg@yahoo.es>
Stability | experimental
Portability | unknown
Safe Haskell | None
Language | Haskell2010

Crypto.PubKey.Rabin.OAEP

Description

OAEP padding scheme. See http://en.wikipedia.org/wiki/Optimal_asymmetric_encryption_padding.

Synopsis

- data OAEPParams hash seed output = OAEPParams {
  - oaepHash :: hash
  - oaepMaskGenAlg :: MaskGenAlgorithm seed output
  - oaepLabel :: Maybe ByteString
  }
- defaultOAEPParams :: (ByteArrayAccess seed, ByteArray output, HashAlgorithm hash) => hash -> OAEPParams hash seed output
- pad :: HashAlgorithm hash => ByteString -> OAEPParams hash ByteString ByteString -> Int -> ByteString -> Either Error ByteString
- unpad :: HashAlgorithm hash => OAEPParams hash ByteString ByteString -> Int -> ByteString -> Either Error ByteString

# Documentation

data OAEPParams hash seed output #

Parameters for OAEP padding.

Constructors

OAEPParams |

Fields

- oaepHash :: hash

  hash function to use

- oaepMaskGenAlg :: MaskGenAlgorithm seed output

  mask Gen algorithm to use

- oaepLabel :: Maybe ByteString

  optional label prepended to message

defaultOAEPParams :: (ByteArrayAccess seed, ByteArray output, HashAlgorithm hash) => hash -> OAEPParams hash seed output #

Default Params with a specified hash function.

pad #

Arguments

:: HashAlgorithm hash |
=> ByteString | Seed
-> OAEPParams hash ByteString ByteString | OAEP params to use
-> Int | size of public key in bytes
-> ByteString | Message pad
-> Either Error ByteString |

Pad a message using OAEP.

unpad #

Arguments

:: HashAlgorithm hash |
=> OAEPParams hash ByteString ByteString | OAEP params to use
-> Int | size of public key in bytes
-> ByteString | encoded message (not encrypted)
-> Either Error ByteString |

Un-pad a OAEP encoded message.