License | MIT |
---|---|
Maintainer | Jean-Pierre Rupp <root@haskoin.com> |
Stability | experimental |
Portability | POSIX |
Safe Haskell | None |
Language | Haskell2010 |
Crytpographic functions from Bitcoin’s secp256k1 library.
- data Msg
- msg :: ByteString -> Maybe Msg
- getMsg :: Msg -> ByteString
- data SecKey
- secKey :: ByteString -> Maybe SecKey
- getSecKey :: SecKey -> ByteString
- derivePubKey :: SecKey -> PubKey
- data PubKey
- importPubKey :: ByteString -> Maybe PubKey
- exportPubKey :: Bool -> PubKey -> ByteString
- data Sig
- signMsg :: SecKey -> Msg -> Sig
- verifySig :: PubKey -> Sig -> Msg -> Bool
- normalizeSig :: Sig -> (Sig, Bool)
- importSig :: ByteString -> Maybe Sig
- laxImportSig :: ByteString -> Maybe Sig
- exportSig :: Sig -> ByteString
- data CompactSig = CompactSig {}
- exportCompactSig :: Sig -> CompactSig
- importCompactSig :: CompactSig -> Maybe Sig
- data Tweak
- tweak :: ByteString -> Maybe Tweak
- getTweak :: Tweak -> ByteString
- tweakAddSecKey :: SecKey -> Tweak -> Maybe SecKey
- tweakMulSecKey :: SecKey -> Tweak -> Maybe SecKey
- tweakAddPubKey :: PubKey -> Tweak -> Maybe PubKey
- tweakMulPubKey :: PubKey -> Tweak -> Maybe PubKey
- combinePubKeys :: [PubKey] -> Maybe PubKey
Messages
msg :: ByteString -> Maybe Msg Source
Import 32-byte ByteString
as Msg
.
getMsg :: Msg -> ByteString Source
Get 32-byte message.
Secret Keys
secKey :: ByteString -> Maybe SecKey Source
Import 32-byte ByteString
as SecKey
.
getSecKey :: SecKey -> ByteString Source
Get 32-byte secret key.
derivePubKey :: SecKey -> PubKey Source
Public Keys
importPubKey :: ByteString -> Maybe PubKey Source
Import DER-encoded public key.
exportPubKey :: Bool -> PubKey -> ByteString Source
Encode public key as DER. First argument True
for compressed output.
Signatures
verifySig :: PubKey -> Sig -> Msg -> Bool Source
Verify message signature. True
means that the signature is correct.
normalizeSig :: Sig -> (Sig, Bool) Source
DER
importSig :: ByteString -> Maybe Sig Source
Import DER-encoded signature.
laxImportSig :: ByteString -> Maybe Sig Source
Relaxed DER parsing. Allows certain DER errors and violations.
exportSig :: Sig -> ByteString Source
Encode signature as strict DER.
Compact
data CompactSig Source
exportCompactSig :: Sig -> CompactSig Source
importCompactSig :: CompactSig -> Maybe Sig Source
Addition & Multiplication
tweak :: ByteString -> Maybe Tweak Source
32-Byte ByteString
as Tweak
.
getTweak :: Tweak -> ByteString Source
Get 32-byte tweak.
tweakAddPubKey :: PubKey -> Tweak -> Maybe PubKey Source
Add tweak to public key. Tweak is multiplied first by G to obtain a point.
tweakMulPubKey :: PubKey -> Tweak -> Maybe PubKey Source
Multiply public key by tweak. Tweak is multiplied first by G to obtain a point.
combinePubKeys :: [PubKey] -> Maybe PubKey Source
Add multiple public keys together.