crypto-pubkey-0.2.8: Public Key cryptography

LicenseBSD-style
MaintainerVincent Hanquez <vincent@snarc.org>
Stabilityexperimental
PortabilityGood
Safe HaskellNone
LanguageHaskell98

Crypto.PubKey.DSA

Contents

Description

An implementation of the Digital Signature Algorithm (DSA)

Synopsis

Documentation

data Params Source #

Represent DSA parameters namely P, G, and Q.

Constructors

Params 

Fields

Instances
Eq Params 
Instance details

Defined in Crypto.Types.PubKey.DSA

Data Params 
Instance details

Defined in Crypto.Types.PubKey.DSA

Methods

gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> Params -> c Params Source #

gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c Params Source #

toConstr :: Params -> Constr Source #

dataTypeOf :: Params -> DataType Source #

dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c Params) Source #

dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Params) Source #

gmapT :: (forall b. Data b => b -> b) -> Params -> Params Source #

gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Params -> r Source #

gmapQr :: (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Params -> r Source #

gmapQ :: (forall d. Data d => d -> u) -> Params -> [u] Source #

gmapQi :: Int -> (forall d. Data d => d -> u) -> Params -> u Source #

gmapM :: Monad m => (forall d. Data d => d -> m d) -> Params -> m Params Source #

gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> Params -> m Params Source #

gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> Params -> m Params Source #

Read Params 
Instance details

Defined in Crypto.Types.PubKey.DSA

Show Params 
Instance details

Defined in Crypto.Types.PubKey.DSA

ASN1Object Params 
Instance details

Defined in Crypto.Types.PubKey.DSA

Methods

toASN1 :: Params -> ASN1S

fromASN1 :: [ASN1] -> Either String (Params, [ASN1])

data Signature Source #

Represent a DSA signature namely R and S.

Constructors

Signature 

Fields

Instances
Eq Signature 
Instance details

Defined in Crypto.Types.PubKey.DSA

Data Signature 
Instance details

Defined in Crypto.Types.PubKey.DSA

Methods

gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> Signature -> c Signature Source #

gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c Signature Source #

toConstr :: Signature -> Constr Source #

dataTypeOf :: Signature -> DataType Source #

dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c Signature) Source #

dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Signature) Source #

gmapT :: (forall b. Data b => b -> b) -> Signature -> Signature Source #

gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Signature -> r Source #

gmapQr :: (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Signature -> r Source #

gmapQ :: (forall d. Data d => d -> u) -> Signature -> [u] Source #

gmapQi :: Int -> (forall d. Data d => d -> u) -> Signature -> u Source #

gmapM :: Monad m => (forall d. Data d => d -> m d) -> Signature -> m Signature Source #

gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> Signature -> m Signature Source #

gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> Signature -> m Signature Source #

Read Signature 
Instance details

Defined in Crypto.Types.PubKey.DSA

Show Signature 
Instance details

Defined in Crypto.Types.PubKey.DSA

ASN1Object Signature 
Instance details

Defined in Crypto.Types.PubKey.DSA

Methods

toASN1 :: Signature -> ASN1S

fromASN1 :: [ASN1] -> Either String (Signature, [ASN1])

data PublicKey Source #

Represent a DSA public key.

Constructors

PublicKey 

Fields

Instances
Eq PublicKey 
Instance details

Defined in Crypto.Types.PubKey.DSA

Data PublicKey 
Instance details

Defined in Crypto.Types.PubKey.DSA

Methods

gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> PublicKey -> c PublicKey Source #

gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c PublicKey Source #

toConstr :: PublicKey -> Constr Source #

dataTypeOf :: PublicKey -> DataType Source #

dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c PublicKey) Source #

dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c PublicKey) Source #

gmapT :: (forall b. Data b => b -> b) -> PublicKey -> PublicKey Source #

gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> PublicKey -> r Source #

gmapQr :: (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> PublicKey -> r Source #

gmapQ :: (forall d. Data d => d -> u) -> PublicKey -> [u] Source #

gmapQi :: Int -> (forall d. Data d => d -> u) -> PublicKey -> u Source #

gmapM :: Monad m => (forall d. Data d => d -> m d) -> PublicKey -> m PublicKey Source #

gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> PublicKey -> m PublicKey Source #

gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> PublicKey -> m PublicKey Source #

Read PublicKey 
Instance details

Defined in Crypto.Types.PubKey.DSA

Show PublicKey 
Instance details

Defined in Crypto.Types.PubKey.DSA

ASN1Object PublicKey 
Instance details

Defined in Crypto.Types.PubKey.DSA

Methods

toASN1 :: PublicKey -> ASN1S

fromASN1 :: [ASN1] -> Either String (PublicKey, [ASN1])

data PrivateKey Source #

Represent a DSA private key.

Only x need to be secret. the DSA parameters are publicly shared with the other side.

Constructors

PrivateKey 

Fields

Instances
Eq PrivateKey 
Instance details

Defined in Crypto.Types.PubKey.DSA

Data PrivateKey 
Instance details

Defined in Crypto.Types.PubKey.DSA

Methods

gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> PrivateKey -> c PrivateKey Source #

gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c PrivateKey Source #

toConstr :: PrivateKey -> Constr Source #

dataTypeOf :: PrivateKey -> DataType Source #

dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c PrivateKey) Source #

dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c PrivateKey) Source #

gmapT :: (forall b. Data b => b -> b) -> PrivateKey -> PrivateKey Source #

gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> PrivateKey -> r Source #

gmapQr :: (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> PrivateKey -> r Source #

gmapQ :: (forall d. Data d => d -> u) -> PrivateKey -> [u] Source #

gmapQi :: Int -> (forall d. Data d => d -> u) -> PrivateKey -> u Source #

gmapM :: Monad m => (forall d. Data d => d -> m d) -> PrivateKey -> m PrivateKey Source #

gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> PrivateKey -> m PrivateKey Source #

gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> PrivateKey -> m PrivateKey Source #

Read PrivateKey 
Instance details

Defined in Crypto.Types.PubKey.DSA

Show PrivateKey 
Instance details

Defined in Crypto.Types.PubKey.DSA

generation

generatePrivate :: CPRG g => g -> Params -> (PrivateNumber, g) Source #

generate a private number with no specific property this number is usually called X in DSA text.

calculatePublic :: Params -> PrivateNumber -> PublicNumber Source #

Calculate the public number from the parameters and the private key

signature primitive

sign :: CPRG g => g -> PrivateKey -> HashFunction -> ByteString -> (Signature, g) Source #

sign message using the private key.

signWith Source #

Arguments

:: Integer

k random number

-> PrivateKey

private key

-> HashFunction

hash function

-> ByteString

message to sign

-> Maybe Signature 

sign message using the private key and an explicit k number.

verification primitive

verify :: HashFunction -> PublicKey -> Signature -> ByteString -> Bool Source #

verify a bytestring using the public key.