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
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 | |
|
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 #