License | BSD-style |
---|---|
Maintainer | Carlos Rodriguez-Vega <crodveg@yahoo.es> |
Stability | experimental |
Portability | unknown |
Safe Haskell | None |
Language | Haskell2010 |
Modified-Rabin public-key digital signature algorithm. See algorithm 11.30 in "Handbook of Applied Cryptography" by Alfred J. Menezes et al.
Synopsis
- data PublicKey = PublicKey {
- public_size :: Int
- public_n :: Integer
- data PrivateKey = PrivateKey {}
- generate :: MonadRandom m => Int -> m (PublicKey, PrivateKey)
- sign :: HashAlgorithm hash => PrivateKey -> hash -> ByteString -> Either Error Integer
- verify :: HashAlgorithm hash => PublicKey -> hash -> ByteString -> Integer -> Bool
Documentation
Represent a Modified-Rabin public key.
PublicKey | |
|
Instances
Eq PublicKey # | |
Data PublicKey # | |
Defined in Crypto.PubKey.Rabin.Modified gfoldl :: (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 # toConstr :: PublicKey -> Constr # dataTypeOf :: PublicKey -> DataType # 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 :: forall r r'. (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 # | |
Read PublicKey # | |
Show PublicKey # | |
data PrivateKey #
Represent a Modified-Rabin private key.
Instances
generate :: MonadRandom m => Int -> m (PublicKey, PrivateKey) #
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.
:: HashAlgorithm hash | |
=> PrivateKey | private key |
-> hash | hash function |
-> ByteString | message to sign |
-> Either Error Integer |
Sign message using hash algorithm and private key.
:: HashAlgorithm hash | |
=> PublicKey | public key |
-> hash | hash function |
-> ByteString | message |
-> Integer | signature |
-> Bool |
Verify signature using hash algorithm and public key.