| 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 ()
- class (Semigroup (AggregateVoteVerificationKey crypto), Semigroup (AggregateVoteSignature crypto)) ⇒ CryptoSupportsAggregateVoteSigning crypto where
- type AggregateVoteVerificationKey crypto
- type AggregateVoteSignature crypto
- liftVoteVerificationKey ∷ Proxy crypto → VoteVerificationKey crypto → AggregateVoteVerificationKey crypto
- liftVoteSignature ∷ Proxy crypto → VoteSignature crypto → AggregateVoteSignature crypto
- verifyAggregateVoteSignature ∷ Proxy crypto → AggregateVoteVerificationKey crypto → ElectionId crypto → VoteCandidate crypto → AggregateVoteSignature crypto → Either String ()
- newtype TrivialAggregateVoteVerificationKey crypto = TrivialAggregateVoteVerificationKey (NE [VoteVerificationKey crypto])
- newtype TrivialAggregateVoteSignature crypto = TrivialAggregateVoteSignature (NE [VoteSignature crypto])
- trivialLiftVoteVerificationKey ∷ Proxy crypto → VoteVerificationKey crypto → TrivialAggregateVoteVerificationKey crypto
- trivialLiftVoteSignature ∷ Proxy crypto → VoteSignature crypto → TrivialAggregateVoteSignature crypto
- trivialVerifyAggregateVoteSignature ∷ CryptoSupportsVoteSigning crypto ⇒ Proxy crypto → TrivialAggregateVoteVerificationKey crypto → ElectionId crypto → VoteCandidate crypto → TrivialAggregateVoteSignature 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 (Semigroup (AggregateVRFVerificationKey crypto), Semigroup (AggregateVRFOutput crypto)) ⇒ CryptoSupportsAggregateVRF crypto where
- type AggregateVRFVerificationKey crypto
- type AggregateVRFOutput crypto
- liftVRFVerificationKey ∷ Proxy crypto → VRFVerificationKey crypto → AggregateVRFVerificationKey crypto
- liftVRFOutput ∷ Proxy crypto → VRFOutput crypto → AggregateVRFOutput crypto
- verifyAggregateVRFOutput ∷ AggregateVRFVerificationKey crypto → VRFElectionInput crypto → AggregateVRFOutput crypto → Either String ()
- newtype TrivialAggregateVRFVerificationKey crypto = TrivialAggregateVRFVerificationKey (NE [VRFVerificationKey crypto])
- newtype TrivialAggregateVRFOutput crypto = TrivialAggregateVRFOutput (NE [VRFOutput crypto])
- trivialLiftVRFVerificationKey ∷ Proxy crypto → VRFVerificationKey crypto → TrivialAggregateVRFVerificationKey crypto
- trivialLiftVRFOutput ∷ Proxy crypto → VRFOutput crypto → TrivialAggregateVRFOutput crypto
- trivialVerifyAggregateVRFOutput ∷ CryptoSupportsVRF crypto ⇒ TrivialAggregateVRFVerificationKey crypto → VRFElectionInput crypto → TrivialAggregateVRFOutput 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
class (Semigroup (AggregateVoteVerificationKey crypto), Semigroup (AggregateVoteSignature crypto)) ⇒ CryptoSupportsAggregateVoteSigning crypto where Source #
Crypto interface used for verifying aggregate vote signatures
Associated Types
type AggregateVoteVerificationKey crypto Source #
Key used for verifying aggregate vote signatures
type AggregateVoteSignature crypto Source #
Aggregate cryptographic signature of a vote
Methods
liftVoteVerificationKey ∷ Proxy crypto → VoteVerificationKey crypto → AggregateVoteVerificationKey crypto Source #
Lift a single vote signature verification key into an aggregate one
liftVoteSignature ∷ Proxy crypto → VoteSignature crypto → AggregateVoteSignature crypto Source #
Lift a single vote signature into an 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
Trivial aggregate vote signature verification helpers
newtype TrivialAggregateVoteVerificationKey crypto Source #
Constructors
| TrivialAggregateVoteVerificationKey (NE [VoteVerificationKey crypto]) |
Instances
| Semigroup (TrivialAggregateVoteVerificationKey crypto) Source # | |
Defined in Ouroboros.Consensus.Committee.Crypto Methods (<>) ∷ TrivialAggregateVoteVerificationKey crypto → TrivialAggregateVoteVerificationKey crypto → TrivialAggregateVoteVerificationKey crypto # sconcat ∷ NonEmpty (TrivialAggregateVoteVerificationKey crypto) → TrivialAggregateVoteVerificationKey crypto # stimes ∷ Integral b ⇒ b → TrivialAggregateVoteVerificationKey crypto → TrivialAggregateVoteVerificationKey crypto # | |
newtype TrivialAggregateVoteSignature crypto Source #
Constructors
| TrivialAggregateVoteSignature (NE [VoteSignature crypto]) |
Instances
| Semigroup (TrivialAggregateVoteSignature crypto) Source # | |
Defined in Ouroboros.Consensus.Committee.Crypto Methods (<>) ∷ TrivialAggregateVoteSignature crypto → TrivialAggregateVoteSignature crypto → TrivialAggregateVoteSignature crypto # sconcat ∷ NonEmpty (TrivialAggregateVoteSignature crypto) → TrivialAggregateVoteSignature crypto # stimes ∷ Integral b ⇒ b → TrivialAggregateVoteSignature crypto → TrivialAggregateVoteSignature crypto # | |
trivialLiftVoteVerificationKey ∷ Proxy crypto → VoteVerificationKey crypto → TrivialAggregateVoteVerificationKey crypto Source #
trivialLiftVoteSignature ∷ Proxy crypto → VoteSignature crypto → TrivialAggregateVoteSignature crypto Source #
trivialVerifyAggregateVoteSignature ∷ CryptoSupportsVoteSigning crypto ⇒ Proxy crypto → TrivialAggregateVoteVerificationKey crypto → ElectionId crypto → VoteCandidate crypto → TrivialAggregateVoteSignature crypto → Either String () Source #
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]
class (Semigroup (AggregateVRFVerificationKey crypto), Semigroup (AggregateVRFOutput crypto)) ⇒ CryptoSupportsAggregateVRF crypto where Source #
Crypto interface used for verifying aggregate VRF signatures
Associated Types
type AggregateVRFVerificationKey crypto Source #
Key used for verifying aggregate VRF outputs
type AggregateVRFOutput crypto Source #
Aggregate cryptographic signature of a VRF output
Methods
liftVRFVerificationKey ∷ Proxy crypto → VRFVerificationKey crypto → AggregateVRFVerificationKey crypto Source #
Lift a single VRF output verification key into an aggregate one
liftVRFOutput ∷ Proxy crypto → VRFOutput crypto → AggregateVRFOutput crypto Source #
Lift a single VRF output into an aggregate one
verifyAggregateVRFOutput ∷ AggregateVRFVerificationKey crypto → VRFElectionInput crypto → AggregateVRFOutput crypto → Either String () Source #
Verify an aggregate vote signature for a given election and candidate
Trivial aggregate VRF verification helpers
newtype TrivialAggregateVRFVerificationKey crypto Source #
Constructors
| TrivialAggregateVRFVerificationKey (NE [VRFVerificationKey crypto]) |
Instances
| Semigroup (TrivialAggregateVRFVerificationKey crypto) Source # | |
Defined in Ouroboros.Consensus.Committee.Crypto Methods (<>) ∷ TrivialAggregateVRFVerificationKey crypto → TrivialAggregateVRFVerificationKey crypto → TrivialAggregateVRFVerificationKey crypto # sconcat ∷ NonEmpty (TrivialAggregateVRFVerificationKey crypto) → TrivialAggregateVRFVerificationKey crypto # stimes ∷ Integral b ⇒ b → TrivialAggregateVRFVerificationKey crypto → TrivialAggregateVRFVerificationKey crypto # | |
newtype TrivialAggregateVRFOutput crypto Source #
Constructors
| TrivialAggregateVRFOutput (NE [VRFOutput crypto]) |
Instances
| Semigroup (TrivialAggregateVRFOutput crypto) Source # | |
Defined in Ouroboros.Consensus.Committee.Crypto Methods (<>) ∷ TrivialAggregateVRFOutput crypto → TrivialAggregateVRFOutput crypto → TrivialAggregateVRFOutput crypto # sconcat ∷ NonEmpty (TrivialAggregateVRFOutput crypto) → TrivialAggregateVRFOutput crypto # stimes ∷ Integral b ⇒ b → TrivialAggregateVRFOutput crypto → TrivialAggregateVRFOutput crypto # | |
trivialLiftVRFVerificationKey ∷ Proxy crypto → VRFVerificationKey crypto → TrivialAggregateVRFVerificationKey crypto Source #
trivialLiftVRFOutput ∷ Proxy crypto → VRFOutput crypto → TrivialAggregateVRFOutput crypto Source #
trivialVerifyAggregateVRFOutput ∷ CryptoSupportsVRF crypto ⇒ TrivialAggregateVRFVerificationKey crypto → VRFElectionInput crypto → TrivialAggregateVRFOutput crypto → Either String () Source #