public VerifyProofRequest(BbsKeyPair publicKey, byte[] proof, IndexedMessage[] messages, string nonce)
 {
     Proof     = proof ?? throw new ArgumentNullException(nameof(proof));
     Messages  = messages ?? throw new ArgumentNullException(nameof(messages));
     Nonce     = nonce ?? throw new ArgumentNullException(nameof(nonce));
     PublicKey = publicKey ?? throw new ArgumentNullException(nameof(publicKey));
 }
 public BlindSignRequest(BlsKeyPair secretKey, BbsKeyPair publicKey, byte[] commitment, IndexedMessage[] messages)
 {
     SecretKey  = secretKey ?? throw new ArgumentNullException(nameof(secretKey));
     PublicKey  = publicKey ?? throw new ArgumentNullException(nameof(publicKey));
     Commitment = commitment ?? throw new ArgumentNullException(nameof(commitment));
     Messages   = messages ?? throw new ArgumentNullException(nameof(messages));
 }
Example #3
0
 public VerifyBlindedCommitmentRequest(BbsKeyPair publicKey, byte[] proof, uint[] blindedIndices, string nonce)
 {
     PublicKey      = publicKey ?? throw new ArgumentNullException(nameof(publicKey));
     Proof          = proof ?? throw new ArgumentNullException(nameof(proof));
     BlindedIndices = blindedIndices ?? throw new ArgumentNullException(nameof(blindedIndices));
     Nonce          = nonce ?? throw new ArgumentNullException(nameof(nonce));
 }
        /// <summary>
        /// Initializes a new instance of the <see cref="CreateProofRequest"/> class.
        /// </summary>
        /// <param name="publicKey">Public key of the original signer of the signature</param>
        /// <param name="messages">The messages that were originally signed</param>
        /// <param name="signature">BBS signature to generate the BBS proof from</param>
        /// <param name="blindingFactor">The blinding factor used in blinded signature, if any messages are hidden using <see cref="ProofMessageType.HiddenExternalBlinding"/></param>
        /// <param name="nonce">A nonce for the resulting proof</param>
        /// <exception cref="System.ArgumentNullException">
        /// publicKey
        /// or
        /// messages
        /// or
        /// signature
        /// or
        /// nonce
        /// or
        /// Blinding factor must be provided
        /// </exception>
        public CreateProofRequest(BbsKeyPair publicKey, ProofMessage[] messages, byte[] signature, byte[]?blindingFactor, string nonce)
        {
            PublicKey      = publicKey ?? throw new ArgumentNullException(nameof(publicKey));
            Messages       = messages ?? throw new ArgumentNullException(nameof(messages));
            Signature      = signature ?? throw new ArgumentNullException(nameof(signature));
            BlindingFactor = blindingFactor;
            Nonce          = nonce ?? throw new ArgumentNullException(nameof(nonce));

            if (messages.Any(x => x.ProofType == ProofMessageType.HiddenExternalBlinding) && blindingFactor == null)
            {
                throw new ArgumentNullException("Blinding factor must be provided");
            }
        }
Example #5
0
 public CreateBlindedCommitmentRequest(BbsKeyPair publicKey, IndexedMessage[] messages, string nonce)
 {
     PublicKey = publicKey ?? throw new ArgumentNullException(nameof(publicKey));
     Messages  = messages ?? throw new ArgumentNullException(nameof(messages));
     Nonce     = nonce ?? throw new ArgumentNullException(nameof(nonce));
 }
Example #6
0
 public VerifyRequest(BbsKeyPair keyPair, byte[] signature, string[] messages)
 {
     KeyPair   = keyPair ?? throw new ArgumentNullException(nameof(keyPair));
     Signature = signature ?? throw new ArgumentNullException(nameof(signature));
     Messages  = messages ?? throw new ArgumentNullException(nameof(messages));
 }
Example #7
0
 /// <summary>
 /// Create a <see cref="ByteBuffer"/> from a <see cref="BbsKeyPair"/>
 /// </summary>
 /// <param name="buffer"></param>
 /// <returns></returns>
 internal static ByteBuffer ToBuffer(this UnmanagedMemoryContext context, BbsKeyPair keyPair) => context.ToBuffer(keyPair.PublicKey.ToArray());