pub struct SecretKey { /* private fields */ }Expand description
A SecretKey is used to create signatures.
Implementations§
Source§impl SecretKey
impl SecretKey
Sourcepub fn is_encrypted(&self) -> bool
pub fn is_encrypted(&self) -> bool
Returns true if this secret key is encrypted and requires a password to use.
This checks both the encryption algorithm and whether the key material has been properly decrypted.
Sourcepub fn from_bytes(bytes_buf: &[u8]) -> Result<SecretKey>
pub fn from_bytes(bytes_buf: &[u8]) -> Result<SecretKey>
Deserialize a SecretKey.
For storage, a SecretKeyBox is usually what you need instead.
Sourcepub fn to_bytes(&self) -> Vec<u8> ⓘ
pub fn to_bytes(&self) -> Vec<u8> ⓘ
Serialize a SecretKey.
For storage, a SecretKeyBox is usually what you need instead.
Sourcepub fn from_box(
sk_box: SecretKeyBox,
password: Option<String>,
) -> Result<SecretKey>
pub fn from_box( sk_box: SecretKeyBox, password: Option<String>, ) -> Result<SecretKey>
Convert a SecretKeyBox to a SecretKey.
If password is None, a password is going to be prompted interactively.
Sourcepub fn from_unencrypted_box(sk_box: SecretKeyBox) -> Result<SecretKey>
pub fn from_unencrypted_box(sk_box: SecretKeyBox) -> Result<SecretKey>
Convert an unencrypted SecretKeyBox to an unencrypted SecretKey.
Trait Implementations§
impl Eq for SecretKey
Auto Trait Implementations§
impl Freeze for SecretKey
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