Copyright | No rights reserved |
---|---|
License | MIT |
Maintainer | jprupp@protonmail.ch |
Stability | experimental |
Portability | POSIX |
Safe Haskell | None |
Language | Haskell2010 |
ECDSA private and public key functions.
Synopsis
- data PubKeyI = PubKeyI {
- pubKeyPoint :: !PubKey
- pubKeyCompressed :: !Bool
- data SecKeyI = SecKeyI {
- secKeyData :: !SecKey
- secKeyCompressed :: !Bool
- exportPubKey :: Bool -> PubKey -> ByteString
- importPubKey :: ByteString -> Maybe PubKey
- wrapPubKey :: Bool -> PubKey -> PubKeyI
- derivePubKeyI :: SecKeyI -> PubKeyI
- wrapSecKey :: Bool -> SecKey -> SecKeyI
- fromMiniKey :: ByteString -> Maybe SecKeyI
- tweakPubKey :: PubKey -> Hash256 -> Maybe PubKey
- tweakSecKey :: SecKey -> Hash256 -> Maybe SecKey
- getSecKey :: SecKey -> ByteString
- secKey :: ByteString -> Maybe SecKey
- fromWif :: Network -> Base58 -> Maybe SecKeyI
- toWif :: Network -> SecKeyI -> Base58
Public & Private Keys
Elliptic curve public key type with expected serialized compression flag.
PubKeyI | |
|
Instances
Eq PubKeyI Source # | |
Read PubKeyI Source # | |
Show PubKeyI Source # | |
IsString PubKeyI Source # | |
Defined in Haskoin.Keys.Common fromString :: String -> PubKeyI # | |
Generic PubKeyI Source # | |
Hashable PubKeyI Source # | |
Defined in Haskoin.Keys.Common | |
ToJSON PubKeyI Source # | |
Defined in Haskoin.Keys.Common | |
FromJSON PubKeyI Source # | |
Binary PubKeyI Source # | |
Serial PubKeyI Source # | |
Defined in Haskoin.Keys.Common | |
Serialize PubKeyI Source # | |
NFData PubKeyI Source # | |
Defined in Haskoin.Keys.Common | |
type Rep PubKeyI Source # | |
Defined in Haskoin.Keys.Common type Rep PubKeyI = D1 ('MetaData "PubKeyI" "Haskoin.Keys.Common" "haskoin-core-0.21.2-inplace" 'False) (C1 ('MetaCons "PubKeyI" 'PrefixI 'True) (S1 ('MetaSel ('Just "pubKeyPoint") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 PubKey) :*: S1 ('MetaSel ('Just "pubKeyCompressed") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 Bool))) |
Elliptic curve private key type with expected public key compression information. Compression information is stored in private key WIF formats and needs to be preserved to generate the correct address from the corresponding public key.
SecKeyI | |
|
Instances
Eq SecKeyI Source # | |
Read SecKeyI Source # | |
Show SecKeyI Source # | |
Generic SecKeyI Source # | |
NFData SecKeyI Source # | |
Defined in Haskoin.Keys.Common | |
type Rep SecKeyI Source # | |
Defined in Haskoin.Keys.Common type Rep SecKeyI = D1 ('MetaData "SecKeyI" "Haskoin.Keys.Common" "haskoin-core-0.21.2-inplace" 'False) (C1 ('MetaCons "SecKeyI" 'PrefixI 'True) (S1 ('MetaSel ('Just "secKeyData") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 SecKey) :*: S1 ('MetaSel ('Just "secKeyCompressed") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 Bool))) |
exportPubKey :: Bool -> PubKey -> ByteString #
Encode public key as DER. First argument True
for compressed output.
importPubKey :: ByteString -> Maybe PubKey #
Import DER-encoded public key.
wrapPubKey :: Bool -> PubKey -> PubKeyI Source #
Wrap a public key from secp256k1 library adding information about compression.
derivePubKeyI :: SecKeyI -> PubKeyI Source #
Derives a public key from a private key. This function will preserve compression flag.
wrapSecKey :: Bool -> SecKey -> SecKeyI Source #
Wrap private key with corresponding public key compression flag.
fromMiniKey :: ByteString -> Maybe SecKeyI Source #
Decode Casascius mini private keys (22 or 30 characters).
getSecKey :: SecKey -> ByteString #
secKey :: ByteString -> Maybe SecKey #
Import 32-byte ByteString
as SecKey
.