This module implements RSA encryption with PKCS1 padding.
- encrypt :: RandomGen g => Int -> PublicKey -> g -> ByteString -> ByteString
- decrypt :: Int -> PrivateKey -> ByteString -> Maybe ByteString
- data PublicKey = PublicKey {}
- newtype PrivateKey = PrivateKey (Either PrivateKeySimple PrivateKeyComplex)
- data PrivateKeyComplex = PrivateKeyComplex {}
- data PrivateKeySimple = PrivateKeySimple {}
- os2ip :: (Bits a, Integral a) => ByteString -> a
- i2osp :: (Bits a, Integral a) => Int -> a -> ByteString
Documentation
:: RandomGen g | |
=> Int | Size of the modulus in bytes |
-> PublicKey | The public key to use |
-> g | The padding is random, so we just need this |
-> ByteString | The string to encrypt |
-> ByteString |
Encrypts a ByteString using RSA with PKCS1 padding
:: Int | Size of the modulus in bytes |
-> PrivateKey | The private key to use |
-> ByteString | The string to decrypt |
-> Maybe ByteString |
Decrypts a ByteString using RSA with PKCS1 padding. If the ByteString couldn't be decrypted, nothing is returned.
The public key is contained in a certificate.
os2ip :: (Bits a, Integral a) => ByteString -> aSource
Converts a block of bytes into a number