Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
Synopsis
- newtype VerificationKey = VerificationKey {}
- formatFullVerificationKey ∷ VerificationKey → Builder
- fullVerificationKeyF ∷ Format r (VerificationKey → r)
- fullVerificationKeyHexF ∷ Format r (VerificationKey → r)
- shortVerificationKeyHexF ∷ Format r (VerificationKey → r)
- parseFullVerificationKey ∷ Text → Either VerificationKeyParseError VerificationKey
- data SignTag
- signTag ∷ ProtocolMagicId → SignTag → ByteString
- signTagDecoded ∷ Annotated ProtocolMagicId ByteString → SignTag → ByteString
- newtype SigningKey = SigningKey {}
- toVerification ∷ SigningKey → VerificationKey
- encCBORXPrv ∷ XPrv → Encoding
- decCBORXPrv ∷ Decoder s XPrv
- toCBORXPrv ∷ XPrv → Encoding
- fromCBORXPrv ∷ Decoder s XPrv
- newtype Signature a = Signature XSignature
- encCBORXSignature ∷ XSignature → Encoding
- decCBORXSignature ∷ Decoder s XSignature
- fullSignatureHexF ∷ Format r (Signature a → r)
- parseFullSignature ∷ Text → Either SignatureParseError (Signature a)
- sign ∷ EncCBOR a ⇒ ProtocolMagicId → SignTag → SigningKey → a → Signature a
- signEncoded ∷ ProtocolMagicId → SignTag → SigningKey → Encoding → Signature a
- signRaw ∷ ProtocolMagicId → Maybe SignTag → SigningKey → ByteString → Signature Raw
- safeSign ∷ EncCBOR a ⇒ ProtocolMagicId → SignTag → SafeSigner → a → Signature a
- safeSignRaw ∷ ProtocolMagicId → Maybe SignTag → SafeSigner → ByteString → Signature Raw
- verifySignature ∷ (a → Encoding) → ProtocolMagicId → SignTag → VerificationKey → a → Signature a → Bool
- verifySignatureDecoded ∷ Decoded t ⇒ Annotated ProtocolMagicId ByteString → SignTag → VerificationKey → t → Signature (BaseType t) → Bool
- verifySignatureRaw ∷ VerificationKey → ByteString → Signature Raw → Bool
- module Cardano.Crypto.Signing.Safe
- module Cardano.Crypto.Signing.Redeem
- keyGen ∷ MonadRandom m ⇒ m (VerificationKey, SigningKey)
- deterministicKeyGen ∷ ByteString → (VerificationKey, SigningKey)
Documentation
newtype VerificationKey Source #
Wrapper around XPub
.
Instances
formatFullVerificationKey ∷ VerificationKey → Builder Source #
Builder
for VerificationKey
to show it in base64 encoded form.
fullVerificationKeyF ∷ Format r (VerificationKey → r) Source #
Formatter for VerificationKey
to show it in base64.
fullVerificationKeyHexF ∷ Format r (VerificationKey → r) Source #
Formatter for VerificationKey
to show it in hex.
shortVerificationKeyHexF ∷ Format r (VerificationKey → r) Source #
Formatter for VerificationKey
to show it in hex, but only first 8 chars.
parseFullVerificationKey ∷ Text → Either VerificationKeyParseError VerificationKey Source #
Parse VerificationKey
from base64 encoded string
To protect against replay attacks (i.e. when an attacker intercepts a signed piece of data and later sends it again), we add a tag to all data that we sign. This ensures that even if some bytestring can be deserialized into two different types of messages (A and B), the attacker can't take message A and send it as message B.
We also automatically add the network tag (protocolMagic
) whenever it
makes sense, to ensure that things intended for testnet won't work for
mainnet.
SignForTestingOnly | Anything (to be used for testing only) |
SignTx | Tx: |
SignRedeemTx | Redeem tx: |
SignVssCert | Vss certificate: |
SignUSProposal | Update proposal: |
SignCommitment | Commitment: |
SignUSVote | US proposal vote: |
SignBlock VerificationKey | Block header: This constructor takes the |
SignCertificate | Certificate: |
Instances
signTag ∷ ProtocolMagicId → SignTag → ByteString Source #
Get magic bytes corresponding to a SignTag
. Guaranteed to be different
(and begin with a different byte) for different tags.
signTagDecoded ∷ Annotated ProtocolMagicId ByteString → SignTag → ByteString Source #
Get magic bytes corresponding to a SignTag
, taking ProtocolMagic
bytes
from the annotation
newtype SigningKey Source #
Wrapper around XPrv
.
Instances
toVerification ∷ SigningKey → VerificationKey Source #
Generate a verification key from a signing key. Fast (it just drops some bytes off the signing key).
encCBORXPrv ∷ XPrv → Encoding Source #
decCBORXPrv ∷ Decoder s XPrv Source #
toCBORXPrv ∷ XPrv → Encoding Source #
fromCBORXPrv ∷ Decoder s XPrv Source #
Signature
Wrapper around XSignature
Instances
parseFullSignature ∷ Text → Either SignatureParseError (Signature a) Source #
Parse Signature
from base16 encoded string.
Signing
∷ EncCBOR a | |
⇒ ProtocolMagicId | |
→ SignTag | See docs for |
→ SigningKey | |
→ a | |
→ Signature a |
Encode something with EncCBOR
and sign it
signEncoded ∷ ProtocolMagicId → SignTag → SigningKey → Encoding → Signature a Source #
∷ ProtocolMagicId | |
→ Maybe SignTag | See docs for |
→ SigningKey | |
→ ByteString | |
→ Signature Raw |
Sign a Raw
bytestring
safeSign ∷ EncCBOR a ⇒ ProtocolMagicId → SignTag → SafeSigner → a → Signature a Source #
Verification
verifySignature ∷ (a → Encoding) → ProtocolMagicId → SignTag → VerificationKey → a → Signature a → Bool Source #
Verify a signature
verifySignatureDecoded ∷ Decoded t ⇒ Annotated ProtocolMagicId ByteString → SignTag → VerificationKey → t → Signature (BaseType t) → Bool Source #
Verify a signature
verifySignatureRaw ∷ VerificationKey → ByteString → Signature Raw → Bool Source #
Verify Raw
signature
module Cardano.Crypto.Signing.Safe
keyGen ∷ MonadRandom m ⇒ m (VerificationKey, SigningKey) Source #
Generate a key pair. It's recommended to run it with runSecureRandom
from Cardano.Crypto.Random because the OpenSSL generator is probably safer
than the default IO generator.
deterministicKeyGen ∷ ByteString → (VerificationKey, SigningKey) Source #
Create key pair deterministically from 32 bytes.