cardano-crypto-class-2.5.1.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), FixedSizeCodec (VerKeyDSIGN v), FixedSizeCodec (SignKeyDSIGN v), FixedSizeCodec (SigDSIGN 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 = ()

Methods

algorithmNameDSIGN ∷ proxy v → String Source #

deriveVerKeyDSIGNSignKeyDSIGN v → VerKeyDSIGN v Source #

hashVerKeyDSIGNHashAlgorithm h ⇒ VerKeyDSIGN v → Hash h (VerKeyDSIGN v) Source #

signDSIGN ∷ (Signable v a, HasCallStack) ⇒ ContextDSIGN v → a → SignKeyDSIGN v → SigDSIGN v Source #

verifyDSIGN ∷ (Signable v a, HasCallStack) ⇒ ContextDSIGN v → VerKeyDSIGN v → a → SigDSIGN v → Either String () Source #

genKeyDSIGNSeedSignKeyDSIGN v Source #

Note that this function may error (with SeedBytesExhausted) if the provided seed is not long enough. Callers should ensure that the seed has is at least seedSizeDSIGN bytes long.

genKeyDSIGNWithContextKeyGenContextDSIGN v → SeedSignKeyDSIGN v Source #

rawSerialiseVerKeyDSIGNVerKeyDSIGN v → ByteString Source #

Deprecated: Use rawEncodeFixedSized instead

rawSerialiseSignKeyDSIGNSignKeyDSIGN v → ByteString Source #

Deprecated: Use rawEncodeFixedSized instead

rawSerialiseSigDSIGNSigDSIGN v → ByteString Source #

Deprecated: Use rawEncodeFixedSized instead

rawDeserialiseVerKeyDSIGNByteStringMaybe (VerKeyDSIGN v) Source #

Deprecated: Use rawDecodeFixedSized instead

rawDeserialiseSignKeyDSIGNByteStringMaybe (SignKeyDSIGN v) Source #

Deprecated: Use rawDecodeFixedSized instead

rawDeserialiseSigDSIGNByteStringMaybe (SigDSIGN v) Source #

Deprecated: Use rawDecodeFixedSized instead

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

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 #

Deprecated: Use fixedSize instead

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

Deprecated: Use fixedSize instead

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

Deprecated: Use fixedSize instead

Deprecated size synonyms

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

Deprecated: In favor of fixedSize

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

Deprecated: In favor of fixedSize

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

Deprecated: In favor of fixedSize

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 #

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

Defined in Cardano.Crypto.DSIGN.Class

Associated Types

type FixedSize (SignedDSIGN v a) ∷ Nat Source #

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.5.1.0-inplace" 'True) (C1 ('MetaCons "SignedDSIGN" 'PrefixI 'False) (S1 ('MetaSel ('NothingMaybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (SigDSIGN v))))
type FixedSize (SignedDSIGN v a) Source # 
Instance details

Defined in Cardano.Crypto.DSIGN.Class

CBOR encoding and decoding

decodeVerKeyDSIGN ∷ ∀ v s. DSIGNAlgorithm v ⇒ Decoder s (VerKeyDSIGN v) Source #

Deprecated: Use decodeFixedSized instead

decodeSignKeyDSIGN ∷ ∀ v s. DSIGNAlgorithm v ⇒ Decoder s (SignKeyDSIGN v) Source #

Deprecated: Use decodeFixedSized instead

encodeSigDSIGNDSIGNAlgorithm v ⇒ SigDSIGN v → Encoding Source #

Deprecated: Use encodeFixedSized instead

decodeSigDSIGN ∷ ∀ v s. DSIGNAlgorithm v ⇒ Decoder s (SigDSIGN v) Source #

Deprecated: Use decodeFixedSized instead

Encoded Size expresssions

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), FixedSizeCodec (PossessionProofDSIGN 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 #

Deprecated: Use rawEncodeFixedSized instead

Serialise a PoP into fixed-size raw bytes.

rawDeserialisePossessionProofDSIGNByteStringMaybe (PossessionProofDSIGN v) Source #

Deprecated: Use rawDecodeFixedSized instead

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 #

Deprecated: Use fixedSize instead

encodePossessionProofDSIGNDSIGNAggregatable v ⇒ PossessionProofDSIGN v → Encoding Source #

Deprecated: Use encodeFixedSized instead

Encode a PoP into CBOR.

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

Deprecated: Use decodeFixedSized instead

Decode a PoP from CBOR.