Struct openssl::ec::EcKey []

pub struct EcKey(_);

Public and optional Private key on the given curve

OpenSSL documentation at EC_KEY_new

Methods

impl EcKey
[src]

[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.

OpenSSL documenation at EC_KEY_new_by_curve_name

[src]

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

[src]

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

[src]

Deprecated since 0.9.2

: use from_curve_name

[src]

Deserializes a PEM-formatted private key.

[src]

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

Panics

Panics if passphrase contains an embedded null.

[src]

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.

[src]

Deserializes a private key from DER-formatted data.

Methods from Deref<Target = EcKeyRef>

[src]

Serializes the private key to PEM.

[src]

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

[src]

Serializes the private key to DER.

[src]

Return [EcGroup] of the EcKey

OpenSSL documentation at EC_KEY_get0_group

[src]

Return [EcPoint] associated with the public key

OpenSSL documentation at EC_KEY_get0_pubic_key

[src]

Return [EcPoint] associated with the private key

OpenSSL documentation at EC_KEY_get0_private_key

[src]

Checks the key for validity.

OpenSSL documenation at EC_KEY_check_key

[src]

Create a copy of the EcKey to allow modification

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

Executes the destructor for this type. Read more

impl Deref for EcKey

The resulting type after dereferencing.

Dereferences the value.

impl DerefMut for EcKey

Mutably dereferences the value.

impl Borrow<EcKeyRef> for EcKey

Immutably borrows from an owned value. Read more

impl AsRef<EcKeyRef> for EcKey

Performs the conversion.

impl Send for EcKey
[src]

impl Sync for EcKey
[src]