pub struct PrivateKey { /* private fields */ }
Expand description
Privatekey, a keypair for performing ECDH and blinding operations.
Implementations§
Source§impl PrivateKey
impl PrivateKey
Sourcepub fn from_bytes(b: &[u8]) -> Result<PrivateKey, KeyError>
pub fn from_bytes(b: &[u8]) -> Result<PrivateKey, KeyError>
from_bytes creates a new keypair from the given bytes
Sourcepub fn from_pem_files(
priv_file: String,
pub_file: String,
) -> Result<PrivateKey, KeyError>
pub fn from_pem_files( priv_file: String, pub_file: String, ) -> Result<PrivateKey, KeyError>
Load private and public PEM files.
Sourcepub fn load_bytes(&mut self, b: &[u8]) -> Result<(), KeyError>
pub fn load_bytes(&mut self, b: &[u8]) -> Result<(), KeyError>
load_bytes loads a key from the given bytes.
Sourcepub fn to_pem_files(
&self,
priv_file: String,
pub_file: String,
) -> Result<(), KeyError>
pub fn to_pem_files( &self, priv_file: String, pub_file: String, ) -> Result<(), KeyError>
to_pem_files writes the public and privates keys to two PEM files.
Sourcepub fn regenerate<R: Rng>(&mut self, rng: &mut R) -> Result<(), KeyError>
pub fn regenerate<R: Rng>(&mut self, rng: &mut R) -> Result<(), KeyError>
regenerate uses the given rng to generate a new key.
Sourcepub fn public_key(&self) -> PublicKey
pub fn public_key(&self) -> PublicKey
public_key returns the PublicKey
Trait Implementations§
Source§impl Clone for PrivateKey
impl Clone for PrivateKey
Source§fn clone(&self) -> PrivateKey
fn clone(&self) -> PrivateKey
Returns a copy of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreSource§impl Debug for PrivateKey
impl Debug for PrivateKey
Source§impl Default for PrivateKey
impl Default for PrivateKey
Source§impl PartialEq for PrivateKey
impl PartialEq for PrivateKey
impl StructuralPartialEq for PrivateKey
Auto Trait Implementations§
impl Freeze for PrivateKey
impl RefUnwindSafe for PrivateKey
impl Send for PrivateKey
impl Sync for PrivateKey
impl Unpin for PrivateKey
impl UnwindSafe for PrivateKey
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> Clear for Twhere
T: InitializableFromZeroed + ?Sized,
impl<T> Clear for Twhere
T: InitializableFromZeroed + ?Sized,
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> InitializableFromZeroed for Twhere
T: Default,
impl<T> InitializableFromZeroed for Twhere
T: Default,
Source§unsafe fn initialize(place: *mut T)
unsafe fn initialize(place: *mut T)
Called to initialize a place to a valid value, after it is set
to all-bits-zero. Read more