コード例 #1
0
 /// <summary>
 /// Verify schnorr signature.
 /// </summary>
 /// <param name="signature">schnorr signature</param>
 /// <param name="msg">32-byte msg</param>
 /// <param name="schnorrPubkey">pubkey</param>
 /// <returns>verify result</returns>
 public static bool Verify(SchnorrSignature signature, ByteData msg, SchnorrPubkey schnorrPubkey)
 {
     if (signature is null)
     {
         throw new ArgumentNullException(nameof(signature));
     }
     if (msg is null)
     {
         throw new ArgumentNullException(nameof(msg));
     }
     if (schnorrPubkey is null)
     {
         throw new ArgumentNullException(nameof(schnorrPubkey));
     }
     using (var handle = new ErrorHandle())
     {
         var ret = NativeMethods.CfdVerifySchnorr(
             handle.GetHandle(), signature.ToHexString(),
             msg.ToHexString(),
             schnorrPubkey.ToHexString());
         if (ret == CfdErrorCode.Success)
         {
             return(true);
         }
         else if (ret != CfdErrorCode.SignVerificationError)
         {
             handle.ThrowError(ret);
         }
     }
     return(false);
 }
コード例 #2
0
 /// <summary>
 /// Verify schnorr signature.
 /// </summary>
 /// <param name="signature">schnorr signature</param>
 /// <param name="msg">32-byte msg</param>
 /// <returns>verify result</returns>
 public bool Verify(SchnorrSignature signature, ByteData msg)
 {
     return(SchnorrUtil.Verify(signature, msg, this));
 }