Struct openssl::ec::EcKey
[−]
[src]
pub struct EcKey(_);
Methods
impl EcKey
[src]
fn from_curve_name(nid: Nid) -> Result<EcKey, ErrorStack>
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
.
fn generate(group: &EcGroupRef) -> Result<EcKey, ErrorStack>
Generates a new public/private key pair on the specified curve.
fn new_by_curve_name(nid: Nid) -> Result<EcKey, ErrorStack>
: use from_curve_name
fn private_key_from_pem(pem: &[u8]) -> Result<EcKey, ErrorStack>
Deserializes a PEM-formatted private key.
fn private_key_from_pem_passphrase(pem: &[u8],
passphrase: &[u8])
-> Result<EcKey, ErrorStack>
passphrase: &[u8])
-> Result<EcKey, ErrorStack>
Deserializes a PEM-formatted private key, using the supplied password if the key is encrypted.
Panics
Panics if passphrase
contains an embedded null.
fn private_key_from_pem_callback<F>(pem: &[u8],
callback: F)
-> Result<EcKey, ErrorStack> where F: FnOnce(&mut [u8]) -> Result<usize, ErrorStack>
callback: F)
-> Result<EcKey, ErrorStack> where F: FnOnce(&mut [u8]) -> Result<usize, ErrorStack>
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.
fn private_key_from_der(der: &[u8]) -> Result<EcKey, ErrorStack>
Deserializes a private key from DER-formatted data.
Methods from Deref<Target=EcKeyRef>
fn private_key_to_pem(&self) -> Result<Vec<u8>, ErrorStack>
Serializes the private key to PEM.
fn private_key_to_pem_passphrase(&self,
cipher: Cipher,
passphrase: &[u8])
-> Result<Vec<u8>, ErrorStack>
cipher: Cipher,
passphrase: &[u8])
-> Result<Vec<u8>, ErrorStack>
Serializes the private key to PEM, encrypting it with the specified symmetric cipher and passphrase.
fn private_key_to_der(&self) -> Result<Vec<u8>, ErrorStack>
Serializes the private key to DER.
fn group(&self) -> Option<&EcGroupRef>
fn public_key(&self) -> Option<&EcPointRef>
fn private_key(&self) -> Option<&BigNumRef>
fn check_key(&self) -> Result<(), ErrorStack>
Checks the key for validity.
Trait Implementations
impl OpenSslType for EcKey
[src]
type CType = EC_KEY
The raw C type.
type Ref = EcKeyRef
The type representing a reference to this type.
unsafe fn from_ptr(ptr: *mut EC_KEY) -> EcKey
Constructs an instance of this type from its raw type.
impl Drop for EcKey
[src]
impl Deref for EcKey
[src]
type Target = EcKeyRef
The resulting type after dereferencing
fn deref(&self) -> &EcKeyRef
The method called to dereference a value