Safe Haskell | None |
---|---|
Language | Haskell2010 |
Synopsis
- data Tally c = Tally {}
- type EncryptedTally c = [[Encryption c]]
- encryptedTally :: Reifies c FFC => [Ballot c] -> (EncryptedTally c, Natural)
- emptyEncryptedTally :: Reifies c FFC => (EncryptedTally c, Natural)
- insertEncryptedTally :: Reifies c FFC => Ballot c -> (EncryptedTally c, Natural) -> (EncryptedTally c, Natural)
- type DecryptionShareCombinator c = EncryptedTally c -> [DecryptionShare c] -> Except ErrorTally [[DecryptionFactor c]]
- proveTally :: Reifies c FFC => (EncryptedTally c, Natural) -> [DecryptionShare c] -> DecryptionShareCombinator c -> Except ErrorTally (Tally c)
- verifyTally :: Reifies c FFC => Tally c -> DecryptionShareCombinator c -> Except ErrorTally ()
- newtype DecryptionShare c = DecryptionShare {
- unDecryptionShare :: [[(DecryptionFactor c, Proof c)]]
- type DecryptionFactor = G
- proveDecryptionShare :: Monad m => Reifies c FFC => RandomGen r => EncryptedTally c -> SecretKey c -> StateT r m (DecryptionShare c)
- proveDecryptionFactor :: Monad m => Reifies c FFC => RandomGen r => SecretKey c -> Encryption c -> StateT r m (DecryptionFactor c, Proof c)
- decryptionShareStatement :: Reifies c FFC => PublicKey c -> ByteString
- data ErrorTally
- verifyDecryptionShare :: Monad m => Reifies c FFC => EncryptedTally c -> PublicKey c -> DecryptionShare c -> ExceptT ErrorTally m ()
- verifyDecryptionShareByTrustee :: Monad m => Reifies c FFC => EncryptedTally c -> [PublicKey c] -> [DecryptionShare c] -> ExceptT ErrorTally m ()
Type Tally
Tally | |
|
Instances
Eq (Tally c) Source # | |
Show (Tally c) Source # | |
Generic (Tally c) Source # | |
Reifies c FFC => ToJSON (Tally c) Source # | |
Defined in Voting.Protocol.Tally | |
Reifies c FFC => FromJSON (Tally c) Source # | |
NFData (Tally c) Source # | |
Defined in Voting.Protocol.Tally | |
type Rep (Tally c) Source # | |
Defined in Voting.Protocol.Tally type Rep (Tally c) = D1 (MetaData "Tally" "Voting.Protocol.Tally" "hjugement-protocol-0.0.7.20190815-As1rduHXqx8BecfrJje01q" False) (C1 (MetaCons "Tally" PrefixI True) ((S1 (MetaSel (Just "tally_countMax") NoSourceUnpackedness SourceStrict DecidedStrict) (Rec0 Natural) :*: S1 (MetaSel (Just "tally_encByChoiceByQuest") NoSourceUnpackedness SourceStrict DecidedStrict) (Rec0 (EncryptedTally c))) :*: (S1 (MetaSel (Just "tally_decShareByTrustee") NoSourceUnpackedness SourceStrict DecidedStrict) (Rec0 [DecryptionShare c]) :*: S1 (MetaSel (Just "tally_countByChoiceByQuest") NoSourceUnpackedness SourceStrict DecidedStrict) (Rec0 [[Natural]])))) |
Type EncryptedTally
type EncryptedTally c = [[Encryption c]] Source #
Encryption
by choice by Question
.
encryptedTally :: Reifies c FFC => [Ballot c] -> (EncryptedTally c, Natural) Source #
(
returns the sum of the encryptedTally
ballots)Encryption
s of the given ballots
,
along with the number of Ballot
s.
emptyEncryptedTally :: Reifies c FFC => (EncryptedTally c, Natural) Source #
The initial EncryptedTally
which tallies no Ballot
.
insertEncryptedTally :: Reifies c FFC => Ballot c -> (EncryptedTally c, Natural) -> (EncryptedTally c, Natural) Source #
(
returns the insertEncryptedTally
ballot encTally)EncryptedTally
adding the votes of the given (ballot)
to those of the given (encTally)
.
Type DecryptionShareCombinator
type DecryptionShareCombinator c = EncryptedTally c -> [DecryptionShare c] -> Except ErrorTally [[DecryptionFactor c]] Source #
proveTally :: Reifies c FFC => (EncryptedTally c, Natural) -> [DecryptionShare c] -> DecryptionShareCombinator c -> Except ErrorTally (Tally c) Source #
verifyTally :: Reifies c FFC => Tally c -> DecryptionShareCombinator c -> Except ErrorTally () Source #
Type DecryptionShare
newtype DecryptionShare c Source #
A decryption share is a DecryptionFactor
and a decryption Proof
, by choice by Question
.
Computed by a trustee in proveDecryptionShare
.
DecryptionShare | |
|
Type DecryptionFactor
type DecryptionFactor = G Source #
encryption_nonce
^
trusteeSecKey
proveDecryptionShare :: Monad m => Reifies c FFC => RandomGen r => EncryptedTally c -> SecretKey c -> StateT r m (DecryptionShare c) Source #
proveDecryptionFactor :: Monad m => Reifies c FFC => RandomGen r => SecretKey c -> Encryption c -> StateT r m (DecryptionFactor c, Proof c) Source #
decryptionShareStatement :: Reifies c FFC => PublicKey c -> ByteString Source #
Type ErrorTally
data ErrorTally Source #
ErrorTally_NumberOfQuestions | The number of |
ErrorTally_NumberOfChoices | The number of choices is not the one expected. |
ErrorTally_NumberOfTrustees | The number of trustees is not the one expected. |
ErrorTally_WrongProof | The |
ErrorTally_CannotDecryptCount | Raised by |
Instances
verifyDecryptionShare :: Monad m => Reifies c FFC => EncryptedTally c -> PublicKey c -> DecryptionShare c -> ExceptT ErrorTally 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 => Reifies c FFC => EncryptedTally c -> [PublicKey c] -> [DecryptionShare c] -> ExceptT ErrorTally m () Source #