Ejemplo n.º 1
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));
 }
Ejemplo n.º 2
0
 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));
 }
Ejemplo n.º 3
0
 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));
 }
        /// <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");
            }
        }
 /// <summary>
 /// Create a <see cref="ByteBuffer"/> from a <see cref="BbsKeyPair"/>
 /// </summary>
 /// <param name="buffer"></param>
 /// <returns></returns>
 internal ByteBuffer ToBuffer(BbsKeyPair keyPair) => ToBuffer(keyPair.PublicKey.ToArray());
 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));
 }