crypton
LicenseBSD-style
MaintainerCarlos Rodriguez-Vega <crodveg@yahoo.es>
Stabilityexperimental
Portabilityunknown
Safe HaskellNone
LanguageHaskell2010

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. The Jacobi symbols here are taken modulo the public modulus, not the private primes, so what Crypto.PubKey.Rabin.Basic says about that does not apply; the note there about Integer arithmetic does.

Synopsis

Documentation

data PublicKey Source #

Represent a Modified-Rabin public key.

Constructors

PublicKey 

Fields

Instances

Instances details
Eq PublicKey Source # 
Instance details

Defined in Crypto.PubKey.Rabin.Modified

Methods

(==) :: PublicKey -> PublicKey -> Bool

(/=) :: PublicKey -> PublicKey -> Bool

Data PublicKey Source # 
Instance details

Defined in Crypto.PubKey.Rabin.Modified

Methods

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 Source # 
Instance details

Defined in Crypto.PubKey.Rabin.Modified

Methods

readsPrec :: Int -> ReadS PublicKey

readList :: ReadS [PublicKey]

readPrec :: ReadPrec PublicKey

readListPrec :: ReadPrec [PublicKey]

Show PublicKey Source # 
Instance details

Defined in Crypto.PubKey.Rabin.Modified

Methods

showsPrec :: Int -> PublicKey -> ShowS

show :: PublicKey -> String

showList :: [PublicKey] -> ShowS

data PrivateKey Source #

Represent a Modified-Rabin private key.

Constructors

PrivateKey 

Fields

Instances

Instances details
DebugShow PrivateKey Source # 
Instance details

Defined in Crypto.PubKey.Rabin.Modified

Methods

debugShow :: PrivateKey -> String Source #

Eq PrivateKey Source # 
Instance details

Defined in Crypto.PubKey.Rabin.Modified

Methods

(==) :: PrivateKey -> PrivateKey -> Bool

(/=) :: PrivateKey -> PrivateKey -> Bool

Data PrivateKey Source # 
Instance details

Defined in Crypto.PubKey.Rabin.Modified

Methods

gfoldl :: (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

toConstr :: PrivateKey -> Constr

dataTypeOf :: PrivateKey -> DataType

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 :: forall r r'. (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

Read PrivateKey Source # 
Instance details

Defined in Crypto.PubKey.Rabin.Modified

Methods

readsPrec :: Int -> ReadS PrivateKey

readList :: ReadS [PrivateKey]

readPrec :: ReadPrec PrivateKey

readListPrec :: ReadPrec [PrivateKey]

Show PrivateKey Source #

The public part is shown; the secret fields are not. Use debugShow to see them.

Instance details

Defined in Crypto.PubKey.Rabin.Modified

Methods

showsPrec :: Int -> PrivateKey -> ShowS

show :: PrivateKey -> String

showList :: [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.

sign Source #

Arguments

:: HashAlgorithm hash 
=> PrivateKey

private key

-> hash

hash function

-> ByteString

message to sign

-> Either Error Integer 

Sign message using hash algorithm and private key.

signDigest Source #

Arguments

:: HashAlgorithm hash 
=> PrivateKey

private key

-> Digest hash

digest of the message to sign

-> Either Error Integer 

Sign a digest using the private key.

The digest's type says which algorithm made it, so this needs nothing else to name one. sign takes a hash value and never reads it -- it is there to fix the type -- which leaves a caller that is itself polymorphic in the algorithm with nothing to pass.

verify Source #

Arguments

:: HashAlgorithm hash 
=> PublicKey

public key

-> hash

hash function

-> ByteString

message

-> Integer

signature

-> Bool 

Verify signature using hash algorithm and public key.

verifyDigest Source #

Arguments

:: HashAlgorithm hash 
=> PublicKey

public key

-> Digest hash

digest of the message

-> Integer

signature

-> Bool 

Verify a signature over a digest. See signDigest for why a digest rather than a hash value.