pub enum PrivateKey {
Ed25519(PrivateKey),
P256(PrivateKey),
}Expand description
the private part of a KeyPair
Variants§
Implementations§
Source§impl PrivateKey
impl PrivateKey
Sourcepub fn to_bytes_hex(&self) -> String
pub fn to_bytes_hex(&self) -> String
serializes to an hex-encoded string
Sourcepub fn to_prefixed_string(&self) -> String
pub fn to_prefixed_string(&self) -> String
serializes to an hex-encoded string, prefixed with the key algorithm
Sourcepub fn from_bytes(bytes: &[u8], algorithm: Algorithm) -> Result<Self, Format>
pub fn from_bytes(bytes: &[u8], algorithm: Algorithm) -> Result<Self, Format>
deserializes from a byte array
Sourcepub fn from_bytes_hex(str: &str, algorithm: Algorithm) -> Result<Self, Format>
pub fn from_bytes_hex(str: &str, algorithm: Algorithm) -> Result<Self, Format>
deserializes from an hex-encoded string
pub fn from_der_with_algorithm( bytes: &[u8], algorithm: Algorithm, ) -> Result<Self, Format>
pub fn from_der(bytes: &[u8]) -> Result<Self, Format>
pub fn from_pem_with_algorithm( str: &str, algorithm: Algorithm, ) -> Result<Self, Format>
pub fn from_pem(str: &str) -> Result<Self, Format>
pub fn to_der(&self) -> Result<Zeroizing<Vec<u8>>, Format>
pub fn to_pem(&self) -> Result<Zeroizing<String>, Format>
pub fn algorithm(&self) -> Algorithm
Trait Implementations§
Source§impl Clone for PrivateKey
impl Clone for PrivateKey
Source§fn clone(&self) -> PrivateKey
fn clone(&self) -> PrivateKey
Returns a duplicate 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 FromStr for PrivateKey
impl FromStr 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