Synthetic nonce provider generates secret, not public nonces
MODIFY
WalletWasabi.Tests/UnitTests/Crypto/TranscriptTests.cs
WalletWasabi.Tests/UnitTests/Crypto/TranscriptTests.cs
@@ -67,24 +67,24 @@ namespace WalletWasabi.Tests.UnitTests.Crypto
transcript3.CommitPublicNonces(commitment2);
transcript4.CommitPublicNonces(commitment2);
- var publicNonceGenerator1 = transcript1.CreateSyntheticPublicNoncesProvider(witness1, rnd);
- var publicNonceGenerator2 = transcript2.CreateSyntheticPublicNoncesProvider(witness1, rnd);
- var publicNonceGenerator3 = transcript3.CreateSyntheticPublicNoncesProvider(witness2, rnd);
- var publicNonceGenerator4 = transcript4.CreateSyntheticPublicNoncesProvider(witness2, rnd);
+ var secretNonceProvider1 = transcript1.CreateSyntheticSecretNonceProvider(witness1, rnd);
+ var secretNonceProvider2 = transcript2.CreateSyntheticSecretNonceProvider(witness1, rnd);
+ var secretNonceProvider3 = transcript3.CreateSyntheticSecretNonceProvider(witness2, rnd);
+ var secretNonceProvider4 = transcript4.CreateSyntheticSecretNonceProvider(witness2, rnd);
- var publicNonce1 = publicNonceGenerator1.GetScalar();
- var publicNonce2 = publicNonceGenerator2.GetScalar();
- var publicNonce3 = publicNonceGenerator3.GetScalar();
- var publicNonce4 = publicNonceGenerator4.GetScalar();
+ var secretNonce1 = secretNonceProvider1.GetScalar();
+ var secretNonce2 = secretNonceProvider2.GetScalar();
+ var secretNonce3 = secretNonceProvider3.GetScalar();
+ var secretNonce4 = secretNonceProvider4.GetScalar();
- Assert.NotEqual(publicNonce1, publicNonce2);
- Assert.NotEqual(publicNonce1, publicNonce3);
- Assert.NotEqual(publicNonce1, publicNonce4);
+ Assert.NotEqual(secretNonce1, secretNonce2);
+ Assert.NotEqual(secretNonce1, secretNonce3);
+ Assert.NotEqual(secretNonce1, secretNonce4);
- Assert.NotEqual(publicNonce2, publicNonce3);
- Assert.NotEqual(publicNonce2, publicNonce4);
+ Assert.NotEqual(secretNonce2, secretNonce3);
+ Assert.NotEqual(secretNonce2, secretNonce4);
- Assert.NotEqual(publicNonce3, publicNonce4);
+ Assert.NotEqual(secretNonce3, secretNonce4);
}
}
}

RENAME
WalletWasabi/Crypto/ZeroKnowledge/SyntheticPublicNoncesProvider.cs
WalletWasabi/Crypto/ZeroKnowledge/SyntheticSecretNonceProvider.cs
@@ -6,11 +6,11 @@ using WalletWasabi.Crypto.StrobeProtocol;
namespace WalletWasabi.Crypto.ZeroKnowledge
{
- public class SyntheticPublicNoncesProvider
+ public class SyntheticSecretNonceProvider
{
private readonly Strobe128 _strobe;
- public SyntheticPublicNoncesProvider(Strobe128 strobe, IEnumerable<Scalar> secrets, WasabiRandom random)
+ public SyntheticSecretNonceProvider(Strobe128 strobe, IEnumerable<Scalar> secrets, WasabiRandom random)
{
_strobe = strobe;

MODIFY
WalletWasabi/Crypto/ZeroKnowledge/Transcript.cs
WalletWasabi/Crypto/ZeroKnowledge/Transcript.cs
@@ -19,7 +19,7 @@ namespace WalletWasabi.Crypto.ZeroKnowledge
private static readonly byte[] StatementTag = Encoding.UTF8.GetBytes("statement");
private static readonly byte[] ChallengeTag = Encoding.UTF8.GetBytes("challenge");
- private static readonly byte[] NonceTag = Encoding.UTF8.GetBytes("nonce-commitment");
+ private static readonly byte[] PublicNonceTag = Encoding.UTF8.GetBytes("nonce-commitment");
private static readonly byte[] DomainSeparatorTag = Encoding.UTF8.GetBytes("domain-separator");
/// <summary>
@@ -49,13 +49,13 @@ namespace WalletWasabi.Crypto.ZeroKnowledge
new Transcript(_strobe.MakeCopy());
// Generate synthetic nonce using current state combined with additional randomness.
- public SyntheticPublicNoncesProvider CreateSyntheticPublicNoncesProvider(IEnumerable<Scalar> secrets, WasabiRandom random)
- => new SyntheticPublicNoncesProvider(_strobe.MakeCopy(), secrets, random);
+ public SyntheticSecretNonceProvider CreateSyntheticSecretNonceProvider(IEnumerable<Scalar> secrets, WasabiRandom random)
+ => new SyntheticSecretNonceProvider(_strobe.MakeCopy(), secrets, random);
- public void CommitPublicNonces(IEnumerable<GroupElement> nonces)
+ public void CommitPublicNonces(IEnumerable<GroupElement> publicNonces)
{
- CryptoGuard.NotNullOrInfinity(nameof(nonces), nonces);
- AddMessages(NonceTag, nonces.Select(x => x.ToBytes()));
+ CryptoGuard.NotNullOrInfinity(nameof(publicNonces), publicNonces);
+ AddMessages(PublicNonceTag, publicNonces.Select(x => x.ToBytes()));
}
public void CommitStatement(Statement statement)

Synthetic nonce provider generates secret, not public nonces