Safe Haskell | None |
---|---|
Language | Haskell2010 |
Synopsis
- data Tally crypto v c = Tally {
- tally_countMax :: !Natural
- tally_encByChoiceByQuest :: !(EncryptedTally crypto v c)
- tally_decShareByTrustee :: ![DecryptionShare crypto v c]
- tally_countByChoiceByQuest :: ![[Natural]]
- type EncryptedTally crypto v c = [[Encryption crypto v c]]
- encryptedTally :: CryptoParams crypto c => [Ballot crypto v c] -> (EncryptedTally crypto v c, Natural)
- emptyEncryptedTally :: CryptoParams crypto c => (EncryptedTally crypto v c, Natural)
- insertEncryptedTally :: CryptoParams crypto c => Ballot crypto v c -> (EncryptedTally crypto v c, Natural) -> (EncryptedTally crypto v c, Natural)
- type DecryptionShareCombinator crypto v c = EncryptedTally crypto v c -> [DecryptionShare crypto v c] -> Except ErrorTally [[DecryptionFactor crypto c]]
- proveTally :: CryptoParams crypto c => (EncryptedTally crypto v c, Natural) -> [DecryptionShare crypto v c] -> DecryptionShareCombinator crypto v c -> Except ErrorTally (Tally crypto v c)
- verifyTally :: CryptoParams crypto c => Tally crypto v c -> DecryptionShareCombinator crypto v c -> Except ErrorTally ()
- newtype DecryptionShare crypto v c = DecryptionShare {
- unDecryptionShare :: [[(DecryptionFactor crypto c, Proof crypto v c)]]
- type DecryptionFactor = G
- proveDecryptionShare :: Reifies v Version => CryptoParams crypto c => Key crypto => Monad m => RandomGen r => EncryptedTally crypto v c -> SecretKey crypto c -> StateT r m (DecryptionShare crypto v c)
- proveDecryptionFactor :: Reifies v Version => CryptoParams crypto c => Key crypto => Monad m => RandomGen r => SecretKey crypto c -> Encryption crypto v c -> StateT r m (DecryptionFactor crypto c, Proof crypto v c)
- decryptionShareStatement :: CryptoParams crypto c => PublicKey crypto c -> ByteString
- data ErrorTally
- verifyDecryptionShare :: Reifies v Version => CryptoParams crypto c => Monad m => EncryptedTally crypto v c -> PublicKey crypto c -> DecryptionShare crypto v c -> ExceptT ErrorTally m ()
- verifyDecryptionShareByTrustee :: Reifies v Version => CryptoParams crypto c => Monad m => EncryptedTally crypto v c -> [PublicKey crypto c] -> [DecryptionShare crypto v c] -> ExceptT ErrorTally m ()
Type Tally
data Tally crypto v c Source #
Tally | |
|
Instances
Eq (G crypto c) => Eq (Tally crypto v c) Source # | |
(Show (G crypto c), Show (G crypto c)) => Show (Tally crypto v c) Source # | |
Generic (Tally crypto v c) Source # | |
(Reifies v Version, CryptoParams crypto c) => ToJSON (Tally crypto v c) Source # | |
Defined in Voting.Protocol.Tally | |
(Reifies v Version, CryptoParams crypto c) => FromJSON (Tally crypto v c) Source # | |
NFData (G crypto c) => NFData (Tally crypto v c) Source # | |
Defined in Voting.Protocol.Tally | |
type Rep (Tally crypto v c) Source # | |
Defined in Voting.Protocol.Tally type Rep (Tally crypto v c) = D1 ('MetaData "Tally" "Voting.Protocol.Tally" "majurity-protocol-0.0.10.20191104-inplace" '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 crypto v c))) :*: (S1 ('MetaSel ('Just "tally_decShareByTrustee") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 [DecryptionShare crypto v c]) :*: S1 ('MetaSel ('Just "tally_countByChoiceByQuest") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 [[Natural]])))) |
Type EncryptedTally
type EncryptedTally crypto v c = [[Encryption crypto v c]] Source #
Encryption
by choice by Question
.
encryptedTally :: CryptoParams crypto c => [Ballot crypto v c] -> (EncryptedTally crypto v c, Natural) Source #
(
returns the sum of the encryptedTally
ballots)Encryption
s of the given ballots
,
along with the number of Ballot
s.
emptyEncryptedTally :: CryptoParams crypto c => (EncryptedTally crypto v c, Natural) Source #
The initial EncryptedTally
which tallies no Ballot
.
insertEncryptedTally :: CryptoParams crypto c => Ballot crypto v c -> (EncryptedTally crypto v c, Natural) -> (EncryptedTally crypto v 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 crypto v c = EncryptedTally crypto v c -> [DecryptionShare crypto v c] -> Except ErrorTally [[DecryptionFactor crypto c]] Source #
proveTally :: CryptoParams crypto c => (EncryptedTally crypto v c, Natural) -> [DecryptionShare crypto v c] -> DecryptionShareCombinator crypto v c -> Except ErrorTally (Tally crypto v c) Source #
verifyTally :: CryptoParams crypto c => Tally crypto v c -> DecryptionShareCombinator crypto v c -> Except ErrorTally () Source #
Type DecryptionShare
newtype DecryptionShare crypto v c Source #
A decryption share is a DecryptionFactor
and a decryption Proof
, by choice by Question
.
Computed by a trustee in proveDecryptionShare
.
DecryptionShare | |
|
Instances
Type DecryptionFactor
type DecryptionFactor = G Source #
encryption_nonce
^
trusteeSecKey
proveDecryptionShare :: Reifies v Version => CryptoParams crypto c => Key crypto => Monad m => RandomGen r => EncryptedTally crypto v c -> SecretKey crypto c -> StateT r m (DecryptionShare crypto v c) Source #
proveDecryptionFactor :: Reifies v Version => CryptoParams crypto c => Key crypto => Monad m => RandomGen r => SecretKey crypto c -> Encryption crypto v c -> StateT r m (DecryptionFactor crypto c, Proof crypto v c) Source #
decryptionShareStatement :: CryptoParams crypto c => PublicKey crypto 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 :: Reifies v Version => CryptoParams crypto c => Monad m => EncryptedTally crypto v c -> PublicKey crypto c -> DecryptionShare crypto v 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 :: Reifies v Version => CryptoParams crypto c => Monad m => EncryptedTally crypto v c -> [PublicKey crypto c] -> [DecryptionShare crypto v c] -> ExceptT ErrorTally m () Source #