| Safe Haskell | None |
|---|---|
| Language | Haskell2010 |
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
- type family PrivateKey crypto
- type family PublicKey crypto
- type family ElectionId crypto
- type family VoteCandidate crypto
- class CryptoSupportsVoteSigning crypto where
- type VoteSigningKey crypto
- type VoteVerificationKey crypto
- data VoteSignature crypto
- getVoteSigningKey ∷ Proxy crypto → PrivateKey crypto → VoteSigningKey crypto
- getVoteVerificationKey ∷ Proxy crypto → PublicKey crypto → VoteVerificationKey crypto
- signVote ∷ VoteSigningKey crypto → ElectionId crypto → VoteCandidate crypto → VoteSignature crypto
- verifyVoteSignature ∷ VoteVerificationKey crypto → ElectionId crypto → VoteCandidate crypto → VoteSignature crypto → Either String ()
- data VRFPoolContext crypto
- = VRFSignContext (VRFSigningKey crypto)
- | VRFVerifyContext (VRFVerificationKey crypto) (VRFOutput crypto)
- newtype NormalizedVRFOutput = NormalizedVRFOutput {}
- class CryptoSupportsVRF crypto where
- type VRFSigningKey crypto
- type VRFVerificationKey crypto
- data VRFElectionInput crypto
- data VRFOutput crypto
- getVRFSigningKey ∷ Proxy crypto → PrivateKey crypto → VRFSigningKey crypto
- getVRFVerificationKey ∷ Proxy crypto → PublicKey crypto → VRFVerificationKey crypto
- mkVRFElectionInput ∷ Nonce → ElectionId crypto → VRFElectionInput crypto
- evalVRF ∷ VRFPoolContext crypto → VRFElectionInput crypto → Either String (VRFOutput crypto)
- normalizeVRFOutput ∷ VRFOutput crypto → NormalizedVRFOutput
- class CryptoSupportsVoteSigning crypto ⇒ CryptoSupportsAggregateVoteSigning crypto where
- type AggregateVoteVerificationKey crypto
- type AggregateVoteSignature crypto
- aggregateVoteVerificationKeys ∷ Proxy crypto → NE [VoteVerificationKey crypto] → Either String (AggregateVoteVerificationKey crypto)
- aggregateVoteSignatures ∷ Proxy crypto → NE [VoteSignature crypto] → Either String (AggregateVoteSignature crypto)
- verifyAggregateVoteSignature ∷ Proxy crypto → AggregateVoteVerificationKey crypto → ElectionId crypto → VoteCandidate crypto → AggregateVoteSignature crypto → Either String ()
- class CryptoSupportsVRF crypto ⇒ CryptoSupportsBatchVRFVerification crypto where
- batchVerifyVRFOutputs ∷ NE [VRFVerificationKey crypto] → VRFElectionInput crypto → NE [VRFOutput crypto] → Either String ()
Core types associated to voting committees
type family PrivateKey crypto Source #
Private key used within the voting committee
type family ElectionId crypto Source #
Election identifiers
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
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
Constructors
| NormalizedVRFOutput | |
Fields | |
Instances
| Show NormalizedVRFOutput Source # | |
Defined in Ouroboros.Consensus.Committee.Crypto Methods showsPrec ∷ Int → NormalizedVRFOutput → ShowS # show ∷ NormalizedVRFOutput → String # showList ∷ [NormalizedVRFOutput] → ShowS # | |
| Eq NormalizedVRFOutput Source # | |
Defined in Ouroboros.Consensus.Committee.Crypto Methods | |
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
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.