cardano-crypto-wrapper-1.3.0: Cryptographic primitives used in the Cardano project
Safe Haskell None
Language Haskell2010

Cardano.Crypto.Signing

Synopsis

Documentation

newtype VerificationKey Source #

Wrapper around XPub .

Instances

Instances details
Eq VerificationKey Source #
Instance details

Defined in Cardano.Crypto.Signing.VerificationKey

Ord VerificationKey Source #
Instance details

Defined in Cardano.Crypto.Signing.VerificationKey

Show VerificationKey Source #
Instance details

Defined in Cardano.Crypto.Signing.VerificationKey

Generic VerificationKey Source #
Instance details

Defined in Cardano.Crypto.Signing.VerificationKey

ToJSON VerificationKey Source #
Instance details

Defined in Cardano.Crypto.Signing.VerificationKey

FromJSON VerificationKey Source #
Instance details

Defined in Cardano.Crypto.Signing.VerificationKey

ToCBOR VerificationKey Source #
Instance details

Defined in Cardano.Crypto.Signing.VerificationKey

FromCBOR VerificationKey Source #
Instance details

Defined in Cardano.Crypto.Signing.VerificationKey

NFData VerificationKey Source #
Instance details

Defined in Cardano.Crypto.Signing.VerificationKey

Buildable VerificationKey Source #
Instance details

Defined in Cardano.Crypto.Signing.VerificationKey

NoThunks VerificationKey Source #
Instance details

Defined in Cardano.Crypto.Signing.VerificationKey

Monad m => ToJSON m VerificationKey Source #
Instance details

Defined in Cardano.Crypto.Signing.VerificationKey

MonadError SchemaError m => FromJSON m VerificationKey Source #
Instance details

Defined in Cardano.Crypto.Signing.VerificationKey

type Rep VerificationKey Source #
Instance details

Defined in Cardano.Crypto.Signing.VerificationKey

type Rep VerificationKey = D1 (' MetaData "VerificationKey" "Cardano.Crypto.Signing.VerificationKey" "cardano-crypto-wrapper-1.3.0-IHV099LYIDeGXjcjOEcwKY" ' True ) ( C1 (' MetaCons "VerificationKey" ' PrefixI ' True ) ( S1 (' MetaSel (' Just "unVerificationKey") ' NoSourceUnpackedness ' NoSourceStrictness ' DecidedLazy ) ( Rec0 XPub )))

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

data SignTag Source #

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.

Constructors

SignForTestingOnly

Anything (to be used for testing only)

SignTx

Tx: TxSigData

SignRedeemTx

Redeem tx: TxSigData

SignVssCert

Vss certificate: (VssVerificationKey, EpochNumber)

SignUSProposal

Update proposal: UpdateProposalToSign

SignCommitment

Commitment: (EpochNumber, Commitment)

SignUSVote

US proposal vote: (UpId, Bool)

SignBlock VerificationKey

Block header: ToSign

This constructor takes the VerificationKey of the delegation certificate issuer, which is prepended to the signature as part of the sign tag

SignCertificate

Certificate: Certificate

Instances

Instances details
Eq SignTag Source #
Instance details

Defined in Cardano.Crypto.Signing.Tag

Ord SignTag Source #
Instance details

Defined in Cardano.Crypto.Signing.Tag

Show SignTag Source #
Instance details

Defined in Cardano.Crypto.Signing.Tag

Generic SignTag Source #
Instance details

Defined in Cardano.Crypto.Signing.Tag

Buildable SignTag Source #
Instance details

Defined in Cardano.Crypto.Signing.Tag

type Rep SignTag Source #
Instance details

Defined in Cardano.Crypto.Signing.Tag

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

toVerification :: SigningKey -> VerificationKey Source #

Generate a verification key from a signing key. Fast (it just drops some bytes off the signing key).

Signature

newtype Signature a Source #

Wrapper around XSignature

Instances

Instances details
Monad m => ToJSON m ( Signature w) Source #
Instance details

Defined in Cardano.Crypto.Signing.Signature

( Typeable x, MonadError SchemaError m) => FromJSON m ( Signature x) Source #
Instance details

Defined in Cardano.Crypto.Signing.Signature

Eq ( Signature a) Source #
Instance details

Defined in Cardano.Crypto.Signing.Signature

Ord ( Signature a) Source #
Instance details

Defined in Cardano.Crypto.Signing.Signature

Show ( Signature a) Source #
Instance details

Defined in Cardano.Crypto.Signing.Signature

Generic ( Signature a) Source #
Instance details

Defined in Cardano.Crypto.Signing.Signature

Associated Types

type Rep ( Signature a) :: Type -> Type Source #

ToJSON ( Signature w) Source #
Instance details

Defined in Cardano.Crypto.Signing.Signature

FromJSON ( Signature w) Source #
Instance details

Defined in Cardano.Crypto.Signing.Signature

Typeable a => ToCBOR ( Signature a) Source #
Instance details

Defined in Cardano.Crypto.Signing.Signature

Typeable a => FromCBOR ( Signature a) Source #
Instance details

Defined in Cardano.Crypto.Signing.Signature

NFData ( Signature a) Source #
Instance details

Defined in Cardano.Crypto.Signing.Signature

Buildable ( Signature a) Source #
Instance details

Defined in Cardano.Crypto.Signing.Signature

NoThunks ( Signature a) Source #
Instance details

Defined in Cardano.Crypto.Signing.Signature

type Rep ( Signature a) Source #
Instance details

Defined in Cardano.Crypto.Signing.Signature

type Rep ( Signature a) = D1 (' MetaData "Signature" "Cardano.Crypto.Signing.Signature" "cardano-crypto-wrapper-1.3.0-IHV099LYIDeGXjcjOEcwKY" ' True ) ( C1 (' MetaCons "Signature" ' PrefixI ' False ) ( S1 (' MetaSel (' Nothing :: Maybe Symbol ) ' NoSourceUnpackedness ' NoSourceStrictness ' DecidedLazy ) ( Rec0 XSignature )))

fullSignatureHexF :: Format r ( Signature a -> r) Source #

Formatter for Signature to show it in hex.

parseFullSignature :: Text -> Either SignatureParseError ( Signature a) Source #

Parse Signature from base16 encoded string.

Signing

sign Source #

Encode something with ToCBOR and sign it

signRaw Source #

Arguments

:: ProtocolMagicId
-> Maybe SignTag

See docs for SignTag . Unlike in sign , we allow no tag to be provided just in case you need to sign exactly the bytestring you provided.

-> SigningKey
-> ByteString
-> Signature Raw

Sign a Raw bytestring

Verification

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.