public Signiture To_standard(Secp256K1 secp) { var ret = new byte[65]; var err = Proxy.secp256k1_ecdsa_recoverable_signature_convert(secp.Ctx, ret, Value); if (err == 1) { return(Signiture.From(ret)); } throw new Exception("This should never happen!"); }
/// Constructs a signature for `msg` using the secret key `sk` and RFC6979 nonce /// Requires a signing-capable context. public Signiture Sign(Message msg, SecretKey sk) { if (Caps == ContextFlag.VerifyOnly || Caps == ContextFlag.None) { throw new Exception("IncapableContext"); } var ret = new byte[64]; //// We can assume the return value because it's not possible to construct //// an invalid signature from a valid `Message` and `SecretKey` if (Proxy.secp256k1_ecdsa_sign(Ctx, ret, msg.Value, sk.Value, IntPtr.Zero /* Proxy.secp256k1_nonce_function_rfc6979()*/, IntPtr.Zero) == 1) { return(Signiture.From(ret)); } throw new Exception("This should never happen!"); }