Struct libp2p_identity::secp256k1::SecretKey
source · pub struct SecretKey(_);
Available on crate feature
secp256k1
only.Expand description
A Secp256k1 secret key.
Implementations§
source§impl SecretKey
impl SecretKey
sourcepub fn from_bytes(sk: impl AsMut<[u8]>) -> Result<SecretKey, DecodingError>
👎Deprecated since 0.2.0: This method name does not follow Rust naming conventions, use SecretKey::try_from_bytes
instead.
pub fn from_bytes(sk: impl AsMut<[u8]>) -> Result<SecretKey, DecodingError>
SecretKey::try_from_bytes
instead.Create a secret key from a byte slice, zeroing the slice on success. If the bytes do not constitute a valid Secp256k1 secret key, an error is returned.
Note that the expected binary format is the same as libsecp256k1
’s.
sourcepub fn try_from_bytes(sk: impl AsMut<[u8]>) -> Result<SecretKey, DecodingError>
pub fn try_from_bytes(sk: impl AsMut<[u8]>) -> Result<SecretKey, DecodingError>
Create a secret key from a byte slice, zeroing the slice on success. If the bytes do not constitute a valid Secp256k1 secret key, an error is returned.
Note that the expected binary format is the same as libsecp256k1
’s.
sourcepub fn from_der(der: impl AsMut<[u8]>) -> Result<SecretKey, DecodingError>
pub fn from_der(der: impl AsMut<[u8]>) -> Result<SecretKey, DecodingError>
Decode a DER-encoded Secp256k1 secret key in an ECPrivateKey structure as defined in RFC5915, zeroing the input slice on success.
Trait Implementations§
Auto Trait Implementations§
impl RefUnwindSafe for SecretKey
impl Send for SecretKey
impl Sync for SecretKey
impl Unpin for SecretKey
impl UnwindSafe for SecretKey
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