| Portability | Good |
|---|---|
| Stability | experimental |
| Maintainer | Vincent Hanquez <vincent@snarc.org> |
| Safe Haskell | None |
Crypto.PubKey.DSA
Description
An implementation of the Digital Signature Algorithm (DSA)
- data Params = Params {}
- data Signature = Signature {}
- data PublicKey = PublicKey {}
- data PrivateKey = PrivateKey {}
- generatePrivate :: CPRG g => g -> Params -> (PrivateNumber, g)
- calculatePublic :: Params -> PrivateNumber -> PublicNumber
- sign :: CPRG g => g -> PrivateKey -> HashFunction -> ByteString -> (Signature, g)
- signWith :: Integer -> PrivateKey -> HashFunction -> ByteString -> Maybe Signature
- verify :: HashFunction -> PublicKey -> Signature -> ByteString -> Bool
Documentation
data Params
Represent DSA parameters namely P, G, and Q.
data Signature
Represent a DSA signature namely R and S.
data PublicKey
Represent a DSA public key.
Constructors
| PublicKey | |
Fields
| |
data PrivateKey
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
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 -> PublicNumberSource
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.
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 -> BoolSource
verify a bytestring using the public key.