crypto-pubkey-0.1.1: Public Key cryptography

Safe HaskellNone

Crypto.PubKey.RSA.OAEP

Contents

Synopsis

Documentation

data OAEPParams Source

Parameters for OAEP encryption/decryption

Constructors

OAEPParams 

Fields

oaepHash :: HashFunction

Hash function to use.

oaepMaskGenAlg :: MaskGenAlgorithm

Mask Gen algorithm to use.

oaepLabel :: Maybe ByteString

Optional label prepended to message.

defaultOAEPParams :: HashFunction -> OAEPParamsSource

Default Params with a specified hash function

OAEP encryption

encryptSource

Arguments

:: CPRG g 
=> g

random number generator.

-> OAEPParams

OAEP params to use for encryption.

-> PublicKey

Public key.

-> ByteString

Message to encrypt

-> (Either Error ByteString, g) 

Encrypt a message using OAEP

OAEP decryption

decryptSource

Arguments

:: Maybe Blinder

Optional blinder

-> OAEPParams

OAEP params to use for decryption

-> PrivateKey

Private key

-> ByteString

Cipher text

-> Either Error ByteString 

Decrypt a ciphertext using OAEP

When the signature is not in a context where an attacker could gain information from the timing of the operation, the blinder can be set to None.

If unsure always set a blinder or use decryptSafer

decryptSaferSource

Arguments

:: CPRG g 
=> g

random number generator

-> OAEPParams

OAEP params to use for decryption

-> PrivateKey

Private key

-> ByteString

Cipher text

-> (Either Error ByteString, g) 

Decrypt a ciphertext using OAEP and by automatically generating a blinder.