pub fn secp256k1_ecdsa_recover(sig: &[u8; 65], msg: &[u8; 32]) -> Result<[u8; 64], EcdsaVerifyError> {
	let mut pubkey = [0u8; 64];
	match unsafe {
		ext_secp256k1_ecdsa_recover.get()(msg.as_ptr(), sig.as_ptr(), pubkey.as_mut_ptr())
	} {
		0 => Ok(pubkey),
		1 => Err(EcdsaVerifyError::BadRS),
		2 => Err(EcdsaVerifyError::BadV),
		3 => Err(EcdsaVerifyError::BadSignature),
		_ => unreachable!("`ext_secp256k1_ecdsa_recover` only returns 0, 1, 2 or 3; qed"),
	}
}
/// Verify and recover a SECP256k1 ECDSA signature.
/// - `sig` is passed in RSV format. V should be either 0/1 or 27/28.
/// - returns `None` if the signature is bad, the 64-byte pubkey (doesn't include the 0x04 prefix).
Verify and recover a SECP256k1 ECDSA signature.
`sig` is passed in RSV format. V should be either 0/1 or 27/28.
returns `None` if the signature is bad, the 64-byte pubkey (doesn't include the 0x04 prefix).
Verify and recover a SECP256k1 ECDSA signature . ` sig ` is passed in RSV format . V should be either 0 / 1 or 27 / 28 . returns ` None ` if the signature is bad the 64 - byte pubkey ( doesn ' t include the 0x04 prefix ) .
pub fn secp256k1_ecdsa_recover(sig: &[u8; 65], msg: &[u8; 32]) -> Result<[u8; 64], EcdsaVerifyError> {
	let mut pubkey = [0u8; 64];
	match unsafe {
		ext_secp256k1_ecdsa_recover.get()(msg.as_ptr(), sig.as_ptr(), pubkey.as_mut_ptr())
	} {
		0 => Ok(pubkey),
		1 => Err(EcdsaVerifyError::BadRS),
		2 => Err(EcdsaVerifyError::BadV),
		3 => Err(EcdsaVerifyError::BadSignature),
		_ => unreachable!("`ext_secp256k1_ecdsa_recover` only returns 0, 1, 2 or 3; qed"),
	}
}
pub fn secp256k1_ecdsa_recover ( sig : & [ u8 ; 65 ] , msg : & [ u8 ; 32 ] ) -> Result < [ u8 ; 64 ] , EcdsaVerifyError > { let mut pubkey = [ 0u8 ; 64 ] ; match unsafe { ext_secp256k1_ecdsa_recover . get ( ) ( msg . as_ptr ( ) , sig . as_ptr ( ) , pubkey . as_mut_ptr ( ) ) } { 0 => Ok ( pubkey ) , 1 => Err ( EcdsaVerifyError :: BadRS ) , 2 => Err ( EcdsaVerifyError :: BadV ) , 3 => Err ( EcdsaVerifyError :: BadSignature ) , _ => unreachable ! ( " " ) , } }
Verify and recover a SECP256k1 ECDSA signature.
Verify and recover a SECP256k1 ECDSA signature .
sig
&[u8; 65]
msg
&[u8; 32]
sig
&[u8; 65]
msg
&[u8; 32]