Loading openssl/src/ec.rs +6 −8 Original line number Diff line number Diff line Loading @@ -295,7 +295,7 @@ impl EcKey { /// /// # Example /// /// ``` /// ```no_run /// use openssl::bn::BigNumContext; /// use openssl::ec::*; /// use openssl::nid; Loading @@ -304,13 +304,11 @@ impl EcKey { /// // get bytes from somewhere, i.e. this will not produce a valid key /// let public_key: Vec<u8> = vec![]; /// /// // create a PKey from the binary form of a EcPoint /// EcGroup::from_curve_name(nid::SECP256K1) /// .and_then(|group| BigNumContext::new().map(|ctx| (group, ctx))) /// .and_then(|(group, mut ctx)| EcPoint::from_bytes(&group, &public_key, &mut ctx) /// .map(|point| (group, point) )) /// .and_then(|(group, point)| EcKey::from_public_key(&group, &point)) /// .and_then(|ec_key| PKey::from_ec_key(ec_key)); /// // create an EcKey from the binary form of a EcPoint /// let group = EcGroup::from_curve_name(nid::SECP256K1).unwrap(); /// let mut ctx = BigNumContext::new().unwrap(); /// let point = EcPoint::from_bytes(&group, &public_key, &mut ctx).unwrap(); /// let key = EcKey::from_public_key(&group, &point); /// ``` pub fn from_public_key(group: &EcGroupRef, public_key: &EcPointRef) -> Result<EcKey, ErrorStack> { unsafe { Loading Loading
openssl/src/ec.rs +6 −8 Original line number Diff line number Diff line Loading @@ -295,7 +295,7 @@ impl EcKey { /// /// # Example /// /// ``` /// ```no_run /// use openssl::bn::BigNumContext; /// use openssl::ec::*; /// use openssl::nid; Loading @@ -304,13 +304,11 @@ impl EcKey { /// // get bytes from somewhere, i.e. this will not produce a valid key /// let public_key: Vec<u8> = vec![]; /// /// // create a PKey from the binary form of a EcPoint /// EcGroup::from_curve_name(nid::SECP256K1) /// .and_then(|group| BigNumContext::new().map(|ctx| (group, ctx))) /// .and_then(|(group, mut ctx)| EcPoint::from_bytes(&group, &public_key, &mut ctx) /// .map(|point| (group, point) )) /// .and_then(|(group, point)| EcKey::from_public_key(&group, &point)) /// .and_then(|ec_key| PKey::from_ec_key(ec_key)); /// // create an EcKey from the binary form of a EcPoint /// let group = EcGroup::from_curve_name(nid::SECP256K1).unwrap(); /// let mut ctx = BigNumContext::new().unwrap(); /// let point = EcPoint::from_bytes(&group, &public_key, &mut ctx).unwrap(); /// let key = EcKey::from_public_key(&group, &point); /// ``` pub fn from_public_key(group: &EcGroupRef, public_key: &EcPointRef) -> Result<EcKey, ErrorStack> { unsafe { Loading