| Portability | Good |
|---|---|
| Stability | experimental |
| Maintainer | Vincent Hanquez <vincent@snarc.org> |
Crypto.Cipher.RSA
Description
- data Error
- data PublicKey = PublicKey {}
- data PrivateKey = PrivateKey {}
- decrypt :: PrivateKey -> ByteString -> Either Error ByteString
- encrypt :: CryptoRandomGen g => g -> PublicKey -> ByteString -> Either Error (ByteString, g)
Documentation
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 |
Constructors
| PublicKey | |
data PrivateKey Source
Constructors
| PrivateKey | |
Fields
| |
Instances
decrypt :: PrivateKey -> ByteString -> Either Error ByteStringSource
decrypt message using the private key.
encrypt :: CryptoRandomGen g => g -> PublicKey -> ByteString -> Either Error (ByteString, g)Source
encrypt a bytestring using the public key and a CryptoRandomGen random generator. - the message need to be smaller than the key size - 11