pub struct PrivateKey(/* private fields */);
Expand description
Represents a private key
Implementations§
Source§impl PrivateKey
impl PrivateKey
Sourcepub fn decode(s: impl Into<SecretString>) -> Result<Self, PrivateKeyParseError>
pub fn decode(s: impl Into<SecretString>) -> Result<Self, PrivateKeyParseError>
Decode a key from the given string in <algo>:<base64 data>
form.
Sourcepub fn encode(&self) -> Zeroizing<String>
pub fn encode(&self) -> Zeroizing<String>
Encode the key as a string in <algo>:<base64 data>
form.
Sourcepub fn signature_algorithm(&self) -> SignatureAlgorithm
pub fn signature_algorithm(&self) -> SignatureAlgorithm
Get the signature algorithm used for by this key
Sourcepub fn bytes(&self) -> Vec<u8> ⓘ
pub fn bytes(&self) -> Vec<u8> ⓘ
Get the keys representation as bytes (not including an algorithm specifier)
Sourcepub fn sign(&self, msg: &[u8]) -> Result<Signature, SignatureError>
pub fn sign(&self, msg: &[u8]) -> Result<Signature, SignatureError>
Sign a given message with this key
pub fn public_key(&self) -> PublicKey
Trait Implementations§
Source§impl From<SigningKey<NistP256>> for PrivateKey
impl From<SigningKey<NistP256>> for PrivateKey
Source§fn from(key: SigningKey) -> Self
fn from(key: SigningKey) -> Self
Converts to this type from the input type.
Source§impl TryFrom<String> for PrivateKey
impl TryFrom<String> for PrivateKey
Source§type Error = PrivateKeyParseError
type Error = PrivateKeyParseError
The type returned in the event of a conversion error.
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