Safe Haskell | None |
---|---|
Language | Haskell2010 |
- type Threshold = Integer
- type ShareId = Integer
- newtype ExtraGen = ExtraGen Point
- data Point
- data Proof
- data ParallelProofs
- data Scalar
- newtype Secret = Secret Point
- newtype Participants = Participants [PublicKey]
- newtype PublicKey = PublicKey Point
- newtype PrivateKey = PrivateKey Scalar
- data KeyPair = KeyPair {}
- newtype DhSecret = DhSecret ByteString
- data Escrow = Escrow {
- escrowExtraGen :: !ExtraGen
- escrowPolynomial :: !Polynomial
- escrowSecret :: !Secret
- escrowProof :: !Proof
- newtype Commitment = Commitment {}
- newtype EncryptedSi = EncryptedSi Point
- data DecryptedShare = DecryptedShare {}
- escrow :: MonadRandom randomly => Threshold -> Participants -> randomly (ExtraGen, Secret, [EncryptedSi], [Commitment], Proof, ParallelProofs)
- escrowWith :: MonadRandom randomly => Escrow -> Participants -> randomly ([EncryptedSi], [Commitment], ParallelProofs)
- escrowNew :: MonadRandom randomly => Threshold -> randomly Escrow
- shareDecrypt :: MonadRandom randomly => KeyPair -> EncryptedSi -> randomly DecryptedShare
- verifyEncryptedShares :: MonadRandom randomly => ExtraGen -> Threshold -> [Commitment] -> ParallelProofs -> [EncryptedSi] -> Participants -> randomly Bool
- verifyDecryptedShare :: (EncryptedSi, PublicKey, DecryptedShare) -> Bool
- verifySecret :: ExtraGen -> Threshold -> [Commitment] -> Secret -> Proof -> Bool
- recover :: [(ShareId, DecryptedShare)] -> Secret
- secretToDhSecret :: Secret -> DhSecret
- reorderDecryptShares :: Participants -> [(PublicKey, DecryptedShare)] -> Maybe [(ShareId, DecryptedShare)]
- keyPairGenerate :: MonadRandom randomly => randomly KeyPair
Simple alias
type Threshold = Integer Source #
The number of shares needed to reconstitute the secret.
When the threshold is reached, as in the number of decrypted shares is equal or more than the threshold, the secret should be recoverable through the protocol
Threshold need to be a strictly positive, and less to number of participants given N the number of participants, this should hold: 1 <= t < N
Extra generator
The generated proof
data ParallelProofs Source #
Secret
newtype Participants Source #
This is a list of participants in one instance of SCRAPE
The list has a specific *order*, and the order is important to be kept between various calls in this protocol.
Public Key
newtype PrivateKey Source #
Private Key
Types
Escrow | |
|
newtype Commitment Source #
newtype EncryptedSi Source #
Encrypted i'th share value with i'th public key
data DecryptedShare Source #
An decrypted share decrypted by a party's key and
DecryptedShare | |
|
method
:: MonadRandom randomly | |
=> Threshold | PVSS scheme configuration n/t threshold |
-> Participants | Participants public keys |
-> randomly (ExtraGen, Secret, [EncryptedSi], [Commitment], Proof, ParallelProofs) |
Prepare a secret into public encrypted shares for distributions using the PVSS scheme
returns: * the encrypted secret * the list of public commitments to the scheme * The encrypted shares that should be distributed to each partipants.
:: MonadRandom randomly | |
=> Escrow | |
-> Participants | Participants public keys |
-> randomly ([EncryptedSi], [Commitment], ParallelProofs) |
Escrow with a given polynomial
escrowNew :: MonadRandom randomly => Threshold -> randomly Escrow Source #
Prepare a new escrowing context
The only needed parameter is the threshold do not re-use an escrow context for different context.
shareDecrypt :: MonadRandom randomly => KeyPair -> EncryptedSi -> randomly DecryptedShare Source #
Decrypt an Encrypted share using the party's key pair.
Doesn't verify if an encrypted share is valid, for this
you need to have use verifyEncryptedShares
1) compute Si = Yi ^ (1/xi) = G^(p(i)) 2) create a proof of the valid decryption
verifyEncryptedShares :: MonadRandom randomly => ExtraGen -> Threshold -> [Commitment] -> ParallelProofs -> [EncryptedSi] -> Participants -> randomly Bool Source #
verifyDecryptedShare :: (EncryptedSi, PublicKey, DecryptedShare) -> Bool Source #
Verify a decrypted share against the public key and the encrypted share
verifySecret :: ExtraGen -> Threshold -> [Commitment] -> Secret -> Proof -> Bool Source #
Verify that a secret recovered is the one escrow
recover :: [(ShareId, DecryptedShare)] -> Secret Source #
Recover the DhSecret used
Need to pass the correct amount of shares (threshold),
preferably from a reorderDecryptShares
call
secretToDhSecret :: Secret -> DhSecret Source #
Transform a secret into a usable random value
reorderDecryptShares :: Participants -> [(PublicKey, DecryptedShare)] -> Maybe [(ShareId, DecryptedShare)] Source #
temporary export to get testing
keyPairGenerate :: MonadRandom randomly => randomly KeyPair Source #