var searchIndex = {}; searchIndex["secp256k1"] = {"doc":"# Secp256k1\nRust bindings for Pieter Wuille's secp256k1 library, which is used for\nfast and accurate manipulation of ECDSA signatures on the secp256k1\ncurve. Such signatures are used extensively by the Bitcoin network\nand its derivatives.","items":[[3,"RecoveryId","secp256k1","A tag used for recovering the public key from a compact signature",null,null],[3,"Signature","","An ECDSA signature",null,null],[3,"RecoverableSignature","","An ECDSA signature with a recovery ID for pubkey recovery",null,null],[3,"Message","","A (hashed) message input to an ECDSA signature",null,null],[3,"Secp256k1","","The secp256k1 engine, used to execute all signature operations",null,null],[4,"Error","","An ECDSA error",null,null],[13,"IncapableContext","","A `Secp256k1` was used for an operation, but it was not created to\nsupport this (so necessary precomputations have not been done)",0,null],[13,"IncorrectSignature","","Signature failed verification",0,null],[13,"InvalidMessage","","Badly sized message",0,null],[13,"InvalidPublicKey","","Bad public key",0,null],[13,"InvalidSignature","","Bad signature",0,null],[13,"InvalidSecretKey","","Bad secret key",0,null],[13,"InvalidRecoveryId","","Bad recovery id",0,null],[4,"ContextFlag","","Flags used to determine the capabilities of a `Secp256k1` object;\nthe more capabilities, the more expensive it is to create.",null,null],[13,"None","","Can neither sign nor verify signatures (cheapest to create, useful\nfor cases not involving signatures, such as creating keys from slices)",1,null],[13,"SignOnly","","Can sign but not verify signatures",1,null],[13,"VerifyOnly","","Can verify but not create signatures",1,null],[13,"Full","","Can verify and create signatures",1,null],[0,"constants","","# Constants\nConstants related to the API and the underlying curve",null,null],[17,"MESSAGE_SIZE","secp256k1::constants","The size (in bytes) of a message",null,null],[17,"SECRET_KEY_SIZE","","The size (in bytes) of a secret key",null,null],[17,"PUBLIC_KEY_SIZE","","The size (in bytes) of a public key array. This only needs to be 65\nbut must be 72 for compatibility with the `ArrayVec` library.",null,null],[17,"UNCOMPRESSED_PUBLIC_KEY_SIZE","","The size (in bytes) of an uncompressed public key",null,null],[17,"COMPRESSED_PUBLIC_KEY_SIZE","","The size (in bytes) of a compressed public key",null,null],[17,"MAX_SIGNATURE_SIZE","","The maximum size of a signature",null,null],[17,"COMPACT_SIGNATURE_SIZE","","The maximum size of a compact signature",null,null],[17,"CURVE_ORDER","","The order of the secp256k1 curve",null,null],[17,"GENERATOR_X","","The X coordinate of the generator",null,null],[17,"GENERATOR_Y","","The Y coordinate of the generator",null,null],[0,"ecdh","secp256k1","# ECDH\nSupport for shared secret computations",null,null],[3,"SharedSecret","secp256k1::ecdh","A tag used for recovering the public key from a compact signature",null,null],[11,"fmt","","",2,null],[11,"eq","","",2,null],[11,"ne","","",2,null],[11,"clone","","",2,null],[11,"new","","Creates a new shared secret from a pubkey and secret key",2,{"inputs":[{"name":"secp256k1"},{"name":"publickey"},{"name":"secretkey"}],"output":{"name":"sharedsecret"}}],[11,"as_ptr","","Obtains a raw pointer suitable for use with FFI functions",2,null],[11,"from","","",2,{"inputs":[{"name":"sharedsecret"}],"output":{"name":"sharedsecret"}}],[11,"index","","",2,null],[11,"index","","",2,null],[11,"index","","",2,null],[11,"index","","",2,null],[0,"ffi","secp256k1","# FFI bindings\nDirect bindings to the underlying C library functions. These should\nnot be needed for most users.",null,null],[3,"Context","secp256k1::ffi","A Secp256k1 context, containing various precomputed values and such\nneeded to do elliptic curve computations. If you create one of these\nwith `secp256k1_context_create` you MUST destroy it with\n`secp256k1_context_destroy`, or else you will have a memory leak.",null,null],[3,"PublicKey","","Library-internal representation of a Secp256k1 public key",null,null],[3,"Signature","","Library-internal representation of a Secp256k1 signature",null,null],[3,"RecoverableSignature","","Library-internal representation of a Secp256k1 signature + recovery ID",null,null],[3,"SharedSecret","","Library-internal representation of an ECDH shared secret",null,null],[7,"secp256k1_nonce_function_rfc6979","","",null,null],[7,"secp256k1_nonce_function_default","","",null,null],[5,"secp256k1_context_create","","",null,null],[5,"secp256k1_context_clone","","",null,null],[5,"secp256k1_context_destroy","","",null,null],[5,"secp256k1_context_randomize","","",null,null],[5,"secp256k1_ec_pubkey_parse","","",null,null],[5,"secp256k1_ec_pubkey_serialize","","",null,null],[5,"secp256k1_ecdsa_signature_parse_der","","",null,null],[5,"secp256k1_ecdsa_signature_parse_der_lax_","","",null,null],[5,"secp256k1_ecdsa_signature_serialize_der","","",null,null],[5,"secp256k1_ecdsa_recoverable_signature_parse_compact","","",null,null],[5,"secp256k1_ecdsa_recoverable_signature_serialize_compact","","",null,null],[5,"secp256k1_ecdsa_recoverable_signature_convert","","",null,null],[5,"secp256k1_ecdsa_signature_normalize","","",null,null],[5,"secp256k1_ecdsa_verify","","",null,null],[5,"secp256k1_ecdsa_sign","","",null,null],[5,"secp256k1_ecdsa_sign_recoverable","","",null,null],[5,"secp256k1_ecdsa_recover","","",null,null],[5,"secp256k1_ec_seckey_verify","","",null,null],[5,"secp256k1_ec_pubkey_create","","",null,null],[5,"secp256k1_ec_privkey_tweak_add","","",null,null],[5,"secp256k1_ec_pubkey_tweak_add","","",null,null],[5,"secp256k1_ec_privkey_tweak_mul","","",null,null],[5,"secp256k1_ec_pubkey_tweak_mul","","",null,null],[5,"secp256k1_ec_pubkey_combine","","",null,null],[5,"secp256k1_ecdh","","",null,null],[6,"NonceFn","","A nonce generation function. Ordinary users of the library\nnever need to see this type; only if you need to control\nnonce generation do you need to use it. I have deliberately\nmade this hard to do: you have to write your own wrapper\naround the FFI functions to use it. And it's an unsafe type.\nNonces are generated deterministically by RFC6979 by\ndefault; there should be no need to ever change this.",null,null],[17,"SECP256K1_START_NONE","","Flag for context to enable no precomputation",null,null],[17,"SECP256K1_START_VERIFY","","Flag for context to enable verification precomputation",null,null],[17,"SECP256K1_START_SIGN","","Flag for context to enable signing precomputation",null,null],[17,"SECP256K1_SER_UNCOMPRESSED","","Flag for keys to indicate uncompressed serialization format",null,null],[17,"SECP256K1_SER_COMPRESSED","","Flag for keys to indicate compressed serialization format",null,null],[11,"fmt","","",3,null],[11,"clone","","",3,null],[11,"as_ptr","","Converts the object to a raw pointer for FFI interfacing",4,null],[11,"as_mut_ptr","","Converts the object to a mutable raw pointer for FFI interfacing",4,null],[11,"len","","Returns the length of the object as an array",4,null],[11,"is_empty","","Returns whether the object as an array is empty",4,null],[11,"eq","","",4,null],[11,"clone","","",4,null],[11,"index","","",4,null],[11,"index","","",4,null],[11,"index","","",4,null],[11,"index","","",4,null],[11,"index","","",4,null],[11,"decode","","",4,{"inputs":[{"name":"d"}],"output":{"name":"result"}}],[11,"encode","","",4,null],[11,"deserialize","","",4,{"inputs":[{"name":"d"}],"output":{"name":"result"}}],[11,"serialize","","",4,null],[11,"fmt","","",4,null],[11,"new","","Create a new (zeroed) public key usable for the FFI interface",4,{"inputs":[],"output":{"name":"publickey"}}],[11,"blank","","Create a new (uninitialized) public key usable for the FFI interface",4,{"inputs":[],"output":{"name":"publickey"}}],[11,"as_ptr","","Converts the object to a raw pointer for FFI interfacing",5,null],[11,"as_mut_ptr","","Converts the object to a mutable raw pointer for FFI interfacing",5,null],[11,"len","","Returns the length of the object as an array",5,null],[11,"is_empty","","Returns whether the object as an array is empty",5,null],[11,"eq","","",5,null],[11,"clone","","",5,null],[11,"index","","",5,null],[11,"index","","",5,null],[11,"index","","",5,null],[11,"index","","",5,null],[11,"index","","",5,null],[11,"decode","","",5,{"inputs":[{"name":"d"}],"output":{"name":"result"}}],[11,"encode","","",5,null],[11,"deserialize","","",5,{"inputs":[{"name":"d"}],"output":{"name":"result"}}],[11,"serialize","","",5,null],[11,"fmt","","",5,null],[11,"as_ptr","","Converts the object to a raw pointer for FFI interfacing",6,null],[11,"as_mut_ptr","","Converts the object to a mutable raw pointer for FFI interfacing",6,null],[11,"len","","Returns the length of the object as an array",6,null],[11,"is_empty","","Returns whether the object as an array is empty",6,null],[11,"eq","","",6,null],[11,"clone","","",6,null],[11,"index","","",6,null],[11,"index","","",6,null],[11,"index","","",6,null],[11,"index","","",6,null],[11,"index","","",6,null],[11,"decode","","",6,{"inputs":[{"name":"d"}],"output":{"name":"result"}}],[11,"encode","","",6,null],[11,"deserialize","","",6,{"inputs":[{"name":"d"}],"output":{"name":"result"}}],[11,"serialize","","",6,null],[11,"fmt","","",6,null],[11,"new","","Create a new (zeroed) signature usable for the FFI interface",5,{"inputs":[],"output":{"name":"signature"}}],[11,"blank","","Create a new (uninitialized) signature usable for the FFI interface",5,{"inputs":[],"output":{"name":"signature"}}],[11,"new","","Create a new (zeroed) signature usable for the FFI interface",6,{"inputs":[],"output":{"name":"recoverablesignature"}}],[11,"blank","","Create a new (uninitialized) signature usable for the FFI interface",6,{"inputs":[],"output":{"name":"recoverablesignature"}}],[11,"as_ptr","","Converts the object to a raw pointer for FFI interfacing",7,null],[11,"as_mut_ptr","","Converts the object to a mutable raw pointer for FFI interfacing",7,null],[11,"len","","Returns the length of the object as an array",7,null],[11,"is_empty","","Returns whether the object as an array is empty",7,null],[11,"eq","","",7,null],[11,"clone","","",7,null],[11,"index","","",7,null],[11,"index","","",7,null],[11,"index","","",7,null],[11,"index","","",7,null],[11,"index","","",7,null],[11,"decode","","",7,{"inputs":[{"name":"d"}],"output":{"name":"result"}}],[11,"encode","","",7,null],[11,"deserialize","","",7,{"inputs":[{"name":"d"}],"output":{"name":"result"}}],[11,"serialize","","",7,null],[11,"fmt","","",7,null],[11,"new","","Create a new (zeroed) signature usable for the FFI interface",7,{"inputs":[],"output":{"name":"sharedsecret"}}],[11,"blank","","Create a new (uninitialized) signature usable for the FFI interface",7,{"inputs":[],"output":{"name":"sharedsecret"}}],[0,"key","secp256k1","# Public and secret keys",null,null],[3,"SecretKey","secp256k1::key","Secret 256-bit key used as `x` in an ECDSA signature",null,null],[3,"PublicKey","","A Secp256k1 public key, used for verification of signatures",null,null],[7,"ONE","","The number 1 encoded as a secret key",null,null],[11,"as_ptr","","Converts the object to a raw pointer for FFI interfacing",8,null],[11,"as_mut_ptr","","Converts the object to a mutable raw pointer for FFI interfacing",8,null],[11,"len","","Returns the length of the object as an array",8,null],[11,"is_empty","","Returns whether the object as an array is empty",8,null],[11,"eq","","",8,null],[11,"clone","","",8,null],[11,"index","","",8,null],[11,"index","","",8,null],[11,"index","","",8,null],[11,"index","","",8,null],[11,"index","","",8,null],[11,"decode","","",8,{"inputs":[{"name":"d"}],"output":{"name":"result"}}],[11,"encode","","",8,null],[11,"deserialize","","",8,{"inputs":[{"name":"d"}],"output":{"name":"result"}}],[11,"serialize","","",8,null],[11,"fmt","","",8,null],[11,"fmt","","",9,null],[11,"eq","","",9,null],[11,"ne","","",9,null],[11,"clone","","",9,null],[11,"new","","Creates a new random secret key",8,{"inputs":[{"name":"secp256k1"},{"name":"r"}],"output":{"name":"secretkey"}}],[11,"from_slice","","Converts a `SECRET_KEY_SIZE`-byte slice to a secret key",8,null],[11,"add_assign","","Adds one secret key to another, modulo the curve order",8,null],[11,"new","","Creates a new zeroed out public key",9,{"inputs":[],"output":{"name":"publickey"}}],[11,"is_valid","","Determines whether a pubkey is valid",9,null],[11,"as_ptr","","Obtains a raw pointer suitable for use with FFI functions",9,null],[11,"from_secret_key","","Creates a new public key from a secret key.",9,{"inputs":[{"name":"secp256k1"},{"name":"secretkey"}],"output":{"name":"result"}}],[11,"from_slice","","Creates a public key directly from a slice",9,null],[11,"serialize_vec","","Serialize the key as a byte-encoded pair of values. In compressed form\nthe y-coordinate is represented by only a single bit, as x determines\nit up to one bit.",9,null],[11,"add_exp_assign","","Adds the pk corresponding to `other` to the pk `self` in place",9,null],[11,"decode","","",9,{"inputs":[{"name":"d"}],"output":{"name":"result"}}],[11,"from","","",9,{"inputs":[{"name":"publickey"}],"output":{"name":"publickey"}}],[11,"encode","","",9,null],[11,"deserialize","","",9,{"inputs":[{"name":"d"}],"output":{"name":"result"}}],[11,"serialize","","",9,null],[11,"fmt","secp256k1","",10,null],[11,"eq","","",10,null],[11,"ne","","",10,null],[11,"clone","","",10,null],[11,"fmt","","",11,null],[11,"eq","","",11,null],[11,"ne","","",11,null],[11,"clone","","",11,null],[11,"fmt","","",12,null],[11,"eq","","",12,null],[11,"ne","","",12,null],[11,"clone","","",12,null],[11,"from_i32","","Allows library users to create valid recovery IDs from i32.",10,{"inputs":[{"name":"i32"}],"output":{"name":"result"}}],[11,"to_i32","","Allows library users to convert recovery IDs to i32.",10,null],[11,"from_der","","Converts a DER-encoded byte slice to a signature",11,null],[11,"from_der_lax","","Converts a "lax DER"-encoded byte slice to a signature. This is basically\nonly useful for validating signatures in the Bitcoin blockchain from before\n2016. It should never be used in new applications. This library does not\nsupport serializing to this "format"",11,null],[11,"normalize_s","","Normalizes a signature to a "low S" form. In ECDSA, signatures are\nof the form (r, s) where r and s are numbers lying in some finite\nfield. The verification equation will pass for (r, s) iff it passes\nfor (r, -s), so it is possible to ``modify'' signatures in transit\nby flipping the sign of s. This does not constitute a forgery since\nthe signed message still cannot be changed, but for some applications,\nchanging even the signature itself can be a problem. Such applications\nrequire a "strong signature". It is believed that ECDSA is a strong\nsignature except for this ambiguity in the sign of s, so to accomodate\nthese applications libsecp256k1 will only accept signatures for which\ns is in the lower half of the field range. This eliminates the\nambiguity.",11,null],[11,"as_ptr","","Obtains a raw pointer suitable for use with FFI functions",11,null],[11,"as_mut_ptr","","Obtains a raw mutable pointer suitable for use with FFI functions",11,null],[11,"serialize_der","","Serializes the signature in DER format",11,null],[11,"from","","",11,{"inputs":[{"name":"signature"}],"output":{"name":"signature"}}],[11,"from_compact","","Converts a compact-encoded byte slice to a signature. This\nrepresentation is nonstandard and defined by the libsecp256k1\nlibrary.",12,null],[11,"as_ptr","","Obtains a raw pointer suitable for use with FFI functions",12,null],[11,"serialize_compact","","Serializes the recoverable signature in compact format",12,null],[11,"to_standard","","Converts a recoverable signature to a non-recoverable one (this is needed\nfor verification",12,null],[11,"from","","",12,{"inputs":[{"name":"recoverablesignature"}],"output":{"name":"recoverablesignature"}}],[11,"index","","",11,null],[11,"index","","",11,null],[11,"index","","",11,null],[11,"index","","",11,null],[11,"as_ptr","","Converts the object to a raw pointer for FFI interfacing",13,null],[11,"as_mut_ptr","","Converts the object to a mutable raw pointer for FFI interfacing",13,null],[11,"len","","Returns the length of the object as an array",13,null],[11,"is_empty","","Returns whether the object as an array is empty",13,null],[11,"eq","","",13,null],[11,"clone","","",13,null],[11,"index","","",13,null],[11,"index","","",13,null],[11,"index","","",13,null],[11,"index","","",13,null],[11,"index","","",13,null],[11,"decode","","",13,{"inputs":[{"name":"d"}],"output":{"name":"result"}}],[11,"encode","","",13,null],[11,"deserialize","","",13,{"inputs":[{"name":"d"}],"output":{"name":"result"}}],[11,"serialize","","",13,null],[11,"fmt","","",13,null],[11,"from_slice","","Converts a `MESSAGE_SIZE`-byte slice to a message object",13,null],[11,"fmt","","",0,null],[11,"clone","","",0,null],[11,"eq","","",0,null],[11,"fmt","","",0,null],[11,"cause","","",0,null],[11,"description","","",0,null],[11,"fmt","","",1,null],[11,"clone","","",1,null],[11,"eq","","",1,null],[11,"fmt","","",1,null],[11,"clone","","",14,null],[11,"eq","","",14,null],[11,"fmt","","",14,null],[11,"drop","","",14,null],[11,"new","","Creates a new Secp256k1 context",14,{"inputs":[],"output":{"name":"secp256k1"}}],[11,"with_caps","","Creates a new Secp256k1 context with the specified capabilities",14,{"inputs":[{"name":"contextflag"}],"output":{"name":"secp256k1"}}],[11,"without_caps","","Creates a new Secp256k1 context with no capabilities (just de/serialization)",14,{"inputs":[],"output":{"name":"secp256k1"}}],[11,"randomize","","(Re)randomizes the Secp256k1 context for cheap sidechannel resistence;\nsee comment in libsecp256k1 commit d2275795f by Gregory Maxwell",14,null],[11,"generate_keypair","","Generates a random keypair. Convenience function for `key::SecretKey::new`\nand `key::PublicKey::from_secret_key`; call those functions directly for\nbatch key generation. Requires a signing-capable context.",14,null],[11,"sign","","Constructs a signature for `msg` using the secret key `sk` and nonce `nonce`.\nRequires a signing-capable context.",14,null],[11,"sign_recoverable","","Constructs a signature for `msg` using the secret key `sk` and nonce `nonce`.\nRequires a signing-capable context.",14,null],[11,"recover","","Determines the public key for which `sig` is a valid signature for\n`msg`. Returns through the out-pointer `pubkey`. Requires a verify-capable\ncontext.",14,null],[11,"verify","","Checks that `sig` is a valid ECDSA signature for `msg` using the public\nkey `pubkey`. Returns `Ok(true)` on success. Note that this function cannot\nbe used for Bitcoin consensus checking since there may exist signatures\nwhich OpenSSL would verify but not libsecp256k1, or vice-versa. Requires a\nverify-capable context.",14,null]],"paths":[[4,"Error"],[4,"ContextFlag"],[3,"SharedSecret"],[3,"Context"],[3,"PublicKey"],[3,"Signature"],[3,"RecoverableSignature"],[3,"SharedSecret"],[3,"SecretKey"],[3,"PublicKey"],[3,"RecoveryId"],[3,"Signature"],[3,"RecoverableSignature"],[3,"Message"],[3,"Secp256k1"]]}; initSearch(searchIndex);