Пример #1
0
        public Proof(GroupElementVector publicNonces, ScalarVector responses)
        {
            CryptoGuard.NotNullOrInfinity(nameof(publicNonces), publicNonces);
            Guard.NotNullOrEmpty(nameof(responses), responses);

            PublicNonces = publicNonces;
            Responses    = responses;
        }
Пример #2
0
        public Proof(GroupElementVector publicNonces, IEnumerable <ScalarVector> allResponses)
        {
            CryptoGuard.NotNullOrInfinity(nameof(publicNonces), publicNonces);
            Guard.NotNullOrEmpty(nameof(allResponses), allResponses);

            // Ensure allResponses isn't jagged
            var n = allResponses.First().Count();

            Guard.True(nameof(allResponses), allResponses.All(responses => Guard.NotNullOrEmpty(nameof(responses), responses).Count() == n));

            // Ensure there is a vector of response scalars for each public nonce
            Guard.True(nameof(allResponses), allResponses.Count() == publicNonces.Count());

            PublicNonces = publicNonces;
            Responses    = allResponses;
        }
Пример #3
0
 public Statement(GroupElement publicPoint, IEnumerable <GroupElement> generators)
 {
     PublicPoint = CryptoGuard.NotNullOrInfinity(nameof(publicPoint), publicPoint);
     Generators  = CryptoGuard.NotNullOrInfinity(nameof(generators), generators);
 }
Пример #4
0
 public void CommitPublicNonces(IEnumerable <GroupElement> publicNonces)
 {
     CryptoGuard.NotNullOrInfinity(nameof(publicNonces), publicNonces);
     AddMessages(PublicNonceTag, publicNonces.Select(x => x.ToBytes()));
 }
Пример #5
0
 public void CommitStatement(LinearRelation.Statement statement)
 {
     Guard.NotNull(nameof(statement.Generators), statement.Generators);
     CryptoGuard.NotNullOrInfinity(nameof(statement.PublicPoints), statement.PublicPoints);
     AddMessages(StatementTag, statement.PublicPoints.Select(x => x.ToBytes()).Concat(statement.Generators.Select(x => x.ToBytes())));
 }