dkg_mirror/
pedpop.rs

1use core::{marker::PhantomData, ops::Deref, fmt};
2use std::{
3  io::{self, Read, Write},
4  collections::HashMap,
5};
6
7use rand_core::{RngCore, CryptoRng};
8
9use zeroize::{Zeroize, ZeroizeOnDrop, Zeroizing};
10
11use transcript::{Transcript, RecommendedTranscript};
12
13use ciphersuite::{
14  group::{
15    ff::{Field, PrimeField},
16    Group, GroupEncoding,
17  },
18  Ciphersuite,
19};
20use multiexp::{multiexp_vartime, BatchVerifier};
21
22use schnorr::SchnorrSignature;
23
24use crate::{
25  Participant, DkgError, ThresholdParams, ThresholdCore, validate_map,
26  encryption::{
27    ReadWrite, EncryptionKeyMessage, EncryptedMessage, Encryption, EncryptionKeyProof,
28    DecryptionError,
29  },
30};
31
32type FrostError<C> = DkgError<EncryptionKeyProof<C>>;
33
34#[allow(non_snake_case)]
35fn challenge<C: Ciphersuite>(context: &str, l: Participant, R: &[u8], Am: &[u8]) -> C::F {
36  let mut transcript = RecommendedTranscript::new(b"DKG FROST v0.2");
37  transcript.domain_separate(b"schnorr_proof_of_knowledge");
38  transcript.append_message(b"context", context.as_bytes());
39  transcript.append_message(b"participant", l.to_bytes());
40  transcript.append_message(b"nonce", R);
41  transcript.append_message(b"commitments", Am);
42  C::hash_to_F(b"DKG-FROST-proof_of_knowledge-0", &transcript.challenge(b"schnorr"))
43}
44
45/// The commitments message, intended to be broadcast to all other parties.
46///
47/// Every participant should only provide one set of commitments to all parties. If any
48/// participant sends multiple sets of commitments, they are faulty and should be presumed
49/// malicious. As this library does not handle networking, it is unable to detect if any
50/// participant is so faulty. That responsibility lies with the caller.
51#[derive(Clone, PartialEq, Eq, Debug, Zeroize)]
52pub struct Commitments<C: Ciphersuite> {
53  commitments: Vec<C::G>,
54  cached_msg: Vec<u8>,
55  sig: SchnorrSignature<C>,
56}
57
58impl<C: Ciphersuite> ReadWrite for Commitments<C> {
59  fn read<R: Read>(reader: &mut R, params: ThresholdParams) -> io::Result<Self> {
60    let mut commitments = Vec::with_capacity(params.t().into());
61    let mut cached_msg = vec![];
62
63    #[allow(non_snake_case)]
64    let mut read_G = || -> io::Result<C::G> {
65      let mut buf = <C::G as GroupEncoding>::Repr::default();
66      reader.read_exact(buf.as_mut())?;
67      let point = C::read_G(&mut buf.as_ref())?;
68      cached_msg.extend(buf.as_ref());
69      Ok(point)
70    };
71
72    for _ in 0 .. params.t() {
73      commitments.push(read_G()?);
74    }
75
76    Ok(Commitments { commitments, cached_msg, sig: SchnorrSignature::read(reader)? })
77  }
78
79  fn write<W: Write>(&self, writer: &mut W) -> io::Result<()> {
80    writer.write_all(&self.cached_msg)?;
81    self.sig.write(writer)
82  }
83}
84
85/// State machine to begin the key generation protocol.
86#[derive(Debug, Zeroize)]
87pub struct KeyGenMachine<C: Ciphersuite> {
88  params: ThresholdParams,
89  context: String,
90  _curve: PhantomData<C>,
91}
92
93impl<C: Ciphersuite> KeyGenMachine<C> {
94  /// Create a new machine to generate a key.
95  ///
96  /// The context string should be unique among multisigs.
97  pub fn new(params: ThresholdParams, context: String) -> KeyGenMachine<C> {
98    KeyGenMachine { params, context, _curve: PhantomData }
99  }
100
101  /// Start generating a key according to the FROST DKG spec.
102  ///
103  /// Returns a commitments message to be sent to all parties over an authenticated channel. If any
104  /// party submits multiple sets of commitments, they MUST be treated as malicious.
105  pub fn generate_coefficients<R: RngCore + CryptoRng>(
106    self,
107    rng: &mut R,
108  ) -> (SecretShareMachine<C>, EncryptionKeyMessage<C, Commitments<C>>) {
109    let t = usize::from(self.params.t);
110    let mut coefficients = Vec::with_capacity(t);
111    let mut commitments = Vec::with_capacity(t);
112    let mut cached_msg = vec![];
113
114    for i in 0 .. t {
115      // Step 1: Generate t random values to form a polynomial with
116      coefficients.push(Zeroizing::new(C::random_nonzero_F(&mut *rng)));
117      // Step 3: Generate public commitments
118      commitments.push(C::generator() * coefficients[i].deref());
119      cached_msg.extend(commitments[i].to_bytes().as_ref());
120    }
121
122    // Step 2: Provide a proof of knowledge
123    let r = Zeroizing::new(C::random_nonzero_F(rng));
124    let nonce = C::generator() * r.deref();
125    let sig = SchnorrSignature::<C>::sign(
126      &coefficients[0],
127      // This could be deterministic as the PoK is a singleton never opened up to cooperative
128      // discussion
129      // There's no reason to spend the time and effort to make this deterministic besides a
130      // general obsession with canonicity and determinism though
131      r,
132      challenge::<C>(&self.context, self.params.i(), nonce.to_bytes().as_ref(), &cached_msg),
133    );
134
135    // Additionally create an encryption mechanism to protect the secret shares
136    let encryption = Encryption::new(self.context.clone(), Some(self.params.i), rng);
137
138    // Step 4: Broadcast
139    let msg =
140      encryption.registration(Commitments { commitments: commitments.clone(), cached_msg, sig });
141    (
142      SecretShareMachine {
143        params: self.params,
144        context: self.context,
145        coefficients,
146        our_commitments: commitments,
147        encryption,
148      },
149      msg,
150    )
151  }
152}
153
154fn polynomial<F: PrimeField + Zeroize>(
155  coefficients: &[Zeroizing<F>],
156  l: Participant,
157) -> Zeroizing<F> {
158  let l = F::from(u64::from(u16::from(l)));
159  // This should never be reached since Participant is explicitly non-zero
160  assert!(l != F::ZERO, "zero participant passed to polynomial");
161  let mut share = Zeroizing::new(F::ZERO);
162  for (idx, coefficient) in coefficients.iter().rev().enumerate() {
163    *share += coefficient.deref();
164    if idx != (coefficients.len() - 1) {
165      *share *= l;
166    }
167  }
168  share
169}
170
171/// The secret share message, to be sent to the party it's intended for over an authenticated
172/// channel.
173///
174/// If any participant sends multiple secret shares to another participant, they are faulty.
175// This should presumably be written as SecretShare(Zeroizing<F::Repr>).
176// It's unfortunately not possible as F::Repr doesn't have Zeroize as a bound.
177// The encryption system also explicitly uses Zeroizing<M> so it can ensure anything being
178// encrypted is within Zeroizing. Accordingly, internally having Zeroizing would be redundant.
179#[derive(Clone, PartialEq, Eq)]
180pub struct SecretShare<F: PrimeField>(F::Repr);
181impl<F: PrimeField> AsRef<[u8]> for SecretShare<F> {
182  fn as_ref(&self) -> &[u8] {
183    self.0.as_ref()
184  }
185}
186impl<F: PrimeField> AsMut<[u8]> for SecretShare<F> {
187  fn as_mut(&mut self) -> &mut [u8] {
188    self.0.as_mut()
189  }
190}
191impl<F: PrimeField> fmt::Debug for SecretShare<F> {
192  fn fmt(&self, fmt: &mut fmt::Formatter<'_>) -> fmt::Result {
193    fmt.debug_struct("SecretShare").finish_non_exhaustive()
194  }
195}
196impl<F: PrimeField> Zeroize for SecretShare<F> {
197  fn zeroize(&mut self) {
198    self.0.as_mut().zeroize()
199  }
200}
201// Still manually implement ZeroizeOnDrop to ensure these don't stick around.
202// We could replace Zeroizing<M> with a bound M: ZeroizeOnDrop.
203// Doing so would potentially fail to highlight the expected behavior with these and remove a layer
204// of depth.
205impl<F: PrimeField> Drop for SecretShare<F> {
206  fn drop(&mut self) {
207    self.zeroize();
208  }
209}
210impl<F: PrimeField> ZeroizeOnDrop for SecretShare<F> {}
211
212impl<F: PrimeField> ReadWrite for SecretShare<F> {
213  fn read<R: Read>(reader: &mut R, _: ThresholdParams) -> io::Result<Self> {
214    let mut repr = F::Repr::default();
215    reader.read_exact(repr.as_mut())?;
216    Ok(SecretShare(repr))
217  }
218
219  fn write<W: Write>(&self, writer: &mut W) -> io::Result<()> {
220    writer.write_all(self.0.as_ref())
221  }
222}
223
224/// Advancement of the key generation state machine.
225#[derive(Zeroize)]
226pub struct SecretShareMachine<C: Ciphersuite> {
227  params: ThresholdParams,
228  context: String,
229  coefficients: Vec<Zeroizing<C::F>>,
230  our_commitments: Vec<C::G>,
231  encryption: Encryption<C>,
232}
233
234impl<C: Ciphersuite> fmt::Debug for SecretShareMachine<C> {
235  fn fmt(&self, fmt: &mut fmt::Formatter<'_>) -> fmt::Result {
236    fmt
237      .debug_struct("SecretShareMachine")
238      .field("params", &self.params)
239      .field("context", &self.context)
240      .field("our_commitments", &self.our_commitments)
241      .field("encryption", &self.encryption)
242      .finish_non_exhaustive()
243  }
244}
245
246impl<C: Ciphersuite> SecretShareMachine<C> {
247  /// Verify the data from the previous round (canonicity, PoKs, message authenticity)
248  #[allow(clippy::type_complexity)]
249  fn verify_r1<R: RngCore + CryptoRng>(
250    &mut self,
251    rng: &mut R,
252    mut commitment_msgs: HashMap<Participant, EncryptionKeyMessage<C, Commitments<C>>>,
253  ) -> Result<HashMap<Participant, Vec<C::G>>, FrostError<C>> {
254    validate_map(
255      &commitment_msgs,
256      &(1 ..= self.params.n()).map(Participant).collect::<Vec<_>>(),
257      self.params.i(),
258    )?;
259
260    let mut batch = BatchVerifier::<Participant, C::G>::new(commitment_msgs.len());
261    let mut commitments = HashMap::new();
262    for l in (1 ..= self.params.n()).map(Participant) {
263      let Some(msg) = commitment_msgs.remove(&l) else { continue };
264      let mut msg = self.encryption.register(l, msg);
265
266      if msg.commitments.len() != self.params.t().into() {
267        Err(FrostError::InvalidCommitments(l))?;
268      }
269
270      // Step 5: Validate each proof of knowledge
271      // This is solely the prep step for the latter batch verification
272      msg.sig.batch_verify(
273        rng,
274        &mut batch,
275        l,
276        msg.commitments[0],
277        challenge::<C>(&self.context, l, msg.sig.R.to_bytes().as_ref(), &msg.cached_msg),
278      );
279
280      commitments.insert(l, msg.commitments.drain(..).collect::<Vec<_>>());
281    }
282
283    batch.verify_vartime_with_vartime_blame().map_err(FrostError::InvalidCommitments)?;
284
285    commitments.insert(self.params.i, self.our_commitments.drain(..).collect());
286    Ok(commitments)
287  }
288
289  /// Continue generating a key.
290  ///
291  /// Takes in everyone else's commitments. Returns a HashMap of encrypted secret shares to be sent
292  /// over authenticated channels to their relevant counterparties.
293  ///
294  /// If any participant sends multiple secret shares to another participant, they are faulty.
295  #[allow(clippy::type_complexity)]
296  pub fn generate_secret_shares<R: RngCore + CryptoRng>(
297    mut self,
298    rng: &mut R,
299    commitments: HashMap<Participant, EncryptionKeyMessage<C, Commitments<C>>>,
300  ) -> Result<
301    (KeyMachine<C>, HashMap<Participant, EncryptedMessage<C, SecretShare<C::F>>>),
302    FrostError<C>,
303  > {
304    let commitments = self.verify_r1(&mut *rng, commitments)?;
305
306    // Step 1: Generate secret shares for all other parties
307    let mut res = HashMap::new();
308    for l in (1 ..= self.params.n()).map(Participant) {
309      // Don't insert our own shares to the byte buffer which is meant to be sent around
310      // An app developer could accidentally send it. Best to keep this black boxed
311      if l == self.params.i() {
312        continue;
313      }
314
315      let mut share = polynomial(&self.coefficients, l);
316      let share_bytes = Zeroizing::new(SecretShare::<C::F>(share.to_repr()));
317      share.zeroize();
318      res.insert(l, self.encryption.encrypt(rng, l, share_bytes));
319    }
320
321    // Calculate our own share
322    let share = polynomial(&self.coefficients, self.params.i());
323    self.coefficients.zeroize();
324
325    Ok((
326      KeyMachine { params: self.params, secret: share, commitments, encryption: self.encryption },
327      res,
328    ))
329  }
330}
331
332/// Advancement of the the secret share state machine.
333///
334/// This machine will 'complete' the protocol, by a local perspective. In order to be secure,
335/// the parties must confirm having successfully completed the protocol (an effort out of scope to
336/// this library), yet this is modeled by one more state transition (BlameMachine).
337pub struct KeyMachine<C: Ciphersuite> {
338  params: ThresholdParams,
339  secret: Zeroizing<C::F>,
340  commitments: HashMap<Participant, Vec<C::G>>,
341  encryption: Encryption<C>,
342}
343
344impl<C: Ciphersuite> fmt::Debug for KeyMachine<C> {
345  fn fmt(&self, fmt: &mut fmt::Formatter<'_>) -> fmt::Result {
346    fmt
347      .debug_struct("KeyMachine")
348      .field("params", &self.params)
349      .field("commitments", &self.commitments)
350      .field("encryption", &self.encryption)
351      .finish_non_exhaustive()
352  }
353}
354
355impl<C: Ciphersuite> Zeroize for KeyMachine<C> {
356  fn zeroize(&mut self) {
357    self.params.zeroize();
358    self.secret.zeroize();
359    for commitments in self.commitments.values_mut() {
360      commitments.zeroize();
361    }
362    self.encryption.zeroize();
363  }
364}
365
366// Calculate the exponent for a given participant and apply it to a series of commitments
367// Initially used with the actual commitments to verify the secret share, later used with
368// stripes to generate the verification shares
369fn exponential<C: Ciphersuite>(i: Participant, values: &[C::G]) -> Vec<(C::F, C::G)> {
370  let i = C::F::from(u16::from(i).into());
371  let mut res = Vec::with_capacity(values.len());
372  (0 .. values.len()).fold(C::F::ONE, |exp, l| {
373    res.push((exp, values[l]));
374    exp * i
375  });
376  res
377}
378
379fn share_verification_statements<C: Ciphersuite>(
380  target: Participant,
381  commitments: &[C::G],
382  mut share: Zeroizing<C::F>,
383) -> Vec<(C::F, C::G)> {
384  // This can be insecurely linearized from n * t to just n using the below sums for a given
385  // stripe. Doing so uses naive addition which is subject to malleability. The only way to
386  // ensure that malleability isn't present is to use this n * t algorithm, which runs
387  // per sender and not as an aggregate of all senders, which also enables blame
388  let mut values = exponential::<C>(target, commitments);
389
390  // Perform the share multiplication outside of the multiexp to minimize stack copying
391  // While the multiexp BatchVerifier does zeroize its flattened multiexp, and itself, it still
392  // converts whatever we give to an iterator and then builds a Vec internally, welcoming copies
393  let neg_share_pub = C::generator() * -*share;
394  share.zeroize();
395  values.push((C::F::ONE, neg_share_pub));
396
397  values
398}
399
400#[derive(Clone, Copy, Hash, Debug, Zeroize)]
401enum BatchId {
402  Decryption(Participant),
403  Share(Participant),
404}
405
406impl<C: Ciphersuite> KeyMachine<C> {
407  /// Calculate our share given the shares sent to us.
408  ///
409  /// Returns a BlameMachine usable to determine if faults in the protocol occurred.
410  ///
411  /// This will error on, and return a blame proof for, the first-observed case of faulty behavior.
412  pub fn calculate_share<R: RngCore + CryptoRng>(
413    mut self,
414    rng: &mut R,
415    mut shares: HashMap<Participant, EncryptedMessage<C, SecretShare<C::F>>>,
416  ) -> Result<BlameMachine<C>, FrostError<C>> {
417    validate_map(
418      &shares,
419      &(1 ..= self.params.n()).map(Participant).collect::<Vec<_>>(),
420      self.params.i(),
421    )?;
422
423    let mut batch = BatchVerifier::new(shares.len());
424    let mut blames = HashMap::new();
425    for (l, share_bytes) in shares.drain() {
426      let (mut share_bytes, blame) =
427        self.encryption.decrypt(rng, &mut batch, BatchId::Decryption(l), l, share_bytes);
428      let share =
429        Zeroizing::new(Option::<C::F>::from(C::F::from_repr(share_bytes.0)).ok_or_else(|| {
430          FrostError::InvalidShare { participant: l, blame: Some(blame.clone()) }
431        })?);
432      share_bytes.zeroize();
433      *self.secret += share.deref();
434
435      blames.insert(l, blame);
436      batch.queue(
437        rng,
438        BatchId::Share(l),
439        share_verification_statements::<C>(self.params.i(), &self.commitments[&l], share),
440      );
441    }
442    batch.verify_with_vartime_blame().map_err(|id| {
443      let (l, blame) = match id {
444        BatchId::Decryption(l) => (l, None),
445        BatchId::Share(l) => (l, Some(blames.remove(&l).unwrap())),
446      };
447      FrostError::InvalidShare { participant: l, blame }
448    })?;
449
450    // Stripe commitments per t and sum them in advance. Calculating verification shares relies on
451    // these sums so preprocessing them is a massive speedup
452    // If these weren't just sums, yet the tables used in multiexp, this would be further optimized
453    // As of right now, each multiexp will regenerate them
454    let mut stripes = Vec::with_capacity(usize::from(self.params.t()));
455    for t in 0 .. usize::from(self.params.t()) {
456      stripes.push(self.commitments.values().map(|commitments| commitments[t]).sum());
457    }
458
459    // Calculate each user's verification share
460    let mut verification_shares = HashMap::new();
461    for i in (1 ..= self.params.n()).map(Participant) {
462      verification_shares.insert(
463        i,
464        if i == self.params.i() {
465          C::generator() * self.secret.deref()
466        } else {
467          multiexp_vartime(&exponential::<C>(i, &stripes))
468        },
469      );
470    }
471
472    let KeyMachine { commitments, encryption, params, secret } = self;
473    Ok(BlameMachine {
474      commitments,
475      encryption,
476      result: Some(ThresholdCore {
477        params,
478        secret_share: secret,
479        group_key: stripes[0],
480        verification_shares,
481      }),
482    })
483  }
484}
485
486/// A machine capable of handling blame proofs.
487pub struct BlameMachine<C: Ciphersuite> {
488  commitments: HashMap<Participant, Vec<C::G>>,
489  encryption: Encryption<C>,
490  result: Option<ThresholdCore<C>>,
491}
492
493impl<C: Ciphersuite> fmt::Debug for BlameMachine<C> {
494  fn fmt(&self, fmt: &mut fmt::Formatter<'_>) -> fmt::Result {
495    fmt
496      .debug_struct("BlameMachine")
497      .field("commitments", &self.commitments)
498      .field("encryption", &self.encryption)
499      .finish_non_exhaustive()
500  }
501}
502
503impl<C: Ciphersuite> Zeroize for BlameMachine<C> {
504  fn zeroize(&mut self) {
505    for commitments in self.commitments.values_mut() {
506      commitments.zeroize();
507    }
508    self.encryption.zeroize();
509    self.result.zeroize();
510  }
511}
512
513impl<C: Ciphersuite> BlameMachine<C> {
514  /// Mark the protocol as having been successfully completed, returning the generated keys.
515  /// This should only be called after having confirmed, with all participants, successful
516  /// completion.
517  ///
518  /// Confirming successful completion is not necessarily as simple as everyone reporting their
519  /// completion. Everyone must also receive everyone's report of completion, entering into the
520  /// territory of consensus protocols. This library does not handle that nor does it provide any
521  /// tooling to do so. This function is solely intended to force users to acknowledge they're
522  /// completing the protocol, not processing any blame.
523  pub fn complete(self) -> ThresholdCore<C> {
524    self.result.unwrap()
525  }
526
527  fn blame_internal(
528    &self,
529    sender: Participant,
530    recipient: Participant,
531    msg: EncryptedMessage<C, SecretShare<C::F>>,
532    proof: Option<EncryptionKeyProof<C>>,
533  ) -> Participant {
534    let share_bytes = match self.encryption.decrypt_with_proof(sender, recipient, msg, proof) {
535      Ok(share_bytes) => share_bytes,
536      // If there's an invalid signature, the sender did not send a properly formed message
537      Err(DecryptionError::InvalidSignature) => return sender,
538      // Decryption will fail if the provided ECDH key wasn't correct for the given message
539      Err(DecryptionError::InvalidProof) => return recipient,
540    };
541
542    let Some(share) = Option::<C::F>::from(C::F::from_repr(share_bytes.0)) else {
543      // If this isn't a valid scalar, the sender is faulty
544      return sender;
545    };
546
547    // If this isn't a valid share, the sender is faulty
548    if !bool::from(
549      multiexp_vartime(&share_verification_statements::<C>(
550        recipient,
551        &self.commitments[&sender],
552        Zeroizing::new(share),
553      ))
554      .is_identity(),
555    ) {
556      return sender;
557    }
558
559    // The share was canonical and valid
560    recipient
561  }
562
563  /// Given an accusation of fault, determine the faulty party (either the sender, who sent an
564  /// invalid secret share, or the receiver, who claimed a valid secret share was invalid). No
565  /// matter which, prevent completion of the machine, forcing an abort of the protocol.
566  ///
567  /// The message should be a copy of the encrypted secret share from the accused sender to the
568  /// accusing recipient. This message must have been authenticated as actually having come from
569  /// the sender in question.
570  ///
571  /// In order to enable detecting multiple faults, an `AdditionalBlameMachine` is returned, which
572  /// can be used to determine further blame. These machines will process the same blame statements
573  /// multiple times, always identifying blame. It is the caller's job to ensure they're unique in
574  /// order to prevent multiple instances of blame over a single incident.
575  pub fn blame(
576    self,
577    sender: Participant,
578    recipient: Participant,
579    msg: EncryptedMessage<C, SecretShare<C::F>>,
580    proof: Option<EncryptionKeyProof<C>>,
581  ) -> (AdditionalBlameMachine<C>, Participant) {
582    let faulty = self.blame_internal(sender, recipient, msg, proof);
583    (AdditionalBlameMachine(self), faulty)
584  }
585}
586
587/// A machine capable of handling an arbitrary amount of additional blame proofs.
588#[derive(Debug, Zeroize)]
589pub struct AdditionalBlameMachine<C: Ciphersuite>(BlameMachine<C>);
590impl<C: Ciphersuite> AdditionalBlameMachine<C> {
591  /// Create an AdditionalBlameMachine capable of evaluating Blame regardless of if the caller was
592  /// a member in the DKG protocol.
593  ///
594  /// Takes in the parameters for the DKG protocol and all of the participant's commitment
595  /// messages.
596  ///
597  /// This constructor assumes the full validity of the commitment messages. They must be fully
598  /// authenticated as having come from the supposed party and verified as valid. Usage of invalid
599  /// commitments is considered undefined behavior, and may cause everything from inaccurate blame
600  /// to panics.
601  pub fn new<R: RngCore + CryptoRng>(
602    rng: &mut R,
603    context: String,
604    n: u16,
605    mut commitment_msgs: HashMap<Participant, EncryptionKeyMessage<C, Commitments<C>>>,
606  ) -> Result<Self, FrostError<C>> {
607    let mut commitments = HashMap::new();
608    let mut encryption = Encryption::new(context, None, rng);
609    for i in 1 ..= n {
610      let i = Participant::new(i).unwrap();
611      let Some(msg) = commitment_msgs.remove(&i) else { Err(DkgError::MissingParticipant(i))? };
612      commitments.insert(i, encryption.register(i, msg).commitments);
613    }
614    Ok(AdditionalBlameMachine(BlameMachine { commitments, encryption, result: None }))
615  }
616
617  /// Given an accusation of fault, determine the faulty party (either the sender, who sent an
618  /// invalid secret share, or the receiver, who claimed a valid secret share was invalid).
619  ///
620  /// The message should be a copy of the encrypted secret share from the accused sender to the
621  /// accusing recipient. This message must have been authenticated as actually having come from
622  /// the sender in question.
623  ///
624  /// This will process the same blame statement multiple times, always identifying blame. It is
625  /// the caller's job to ensure they're unique in order to prevent multiple instances of blame
626  /// over a single incident.
627  pub fn blame(
628    &self,
629    sender: Participant,
630    recipient: Participant,
631    msg: EncryptedMessage<C, SecretShare<C::F>>,
632    proof: Option<EncryptionKeyProof<C>>,
633  ) -> Participant {
634    self.0.blame_internal(sender, recipient, msg, proof)
635  }
636}