Represent a Rabin public key.
Constructors
PublicKeypublic_size :: Intsize of key in bytes
public_n :: Integerpublic p*q
:: a typeCtrl KGHC 9.10.3 · lts/ghc-9.10.x · c74966e · 2026-09-27
Modulecrypton-1.0.4Haskell2010
Rabin cryptosystem for public-key cryptography and digital signature.
Represent a Rabin public key.
PublicKeypublic_size :: Intsize of key in bytes
public_n :: Integerpublic p*q
Represent a Rabin private key.
Eq PrivateKeyDefined in crypton-1.0.4 · Crypto.PubKey.Rabin.BasicData PrivateKeyDefined in crypton-1.0.4 · Crypto.PubKey.Rabin.BasicRead PrivateKeyDefined in crypton-1.0.4 · Crypto.PubKey.Rabin.BasicShow PrivateKeyDefined in crypton-1.0.4 · Crypto.PubKey.Rabin.BasicGenerate a pair of (private, public) key of size in bytes. Primes p and q are both congruent 3 mod 4.
See algorithm 8.11 in "Handbook of Applied Cryptography" by Alfred J. Menezes et al.
encrypt :: (HashAlgorithm hash, MonadRandom m)=> OAEPParams hash ByteString ByteStringOAEP padding parameters
-> PublicKeypublic key
-> ByteStringplaintext
-> m (Either Error ByteString)Encrypt plaintext using public key.
encryptWithSeed :: HashAlgorithm hash=> ByteStringSeed
-> OAEPParams hash ByteString ByteStringOAEP padding
-> PublicKeypublic key
-> ByteStringplaintext
-> Either Error ByteStringEncrypt plaintext using public key an a predefined OAEP seed.
See algorithm 8.11 in "Handbook of Applied Cryptography" by Alfred J. Menezes et al.
decrypt :: HashAlgorithm hash=> OAEPParams hash ByteString ByteStringOAEP padding parameters
-> PrivateKeyprivate key
-> ByteStringciphertext
-> Maybe ByteStringDecrypt ciphertext using private key.
See algorithm 8.12 in "Handbook of Applied Cryptography" by Alfred J. Menezes et al.
sign :: (MonadRandom m, HashAlgorithm hash)=> PrivateKeyprivate key
-> hashhash function
-> ByteStringmessage to sign
-> m (Either Error Signature)Sign message using hash algorithm and private key.
See https://en.wikipedia.org/wiki/Rabin_signature_algorithm.
signWith :: HashAlgorithm hash=> ByteStringpadding
-> PrivateKeyprivate key
-> hashhash function
-> ByteStringmessage to sign
-> Either Error SignatureSign message using padding, hash algorithm and private key.
See https://en.wikipedia.org/wiki/Rabin_signature_algorithm.
verify :: HashAlgorithm hash=> PublicKeyprivate key
-> hashhash function
-> ByteStringmessage
-> Signaturesignature
-> BoolVerify signature using hash algorithm and public key.
See https://en.wikipedia.org/wiki/Rabin_signature_algorithm.