Struct libp2p_identity::ecdsa::SecretKey
source · pub struct SecretKey(_);
Available on crate feature
ecdsa
only.Expand description
An ECDSA secret key generated using secp256r1
curve.
Implementations§
source§impl SecretKey
impl SecretKey
sourcepub fn sign(&self, msg: &[u8]) -> Vec<u8>
pub fn sign(&self, msg: &[u8]) -> Vec<u8>
Sign a message with this secret key, producing a DER-encoded ECDSA signature.
sourcepub fn to_bytes(&self) -> Vec<u8>
pub fn to_bytes(&self) -> Vec<u8>
Convert a secret key into a byte buffer containing raw scalar of the key.
sourcepub fn from_bytes(buf: &[u8]) -> Result<Self, 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(buf: &[u8]) -> Result<Self, DecodingError>
SecretKey::try_from_bytes
insteadDecode a secret key from a byte buffer containing raw scalar of the key.
sourcepub fn try_from_bytes(buf: impl AsRef<[u8]>) -> Result<SecretKey, DecodingError>
pub fn try_from_bytes(buf: impl AsRef<[u8]>) -> Result<SecretKey, DecodingError>
Try to parse a secret key from a byte buffer containing raw scalar of the key.
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