@@ -295,7 +295,7 @@ impl EcKey {
295
295
///
296
296
/// # Example
297
297
///
298
- /// ```
298
+ /// ```no_run
299
299
/// use openssl::bn::BigNumContext;
300
300
/// use openssl::ec::*;
301
301
/// use openssl::nid;
@@ -304,13 +304,11 @@ impl EcKey {
304
304
/// // get bytes from somewhere, i.e. this will not produce a valid key
305
305
/// let public_key: Vec<u8> = vec![];
306
306
///
307
- /// // create a PKey from the binary form of a EcPoint
308
- /// EcGroup::from_curve_name(nid::SECP256K1)
309
- /// .and_then(|group| BigNumContext::new().map(|ctx| (group, ctx)))
310
- /// .and_then(|(group, mut ctx)| EcPoint::from_bytes(&group, &public_key, &mut ctx)
311
- /// .map(|point| (group, point) ))
312
- /// .and_then(|(group, point)| EcKey::from_public_key(&group, &point))
313
- /// .and_then(|ec_key| PKey::from_ec_key(ec_key));
307
+ /// // create an EcKey from the binary form of a EcPoint
308
+ /// let group = EcGroup::from_curve_name(nid::SECP256K1).unwrap();
309
+ /// let mut ctx = BigNumContext::new().unwrap();
310
+ /// let point = EcPoint::from_bytes(&group, &public_key, &mut ctx).unwrap();
311
+ /// let key = EcKey::from_public_key(&group, &point);
314
312
/// ```
315
313
pub fn from_public_key ( group : & EcGroupRef , public_key : & EcPointRef ) -> Result < EcKey , ErrorStack > {
316
314
unsafe {
0 commit comments