cardano-crypto-class-2.3.0.0: Type classes abstracting over cryptography primitives for Cardano
Safe HaskellSafe-Inferred
LanguageHaskell2010

Cardano.Crypto.DSIGN.Class

Description

Abstract digital signatures.

Synopsis

DSIGN algorithm class

class (Typeable v, Show (VerKeyDSIGN v), Eq (VerKeyDSIGN v), Show (SignKeyDSIGN v), Show (SigDSIGN v), Eq (SigDSIGN v), NoThunks (SigDSIGN v), NoThunks (SignKeyDSIGN v), NoThunks (VerKeyDSIGN v), KnownNat (SeedSizeDSIGN v), KnownNat (SignKeySizeDSIGN v), KnownNat (VerKeySizeDSIGN v), KnownNat (SigSizeDSIGN v)) ⇒ DSIGNAlgorithm v where Source #

The pure DSIGN API, which supports the full set of DSIGN operations, but does not allow for secure forgetting of private keys.

Associated Types

type SeedSizeDSIGN v ∷ Nat Source #

type SignKeySizeDSIGN v ∷ Nat Source #

type VerKeySizeDSIGN v ∷ Nat Source #

type SigSizeDSIGN v ∷ Nat Source #

type SizeSignKeyDSIGN v ∷ Nat Source #

Deprecated: In favor of SignKeySizeDSIGN

type SizeVerKeyDSIGN v ∷ Nat Source #

Deprecated: In favor of VerKeySizeDSIGN

type SizeSigDSIGN v ∷ Nat Source #

Deprecated: In favor of SigSizeDSIGN

data VerKeyDSIGN v ∷ Type Source #

data SignKeyDSIGN v ∷ Type Source #

data SigDSIGN v ∷ Type Source #

type ContextDSIGN v ∷ Type Source #

Context required to run the DSIGN algorithm

Unit by default (no context required)

type ContextDSIGN v = ()

type Signable v ∷ TypeConstraint Source #

type Signable v = Empty

type KeyGenContextDSIGN v ∷ Type Source #

type KeyGenContextDSIGN v = ()

Instances

Instances details
DSIGNAlgorithm EcdsaSecp256k1DSIGN Source # 
Instance details

Defined in Cardano.Crypto.DSIGN.EcdsaSecp256k1

DSIGNAlgorithm Ed25519DSIGN Source # 
Instance details

Defined in Cardano.Crypto.DSIGN.Ed25519

DSIGNAlgorithm Ed448DSIGN Source # 
Instance details

Defined in Cardano.Crypto.DSIGN.Ed448

DSIGNAlgorithm MockDSIGN Source # 
Instance details

Defined in Cardano.Crypto.DSIGN.Mock

DSIGNAlgorithm NeverDSIGN Source # 
Instance details

Defined in Cardano.Crypto.DSIGN.NeverUsed

DSIGNAlgorithm SchnorrSecp256k1DSIGN Source # 
Instance details

Defined in Cardano.Crypto.DSIGN.SchnorrSecp256k1

BLS12381CurveConstraints curve ⇒ DSIGNAlgorithm (BLS12381DSIGN curve) Source # 
Instance details

Defined in Cardano.Crypto.DSIGN.BLS12381

data Seed Source #

A seed contains a finite number of bytes, and is used for seeding cryptographic algorithms including key generation.

This is not itself a PRNG, but can be used to seed a PRNG.

Instances

Instances details
Monoid Seed Source # 
Instance details

Defined in Cardano.Crypto.Seed

Methods

memptySeed #

mappendSeedSeedSeed #

mconcat ∷ [Seed] → Seed #

Semigroup Seed Source # 
Instance details

Defined in Cardano.Crypto.Seed

Methods

(<>)SeedSeedSeed #

sconcatNonEmpty SeedSeed #

stimesIntegral b ⇒ b → SeedSeed #

Show Seed Source # 
Instance details

Defined in Cardano.Crypto.Seed

Methods

showsPrecIntSeedShowS #

showSeedString #

showList ∷ [Seed] → ShowS #

NFData Seed Source # 
Instance details

Defined in Cardano.Crypto.Seed

Methods

rnfSeed → () #

Eq Seed Source # 
Instance details

Defined in Cardano.Crypto.Seed

Methods

(==)SeedSeedBool #

(/=)SeedSeedBool #

NoThunks Seed Source # 
Instance details

Defined in Cardano.Crypto.Seed

seedSizeDSIGN ∷ ∀ v proxy. DSIGNAlgorithm v ⇒ proxy v → Word Source #

The upper bound on the Seed size needed by genKeyDSIGN

verKeySizeDSIGN ∷ ∀ v proxy. DSIGNAlgorithm v ⇒ proxy v → Word Source #

signKeySizeDSIGN ∷ ∀ v proxy. DSIGNAlgorithm v ⇒ proxy v → Word Source #

sigSizeDSIGN ∷ ∀ v proxy. DSIGNAlgorithm v ⇒ proxy v → Word Source #

Deprecated size synonyms

sizeVerKeyDSIGN ∷ ∀ v proxy. DSIGNAlgorithm v ⇒ proxy v → Word Source #

Deprecated: In favor of verKeySizeDSIGN

sizeSignKeyDSIGN ∷ ∀ v proxy. DSIGNAlgorithm v ⇒ proxy v → Word Source #

Deprecated: In favor of signKeySizeDSIGN

sizeSigDSIGN ∷ ∀ v proxy. DSIGNAlgorithm v ⇒ proxy v → Word Source #

Deprecated: In favor of sigSizeDSIGN

MLocked DSIGN algorithm class

class (DSIGNAlgorithm v, NoThunks (SignKeyDSIGNM v)) ⇒ DSIGNMAlgorithm v where Source #

Associated Types

data SignKeyDSIGNM v ∷ Type Source #

SignedDSIGN wrapper

newtype SignedDSIGN v a Source #

Constructors

SignedDSIGN (SigDSIGN v) 

Instances

Instances details
Generic (SignedDSIGN v a) Source # 
Instance details

Defined in Cardano.Crypto.DSIGN.Class

Associated Types

type Rep (SignedDSIGN v a) ∷ TypeType #

Methods

fromSignedDSIGN v a → Rep (SignedDSIGN v a) x #

toRep (SignedDSIGN v a) x → SignedDSIGN v a #

DSIGNAlgorithm v ⇒ Show (SignedDSIGN v a) Source # 
Instance details

Defined in Cardano.Crypto.DSIGN.Class

Methods

showsPrecIntSignedDSIGN v a → ShowS #

showSignedDSIGN v a → String #

showList ∷ [SignedDSIGN v a] → ShowS #

NFData (SigDSIGN v) ⇒ NFData (SignedDSIGN v a) Source # 
Instance details

Defined in Cardano.Crypto.DSIGN.Class

Methods

rnfSignedDSIGN v a → () #

DSIGNAlgorithm v ⇒ Eq (SignedDSIGN v a) Source # 
Instance details

Defined in Cardano.Crypto.DSIGN.Class

Methods

(==)SignedDSIGN v a → SignedDSIGN v a → Bool #

(/=)SignedDSIGN v a → SignedDSIGN v a → Bool #

DSIGNAlgorithm v ⇒ NoThunks (SignedDSIGN v a) Source # 
Instance details

Defined in Cardano.Crypto.DSIGN.Class

type Rep (SignedDSIGN v a) Source # 
Instance details

Defined in Cardano.Crypto.DSIGN.Class

type Rep (SignedDSIGN v a) = D1 ('MetaData "SignedDSIGN" "Cardano.Crypto.DSIGN.Class" "cardano-crypto-class-2.3.0.0-inplace" 'True) (C1 ('MetaCons "SignedDSIGN" 'PrefixI 'False) (S1 ('MetaSel ('NothingMaybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (SigDSIGN v))))

CBOR encoding and decoding

Encoded Size expresssions

encodedVerKeyDSIGNSizeExpr ∷ ∀ v. DSIGNAlgorithm v ⇒ Proxy (VerKeyDSIGN v) → Size Source #

Size expression for VerKeyDSIGN which is using verKeySizeDSIGN encoded as Size.

encodedSignKeyDSIGNSizeExpr ∷ ∀ v. DSIGNAlgorithm v ⇒ Proxy (SignKeyDSIGN v) → Size Source #

Size expression for SignKeyDSIGN which is using signKeySizeDSIGN encoded as Size.

encodedSigDSIGNSizeExpr ∷ ∀ v. DSIGNAlgorithm v ⇒ Proxy (SigDSIGN v) → Size Source #

Size expression for SigDSIGN which is using sigSizeDSIGN encoded as Size.

Helper

failSizeCheckMonadFail m ⇒ StringStringByteStringWord → m a Source #

Helper function that always fails, but it provides a different message whenever expected size does not match.

Unsound CBOR encoding and decoding of MLocked DSIGN keys

class DSIGNMAlgorithm v ⇒ UnsoundDSIGNMAlgorithm v where Source #

Unsound operations on DSIGNM sign keys. These operations violate secure forgetting constraints by leaking secrets to unprotected memory. Consider using the DirectSerialise / DirectDeserialise APIs instead.

Aggregatable DSIGN algorithms with Proof of Possession

class (DSIGNAlgorithm v, Show (PossessionProofDSIGN v), Eq (PossessionProofDSIGN v), NoThunks (PossessionProofDSIGN v), KnownNat (PossessionProofSizeDSIGN v)) ⇒ DSIGNAggregatable v where Source #

Extension of the DSIGNAlgorithm to allow for aggregatable digital signature schemes that support Proof of Possession (PoP) of signing keys. Such schemes enable the aggregation of multiple signatures and verification keys into a single signature and verification key, respectively, while ensuring that each verification key is associated with a valid signing key through the use of Proofs of Possession. The latter is against rogue-key attacks.

Examples of aggregatable signatures schemes are the BLS signature scheme and the Pixel scheme.

Associated Types

type PossessionProofSizeDSIGN v ∷ Nat Source #

data PossessionProofDSIGN v ∷ Type Source #

Methods

uncheckedAggregateVerKeysDSIGNHasCallStack ⇒ [VerKeyDSIGN v] → Either String (VerKeyDSIGN v) Source #

Aggregate multiple verification keys into a single verification key without requiring their corresponding Proofs of Possession. This function is unsafe and should only be used when verification keys are valid (i.e., their PoPs have been verified through other means). See aggregateVerKeysDSIGN for a function that does this using verifyPossessionProofDSIGN.

aggregateSigsDSIGNHasCallStack ⇒ [SigDSIGN v] → Either String (SigDSIGN v) Source #

Aggregate multiple signatures into a single signature

createPossessionProofDSIGNHasCallStackContextDSIGN v → SignKeyDSIGN v → PossessionProofDSIGN v Source #

Create a PoP from the signing key.

verifyPossessionProofDSIGNHasCallStackContextDSIGN v → VerKeyDSIGN v → PossessionProofDSIGN v → Either String () Source #

Verify that PoP matches the verification key.

rawSerialisePossessionProofDSIGNPossessionProofDSIGN v → ByteString Source #

Serialise a PoP into fixed-size raw bytes.

rawDeserialisePossessionProofDSIGNByteStringMaybe (PossessionProofDSIGN v) Source #

Deserialise a PoP from fixed-size raw bytes.

aggregateVerKeysDSIGN ∷ (HasCallStack, DSIGNAggregatable v) ⇒ ContextDSIGN v → [(VerKeyDSIGN v, PossessionProofDSIGN v)] → Either String (VerKeyDSIGN v) Source #

Aggregate multiple verification keys into a single verification key given their corresponding Proofs of Possession.

Note that the signing context is passed since the PoP might depend on it.

possessionProofSizeDSIGN ∷ ∀ v proxy. DSIGNAggregatable v ⇒ proxy v → Word Source #

decodePossessionProofDSIGN ∷ ∀ v s. DSIGNAggregatable v ⇒ Decoder s (PossessionProofDSIGN v) Source #

Decode a PoP from CBOR.