Safe Haskell | None |
---|---|
Language | Haskell98 |
Elliptic Curve Digital Signatura Algorithm (DSA), with the secp256k1 curve.
References:
- data Signature = Signature {
- _signatureR :: !Integer
- _signatureS :: !Integer
- newtype SignBits = SignBits Word8
- hashInteger :: Hash256 -> Integer
- signMessageHashIO :: PrivKey -> Hash256 -> IO (SignBits, Signature)
- signMessageHash :: RandomGen gen => PrivKey -> Hash256 -> gen -> ((SignBits, Signature), gen)
- signMessageHashRFC6979 :: PrivKey -> Hash256 -> (SignBits, Signature)
- verifySignatureWithHash :: PubKey -> Signature -> Hash256 -> Bool
- recoverPubKeyFromHash :: (PubKeyFormat, SignBits, Signature) -> Hash256 -> Maybe PubKey
- ectest1 :: IO ()
Documentation
An ECDSA signature
Signature | |
|
Two extra bits of information, used to recover the public key from the signatures.
signing, verifying, recovering
hashInteger :: Hash256 -> Integer Source #
The integer representation of a hash. We should take the left log2[secp256k1_n] bits, but both the hash and n has 256 bits, so we take the whole hash.
signMessageHashIO :: PrivKey -> Hash256 -> IO (SignBits, Signature) Source #
Signs the hash of a message (using the defaul random source - this probably shouldn't be used!)
signMessageHash :: RandomGen gen => PrivKey -> Hash256 -> gen -> ((SignBits, Signature), gen) Source #
Signs the hash of a message (given a random number source)
signMessageHashRFC6979 :: PrivKey -> Hash256 -> (SignBits, Signature) Source #
Deterministic signature as specified by RFC 6979: http://tools.ietf.org/html/rfc6979, in particular section 3.2
recoverPubKeyFromHash :: (PubKeyFormat, SignBits, Signature) -> Hash256 -> Maybe PubKey Source #
Recovers the public key from the (extended) signature and the hash of the message.
On the Word8 paramter: Bit 0 encodes whether the curve point R (which has x coordinate r from the signature) has even or odd y coordinate; and bit 1 encodes how to reconstruct the x coordinate from r.