aboutsummaryrefslogtreecommitdiff
path: root/openssl/src
diff options
context:
space:
mode:
authorSteven Fackler <[email protected]>2017-01-03 15:33:45 -0800
committerSteven Fackler <[email protected]>2017-01-03 15:33:45 -0800
commitdbd6134fd66ef5947013c185f3fa44d8ee8e288e (patch)
tree9eeaa2949ad63be414bb07e8d504866f978d3db4 /openssl/src
parentMerge pull request #547 from sfackler/x509-stack (diff)
downloadrust-openssl-dbd6134fd66ef5947013c185f3fa44d8ee8e288e.tar.xz
rust-openssl-dbd6134fd66ef5947013c185f3fa44d8ee8e288e.zip
Clean up EcKey example a bit
Diffstat (limited to 'openssl/src')
-rw-r--r--openssl/src/ec.rs14
1 files changed, 6 insertions, 8 deletions
diff --git a/openssl/src/ec.rs b/openssl/src/ec.rs
index 94b11e93..592c4026 100644
--- a/openssl/src/ec.rs
+++ b/openssl/src/ec.rs
@@ -295,7 +295,7 @@ impl EcKey {
///
/// # Example
///
- /// ```
+ /// ```no_run
/// use openssl::bn::BigNumContext;
/// use openssl::ec::*;
/// use openssl::nid;
@@ -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 {