 | cryptocipher-0.2: Symmetrical Block and Stream Ciphers | Contents | Index |
|
| Crypto.Cipher.RSA | | Portability | Good | | Stability | experimental | | Maintainer | Vincent Hanquez <vincent@snarc.org> |
|
|
|
| Description |
|
|
| Synopsis |
|
|
|
| Documentation |
|
| data Error |
| Constructors | | MessageSizeIncorrect | the message to decrypt is not of the correct size (need to be == private_size)
| | MessageTooLong | the message to encrypt is too long (>= private_size - 11)
| | MessageNotRecognized | the message decrypted doesn't have a PKCS15 structure (0 2 .. 0 msg)
| | RandomGenFailure GenError | the random generator returns an error. give the opportunity to reseed for example.
| | KeyInternalError | the whole key is probably not valid, since the message is bigger than the key size
|
| Instances | |
|
|
| data PublicKey |
| Constructors | | PublicKey | | | public_sz :: Int | size of key in bytes
| | public_n :: Integer | public p*q
| | public_e :: Integer | public exponant e
|
|
| Instances | |
|
|
| data PrivateKey |
| Constructors | | PrivateKey | | | private_sz :: Int | size of key in bytes
| | private_n :: Integer | private p*q
| | private_d :: Integer | private exponant d
| | private_p :: Integer | p prime number
| | private_q :: Integer | q prime number
| | private_dP :: Integer | d mod (p-1)
| | private_dQ :: Integer | d mod (q-1)
| | private_qinv :: Integer | q^(-1) mod p
|
|
| Instances | |
|
|
| decrypt :: PrivateKey -> ByteString -> Either Error ByteString |
| decrypt message using the private key.
|
|
| encrypt :: CryptoRandomGen g => g -> PublicKey -> ByteString -> Either Error (ByteString, g) |
| encrypt a bytestring using the public key and a CryptoRandomGen random generator.
- the message need to be smaller than the key size - 11
|
|
| Produced by Haddock version 2.7.2 |