License | BSD-style |
---|---|
Maintainer | Vincent Hanquez <vincent@snarc.org> |
Stability | experimental |
Portability | Good |
Safe Haskell | None |
Language | Haskell98 |
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.
PublicKey | |
|
data PrivateKey :: *
Represent a DSA private key.
Only x need to be secret. the DSA parameters are publicly shared with the other side.
PrivateKey | |
|
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.
:: 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.