cryptonite-0.27: Cryptography Primitives sink

Crypto.PubKey.Rabin.Modified

Description

Modified-Rabin public-key digital signature algorithm. See algorithm 11.30 in "Handbook of Applied Cryptography" by Alfred J. Menezes et al.

Synopsis

# Documentation

data PublicKey Source #

Represent a Modified-Rabin public key.

Constructors

 PublicKey Fieldspublic_size :: Intsize of key in bytespublic_n :: Integerpublic p*q
Instances
 Source # Instance detailsDefined in Crypto.PubKey.Rabin.Modified Methods Source # Instance detailsDefined in Crypto.PubKey.Rabin.Modified Methodsgfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> PublicKey -> c PublicKey #gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c PublicKey #dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c PublicKey) #dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c PublicKey) #gmapT :: (forall b. Data b => b -> b) -> PublicKey -> PublicKey #gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> PublicKey -> r #gmapQr :: (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> PublicKey -> r #gmapQ :: (forall d. Data d => d -> u) -> PublicKey -> [u] #gmapQi :: Int -> (forall d. Data d => d -> u) -> PublicKey -> u #gmapM :: Monad m => (forall d. Data d => d -> m d) -> PublicKey -> m PublicKey #gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> PublicKey -> m PublicKey #gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> PublicKey -> m PublicKey # Source # Instance detailsDefined in Crypto.PubKey.Rabin.Modified Methods Source # Instance detailsDefined in Crypto.PubKey.Rabin.Modified MethodsshowList :: [PublicKey] -> ShowS #

Represent a Modified-Rabin private key.

Constructors

 PrivateKey Fieldsprivate_pub :: PublicKey private_p :: Integerp prime numberprivate_q :: Integerq prime numberprivate_d :: Integer
Instances
 Source # Instance detailsDefined in Crypto.PubKey.Rabin.Modified Methods Source # Instance detailsDefined in Crypto.PubKey.Rabin.Modified Methodsgfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> PrivateKey -> c PrivateKey #gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c PrivateKey #dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c PrivateKey) #dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c PrivateKey) #gmapT :: (forall b. Data b => b -> b) -> PrivateKey -> PrivateKey #gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> PrivateKey -> r #gmapQr :: (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> PrivateKey -> r #gmapQ :: (forall d. Data d => d -> u) -> PrivateKey -> [u] #gmapQi :: Int -> (forall d. Data d => d -> u) -> PrivateKey -> u #gmapM :: Monad m => (forall d. Data d => d -> m d) -> PrivateKey -> m PrivateKey #gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> PrivateKey -> m PrivateKey #gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> PrivateKey -> m PrivateKey # Source # Instance detailsDefined in Crypto.PubKey.Rabin.Modified Methods Source # Instance detailsDefined in Crypto.PubKey.Rabin.Modified MethodsshowList :: [PrivateKey] -> ShowS #

generate :: MonadRandom m => Int -> m (PublicKey, PrivateKey) Source #

Generate a pair of (private, public) key of size in bytes. Prime p is congruent 3 mod 8 and prime q is congruent 7 mod 8.

Arguments

 :: HashAlgorithm hash => PrivateKey private key -> hash hash function -> ByteString message to sign -> Either Error Integer

Sign message using hash algorithm and private key.

Arguments

 :: HashAlgorithm hash => PublicKey public key -> hash hash function -> ByteString message -> Integer signature -> Bool

Verify signature using hash algorithm and public key.