Struct openssl::ec::EcKey []

pub struct EcKey(_);

Methods

impl EcKey
[src]

Constructs an EcKey corresponding to a known curve.

It will not have an associated public or private key. This kind of key is primarily useful to be provided to the set_tmp_ecdh methods on Ssl and SslContextBuilder.

Constructs an EcKey from the specified group with the associated EcPoint, public_key.

This will only have the associated public_key.

Example

use openssl::bn::BigNumContext;
use openssl::ec::*;
use openssl::nid;
use openssl::pkey::PKey;

// get bytes from somewhere, i.e. this will not produce a valid key
let public_key: Vec<u8> = vec![];

// 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);

Generates a new public/private key pair on the specified curve.

Deprecated since 0.9.2

: use from_curve_name

Deserializes a PEM-formatted private key.

Deserializes a PEM-formatted private key, using the supplied password if the key is encrypted.

Panics

Panics if passphrase contains an embedded null.

Deserializes a PEM-formatted private key, using a callback to retrieve a password if the key is encrypted.

The callback should copy the password into the provided buffer and return the number of bytes written.

Deserializes a private key from DER-formatted data.

Methods from Deref<Target=EcKeyRef>

Serializes the private key to PEM.

Serializes the private key to PEM, encrypting it with the specified symmetric cipher and passphrase.

Serializes the private key to DER.

Checks the key for validity.

Trait Implementations

impl ForeignType for EcKey

The raw C type.

The type representing a reference to this type.

Constructs an instance of this type from its raw type.

Returns a raw pointer to the wrapped value.

impl Drop for EcKey

A method called when the value goes out of scope. Read more

impl Deref for EcKey

The resulting type after dereferencing

The method called to dereference a value

impl DerefMut for EcKey

The method called to mutably dereference a value