cardano-crypto-wrapper-1.5.1.3: Cryptographic primitives used in Byron era of the Cardano project
Safe HaskellSafe-Inferred
LanguageHaskell2010

Cardano.Crypto.Signing

Synopsis

Documentation

newtype VerificationKey Source #

Wrapper around XPub.

Constructors

VerificationKey 

Instances

Instances details
FromJSON VerificationKey Source # 
Instance details

Defined in Cardano.Crypto.Signing.VerificationKey

ToJSON VerificationKey Source # 
Instance details

Defined in Cardano.Crypto.Signing.VerificationKey

Generic VerificationKey Source # 
Instance details

Defined in Cardano.Crypto.Signing.VerificationKey

Associated Types

type Rep VerificationKeyTypeType Source #

Show VerificationKey Source # 
Instance details

Defined in Cardano.Crypto.Signing.VerificationKey

FromCBOR VerificationKey Source # 
Instance details

Defined in Cardano.Crypto.Signing.VerificationKey

ToCBOR VerificationKey Source # 
Instance details

Defined in Cardano.Crypto.Signing.VerificationKey

DecCBOR VerificationKey Source # 
Instance details

Defined in Cardano.Crypto.Signing.VerificationKey

EncCBOR VerificationKey Source # 
Instance details

Defined in Cardano.Crypto.Signing.VerificationKey

NFData VerificationKey Source # 
Instance details

Defined in Cardano.Crypto.Signing.VerificationKey

Methods

rnfVerificationKey → () Source #

Buildable VerificationKey Source # 
Instance details

Defined in Cardano.Crypto.Signing.VerificationKey

Eq VerificationKey Source # 
Instance details

Defined in Cardano.Crypto.Signing.VerificationKey

Ord VerificationKey Source # 
Instance details

Defined in Cardano.Crypto.Signing.VerificationKey

NoThunks 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

Monad m ⇒ ToJSON 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.5.1.3-inplace" 'True) (C1 ('MetaCons "VerificationKey" 'PrefixI 'True) (S1 ('MetaSel ('Just "unVerificationKey") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 XPub)))

formatFullVerificationKeyVerificationKeyBuilder Source #

Builder for VerificationKey to show it in base64 encoded form.

fullVerificationKeyFFormat r (VerificationKey → r) Source #

Formatter for VerificationKey to show it in base64.

fullVerificationKeyHexFFormat r (VerificationKey → r) Source #

Formatter for VerificationKey to show it in hex.

shortVerificationKeyHexFFormat r (VerificationKey → r) Source #

Formatter for VerificationKey to show it in hex, but only first 8 chars.

parseFullVerificationKeyTextEither 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
Generic SignTag Source # 
Instance details

Defined in Cardano.Crypto.Signing.Tag

Associated Types

type Rep SignTagTypeType Source #

Methods

fromSignTagRep SignTag x Source #

toRep SignTag x → SignTag Source #

Show SignTag Source # 
Instance details

Defined in Cardano.Crypto.Signing.Tag

Buildable SignTag Source # 
Instance details

Defined in Cardano.Crypto.Signing.Tag

Methods

buildSignTagBuilder Source #

Eq SignTag Source # 
Instance details

Defined in Cardano.Crypto.Signing.Tag

Methods

(==)SignTagSignTagBool Source #

(/=)SignTagSignTagBool Source #

Ord SignTag Source # 
Instance details

Defined in Cardano.Crypto.Signing.Tag

type Rep SignTag Source # 
Instance details

Defined in Cardano.Crypto.Signing.Tag

type Rep SignTag = D1 ('MetaData "SignTag" "Cardano.Crypto.Signing.Tag" "cardano-crypto-wrapper-1.5.1.3-inplace" 'False) (((C1 ('MetaCons "SignForTestingOnly" 'PrefixI 'False) (U1TypeType) :+: C1 ('MetaCons "SignTx" 'PrefixI 'False) (U1TypeType)) :+: (C1 ('MetaCons "SignRedeemTx" 'PrefixI 'False) (U1TypeType) :+: C1 ('MetaCons "SignVssCert" 'PrefixI 'False) (U1TypeType))) :+: ((C1 ('MetaCons "SignUSProposal" 'PrefixI 'False) (U1TypeType) :+: C1 ('MetaCons "SignCommitment" 'PrefixI 'False) (U1TypeType)) :+: (C1 ('MetaCons "SignUSVote" 'PrefixI 'False) (U1TypeType) :+: (C1 ('MetaCons "SignBlock" 'PrefixI 'False) (S1 ('MetaSel ('NothingMaybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 VerificationKey)) :+: C1 ('MetaCons "SignCertificate" 'PrefixI 'False) (U1TypeType)))))

signTagProtocolMagicIdSignTagByteString Source #

Get magic bytes corresponding to a SignTag. Guaranteed to be different (and begin with a different byte) for different tags.

signTagDecodedAnnotated ProtocolMagicId ByteStringSignTagByteString Source #

Get magic bytes corresponding to a SignTag, taking ProtocolMagic bytes from the annotation

newtype SigningKey Source #

Wrapper around XPrv.

Constructors

SigningKey 

Fields

Instances

Instances details
Show SigningKey Source # 
Instance details

Defined in Cardano.Crypto.Signing.SigningKey

FromCBOR SigningKey Source # 
Instance details

Defined in Cardano.Crypto.Signing.SigningKey

ToCBOR SigningKey Source # 
Instance details

Defined in Cardano.Crypto.Signing.SigningKey

Methods

toCBORSigningKeyEncoding Source #

encodedSizeExpr ∷ (∀ t. ToCBOR t ⇒ Proxy t → Size) → Proxy SigningKeySize Source #

encodedListSizeExpr ∷ (∀ t. ToCBOR t ⇒ Proxy t → Size) → Proxy [SigningKey] → Size Source #

DecCBOR SigningKey Source # 
Instance details

Defined in Cardano.Crypto.Signing.SigningKey

EncCBOR SigningKey Source # 
Instance details

Defined in Cardano.Crypto.Signing.SigningKey

Methods

encCBORSigningKeyEncoding Source #

encodedSizeExpr ∷ (∀ t. EncCBOR t ⇒ Proxy t → Size) → Proxy SigningKeySize Source #

encodedListSizeExpr ∷ (∀ t. EncCBOR t ⇒ Proxy t → Size) → Proxy [SigningKey] → Size Source #

NFData SigningKey Source # 
Instance details

Defined in Cardano.Crypto.Signing.SigningKey

Methods

rnfSigningKey → () Source #

Buildable SigningKey Source # 
Instance details

Defined in Cardano.Crypto.Signing.SigningKey

NoThunks SigningKey Source # 
Instance details

Defined in Cardano.Crypto.Signing.SigningKey

toVerificationSigningKeyVerificationKey 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

Constructors

Signature XSignature 

Instances

Instances details
(Typeable x, MonadError SchemaError m) ⇒ FromJSON m (Signature x) Source # 
Instance details

Defined in Cardano.Crypto.Signing.Signature

Methods

fromJSONJSValue → m (Signature x) Source #

Monad m ⇒ ToJSON m (Signature w) Source # 
Instance details

Defined in Cardano.Crypto.Signing.Signature

Methods

toJSONSignature w → m JSValue Source #

FromJSON (Signature w) Source # 
Instance details

Defined in Cardano.Crypto.Signing.Signature

ToJSON (Signature w) 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) ∷ TypeType Source #

Methods

fromSignature a → Rep (Signature a) x Source #

toRep (Signature a) x → Signature a Source #

Show (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

Typeable a ⇒ ToCBOR (Signature a) Source # 
Instance details

Defined in Cardano.Crypto.Signing.Signature

Methods

toCBORSignature a → Encoding Source #

encodedSizeExpr ∷ (∀ t. ToCBOR t ⇒ Proxy t → Size) → Proxy (Signature a) → Size Source #

encodedListSizeExpr ∷ (∀ t. ToCBOR t ⇒ Proxy t → Size) → Proxy [Signature a] → Size Source #

Typeable a ⇒ DecCBOR (Signature a) Source # 
Instance details

Defined in Cardano.Crypto.Signing.Signature

Typeable a ⇒ EncCBOR (Signature a) Source # 
Instance details

Defined in Cardano.Crypto.Signing.Signature

Methods

encCBORSignature a → Encoding Source #

encodedSizeExpr ∷ (∀ t. EncCBOR t ⇒ Proxy t → Size) → Proxy (Signature a) → Size Source #

encodedListSizeExpr ∷ (∀ t. EncCBOR t ⇒ Proxy t → Size) → Proxy [Signature a] → Size Source #

NFData (Signature a) Source # 
Instance details

Defined in Cardano.Crypto.Signing.Signature

Methods

rnfSignature a → () Source #

Buildable (Signature a) Source # 
Instance details

Defined in Cardano.Crypto.Signing.Signature

Methods

buildSignature a → Builder Source #

Eq (Signature a) Source # 
Instance details

Defined in Cardano.Crypto.Signing.Signature

Methods

(==)Signature a → Signature a → Bool Source #

(/=)Signature a → Signature a → Bool Source #

Ord (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.5.1.3-inplace" 'True) (C1 ('MetaCons "Signature" 'PrefixI 'False) (S1 ('MetaSel ('NothingMaybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 XSignature)))

fullSignatureHexFFormat r (Signature a → r) Source #

Formatter for Signature to show it in hex.

parseFullSignatureTextEither SignatureParseError (Signature a) Source #

Parse Signature from base16 encoded string.

Signing

sign Source #

Arguments

EncCBOR a 
ProtocolMagicId 
SignTag

See docs for SignTag

SigningKey 
→ a 
Signature a 

Encode something with EncCBOR and sign it

signEncodedProtocolMagicIdSignTagSigningKeyEncodingSignature a Source #

Like sign but without the EncCBOR constraint

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

verifySignature ∷ (a → Encoding) → ProtocolMagicIdSignTagVerificationKey → a → Signature a → Bool Source #

Verify a signature

keyGenMonadRandom 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.

deterministicKeyGenByteString → (VerificationKey, SigningKey) Source #

Create key pair deterministically from 32 bytes.