| Safe Haskell | None |
|---|---|
| Language | Haskell2010 |
Voting.Protocol.Tally
Contents
Synopsis
- data Tally q = Tally {}
- type EncryptedTally q = [[Encryption q]]
- encryptedTally :: SubGroup q => [Ballot q] -> (EncryptedTally q, Natural)
- type DecryptionShareCombinator q = [DecryptionShare q] -> Except ErrorDecryptionShare [[DecryptionFactor q]]
- proveTally :: SubGroup q => (EncryptedTally q, Natural) -> [DecryptionShare q] -> DecryptionShareCombinator q -> Except ErrorDecryptionShare (Tally q)
- verifyTally :: SubGroup q => Tally q -> DecryptionShareCombinator q -> Except ErrorDecryptionShare ()
- data DecryptionShare q = DecryptionShare {
- decryptionShare_factors :: [[DecryptionFactor q]]
- decryptionShare_proofs :: [[Proof q]]
- type DecryptionFactor = G
- proveDecryptionShare :: Monad m => SubGroup q => RandomGen r => EncryptedTally q -> SecretKey q -> StateT r m (DecryptionShare q)
- proveDecryptionFactor :: Monad m => SubGroup q => RandomGen r => SecretKey q -> Encryption q -> StateT r m (DecryptionFactor q, Proof q)
- decryptionShareStatement :: SubGroup q => PublicKey q -> ByteString
- data ErrorDecryptionShare
- verifyDecryptionShare :: Monad m => SubGroup q => EncryptedTally q -> PublicKey q -> DecryptionShare q -> ExceptT ErrorDecryptionShare m ()
- verifyDecryptionShareByTrustee :: Monad m => SubGroup q => EncryptedTally q -> [PublicKey q] -> [DecryptionShare q] -> ExceptT ErrorDecryptionShare m ()
Type Tally
Constructors
| Tally | |
Fields
| |
Instances
| Eq (Tally q) Source # | |
| Show (Tally q) Source # | |
| Generic (Tally q) Source # | |
| NFData (Tally q) Source # | |
Defined in Voting.Protocol.Tally | |
| type Rep (Tally q) Source # | |
Defined in Voting.Protocol.Tally type Rep (Tally q) = D1 (MetaData "Tally" "Voting.Protocol.Tally" "hjugement-protocol-0.0.0.20190513-FHCeTArdaCC2IRctq0Wzr8" False) (C1 (MetaCons "Tally" PrefixI True) ((S1 (MetaSel (Just "tally_countMax") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 Natural) :*: S1 (MetaSel (Just "tally_encByChoiceByQuest") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 (EncryptedTally q))) :*: (S1 (MetaSel (Just "tally_decShareByTrustee") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 [DecryptionShare q]) :*: S1 (MetaSel (Just "tally_countByChoiceByQuest") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 [[Natural]])))) | |
Type EncryptedTally
type EncryptedTally q = [[Encryption q]] Source #
Encryption by Choice by Question.
encryptedTally :: SubGroup q => [Ballot q] -> (EncryptedTally q, Natural) Source #
(
returns the sum of the encryptedTally ballots)Encryptions of the given ballots,
along with the number of Ballots.
Type DecryptionShareCombinator
type DecryptionShareCombinator q = [DecryptionShare q] -> Except ErrorDecryptionShare [[DecryptionFactor q]] Source #
proveTally :: SubGroup q => (EncryptedTally q, Natural) -> [DecryptionShare q] -> DecryptionShareCombinator q -> Except ErrorDecryptionShare (Tally q) Source #
verifyTally :: SubGroup q => Tally q -> DecryptionShareCombinator q -> Except ErrorDecryptionShare () Source #
Type DecryptionShare
data DecryptionShare q Source #
A decryption share. It is computed by a trustee
from its SecretKey share and the EncryptedTally,
and contains a cryptographic Proof that it hasn't cheated.
Constructors
| DecryptionShare | |
Fields
| |
Type DecryptionFactor
type DecryptionFactor = G Source #
encryption_nonce^trusteeSecKey
proveDecryptionShare :: Monad m => SubGroup q => RandomGen r => EncryptedTally q -> SecretKey q -> StateT r m (DecryptionShare q) Source #
proveDecryptionFactor :: Monad m => SubGroup q => RandomGen r => SecretKey q -> Encryption q -> StateT r m (DecryptionFactor q, Proof q) Source #
decryptionShareStatement :: SubGroup q => PublicKey q -> ByteString Source #
Type ErrorDecryptionShare
data ErrorDecryptionShare Source #
Constructors
| ErrorDecryptionShare_Invalid Text | The number of |
| ErrorDecryptionShare_Wrong | The |
| ErrorDecryptionShare_InvalidMaxCount |
verifyDecryptionShare :: Monad m => SubGroup q => EncryptedTally q -> PublicKey q -> DecryptionShare q -> ExceptT ErrorDecryptionShare m () Source #
(
checks that verifyDecryptionShare encTally trusteePubKey trusteeDecShare)trusteeDecShare
(supposedly submitted by a trustee whose PublicKey is trusteePubKey)
is valid with respect to the EncryptedTally encTally.
verifyDecryptionShareByTrustee :: Monad m => SubGroup q => EncryptedTally q -> [PublicKey q] -> [DecryptionShare q] -> ExceptT ErrorDecryptionShare m () Source #