ouroboros-consensus
Safe HaskellNone
LanguageHaskell2010

Ouroboros.Consensus.Committee.Crypto

Description

Generic interface used by implementations of voting committees.

NOTE: concrete implementations might not need to implement all these interfaces, especially the ones regarding VRF-based eligibility proofs and aggregate vote signature verification.

Synopsis

Core types associated to voting committees

type family PrivateKey crypto Source #

Private key used within the voting committee

type family PublicKey crypto Source #

Public key used within the voting committee

Instances

Instances details
type PublicKey PerasBLSCrypto Source # 
Instance details

Defined in Ouroboros.Consensus.Peras.Crypto.BLS

type PublicKey (MockPerasCrypto blk) Source # 
Instance details

Defined in Ouroboros.Consensus.Peras.Crypto.Mock

type PublicKey (MockPerasCrypto blk) = ()
type PublicKey (VoidPerasCrypto blk) Source # 
Instance details

Defined in Ouroboros.Consensus.Peras.Void

type family VoteCandidate crypto Source #

Vote candidates, i.e., what's being voted for

Vote signing interface

class CryptoSupportsVoteSigning crypto where Source #

Crypto interface used for signing and verifying votes

Associated Types

type VoteSigningKey crypto Source #

Key used for signing votes

type VoteVerificationKey crypto Source #

Key used for verifying votes

data VoteSignature crypto Source #

Cryptographic signature of a vote

Methods

getVoteSigningKey ∷ Proxy crypto → PrivateKey crypto → VoteSigningKey crypto Source #

Derive a signing key from a voting committee private key

getVoteVerificationKey ∷ Proxy crypto → PublicKey crypto → VoteVerificationKey crypto Source #

Derive a verification key from a voting committee public key

signVote ∷ VoteSigningKey crypto → ElectionId crypto → VoteCandidate crypto → VoteSignature crypto Source #

Sign a vote candidate in a given election

verifyVoteSignature ∷ VoteVerificationKey crypto → ElectionId crypto → VoteCandidate crypto → VoteSignature crypto → Either String () Source #

Verify the signature of a vote candidate in a given election

Instances

Instances details
CryptoSupportsVoteSigning PerasBLSCrypto Source # 
Instance details

Defined in Ouroboros.Consensus.Peras.Crypto.BLS

CryptoSupportsVoteSigning (MockPerasCrypto blk) Source # 
Instance details

Defined in Ouroboros.Consensus.Peras.Crypto.Mock

CryptoSupportsVoteSigning (VoidPerasCrypto blk) Source # 
Instance details

Defined in Ouroboros.Consensus.Peras.Void

VRF-based eligibility proofs interface

data VRFPoolContext crypto Source #

Context in which a VRF input is evaluated.

This distinguishes between the case where we want to compute our own VRF output, and the case where we want to verify the VRF output of someone else.

Constructors

VRFSignContext (VRFSigningKey crypto)

Compute our own VRF output by signing the VRF input with our signing key

VRFVerifyContext (VRFVerificationKey crypto) (VRFOutput crypto)

Verify the local sortition output of another participant by verifying their signature over the VRF input using their verification key

newtype NormalizedVRFOutput Source #

Normalized VRF outputs as a rational between 0 and 1

class CryptoSupportsVRF crypto where Source #

Crypto interface used to proof eligibility via local sortition

Associated Types

type VRFSigningKey crypto Source #

Private key used for computing our own VRF output

type VRFVerificationKey crypto Source #

Public key used for verifying the VRF output of other participants

data VRFElectionInput crypto Source #

Input to the verifiable random function.

This is fixed across all participants for a given election.

data VRFOutput crypto Source #

Output of the verifiable random function

Methods

getVRFSigningKey ∷ Proxy crypto → PrivateKey crypto → VRFSigningKey crypto Source #

Derive a VRF signing key from a voting committee private key

getVRFVerificationKey ∷ Proxy crypto → PublicKey crypto → VRFVerificationKey crypto Source #

Derive a VRF verification key from a voting committee public key

mkVRFElectionInput ∷ Nonce → ElectionId crypto → VRFElectionInput crypto Source #

Construct a VRF input from a nonce and an election identifier

evalVRF ∷ VRFPoolContext crypto → VRFElectionInput crypto → Either String (VRFOutput crypto) Source #

Evaluate a VRF input in a given context

normalizeVRFOutput ∷ VRFOutput crypto → NormalizedVRFOutput Source #

Normalize a VRF output to a value in [0, 1]

Aggregate verification interface

class CryptoSupportsVoteSigning crypto ⇒ CryptoSupportsAggregateVoteSigning crypto where Source #

Crypto interface used for creating and verifying aggregate vote signatures

Associated Types

type AggregateVoteVerificationKey crypto Source #

Aggregate vote verification keys

type AggregateVoteSignature crypto Source #

Aggregate vote signatures

Methods

aggregateVoteVerificationKeys ∷ Proxy crypto → NE [VoteVerificationKey crypto] → Either String (AggregateVoteVerificationKey crypto) Source #

Combine multiple vote verification keys into a single aggregate one

aggregateVoteSignatures ∷ Proxy crypto → NE [VoteSignature crypto] → Either String (AggregateVoteSignature crypto) Source #

Combine multiple vote signatures into a single aggregate one

verifyAggregateVoteSignature ∷ Proxy crypto → AggregateVoteVerificationKey crypto → ElectionId crypto → VoteCandidate crypto → AggregateVoteSignature crypto → Either String () Source #

Verify an aggregate vote signature for a given election and candidate

Instances

Instances details
CryptoSupportsAggregateVoteSigning PerasBLSCrypto Source # 
Instance details

Defined in Ouroboros.Consensus.Peras.Crypto.BLS

CryptoSupportsAggregateVoteSigning (MockPerasCrypto blk) Source # 
Instance details

Defined in Ouroboros.Consensus.Peras.Crypto.Mock

class CryptoSupportsVRF crypto ⇒ CryptoSupportsBatchVRFVerification crypto where Source #

Crypto interface used for verifying multiple VRF outputs at once

Methods

batchVerifyVRFOutputs ∷ NE [VRFVerificationKey crypto] → VRFElectionInput crypto → NE [VRFOutput crypto] → Either String () Source #

Verify a list of VRF outputs for a given election input using the corresponding verification keys of their issuers.

NOTE: this expects non-aggregate VRF verification keys and VRF outputs so that each (key_i, output_i) pair can be bound at verification time (e.g. via linearization). This per-pair binding defeats swap-attacks where an adversary swaps their VRF output with someone else's more-favorable one before forging a certificate.