cryptonite-0.29: Cryptography Primitives sink
LicenseBSD-style
MaintainerVincent Hanquez <vincent@snarc.org>
Stabilityexperimental
PortabilityGood
Safe HaskellNone
LanguageHaskell2010

Crypto.PubKey.RSA.OAEP

Description

Synopsis

Documentation

data OAEPParams hash seed output #

Parameters for OAEP encryption/decryption

Constructors

OAEPParams 

Fields

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

Default Params with a specified hash function

OAEP encryption

encryptWithSeed #

Arguments

:: HashAlgorithm hash 
=> ByteString

Seed

-> OAEPParams hash ByteString ByteString

OAEP params to use for encryption

-> PublicKey

Public key.

-> ByteString

Message to encrypt

-> Either Error ByteString 

Encrypt a message using OAEP with a predefined seed.

encrypt #

Arguments

:: (HashAlgorithm hash, MonadRandom m) 
=> OAEPParams hash ByteString ByteString

OAEP params to use for encryption.

-> PublicKey

Public key.

-> ByteString

Message to encrypt

-> m (Either Error ByteString) 

Encrypt a message using OAEP

OAEP decryption

decrypt #

Arguments

:: HashAlgorithm hash 
=> Maybe Blinder

Optional blinder

-> OAEPParams hash ByteString ByteString

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

decryptSafer #

Arguments

:: (HashAlgorithm hash, MonadRandom m) 
=> OAEPParams hash ByteString ByteString

OAEP params to use for decryption

-> PrivateKey

Private key

-> ByteString

Cipher text

-> m (Either Error ByteString) 

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