pub struct SecretKey {
pub sk: SecretKey,
}
Expand description
A secret key.
Fields§
§sk: SecretKey
Implementations§
Source§impl SecretKey
impl SecretKey
Sourcepub fn from_bytes(sk: &[u8]) -> Result<Self, WSError>
pub fn from_bytes(sk: &[u8]) -> Result<Self, WSError>
Create a secret key from raw bytes.
Sourcepub fn from_file(file: impl AsRef<Path>) -> Result<Self, WSError>
pub fn from_file(file: impl AsRef<Path>) -> Result<Self, WSError>
Read a secret key from a file.
Sourcepub fn to_file(&self, file: impl AsRef<Path>) -> Result<(), WSError>
pub fn to_file(&self, file: impl AsRef<Path>) -> Result<(), WSError>
Save a secret key to a file.
Sourcepub fn from_openssh(lines: &str) -> Result<Self, WSError>
pub fn from_openssh(lines: &str) -> Result<Self, WSError>
Parse an OpenSSH secret key.
Source§impl SecretKey
impl SecretKey
Sourcepub fn sign_multi(
&self,
module: Module,
key_id: Option<&Vec<u8>>,
detached: bool,
allow_extensions: bool,
) -> Result<(Module, Vec<u8>), WSError>
pub fn sign_multi( &self, module: Module, key_id: Option<&Vec<u8>>, detached: bool, allow_extensions: bool, ) -> Result<(Module, Vec<u8>), WSError>
Sign a module with the secret key.
If the module was already signed, the new signature is added to the existing ones.
key_id
is the key identifier of the public key, to be stored with the signature.
This parameter is optional.
detached
prevents the signature from being embedded.
allow_extensions
allows new sections to be added to the module later, while retaining the ability for the original module to be verified.
Source§impl SecretKey
impl SecretKey
Sourcepub fn sign(
&self,
module: Module,
key_id: Option<&Vec<u8>>,
) -> Result<Module, WSError>
pub fn sign( &self, module: Module, key_id: Option<&Vec<u8>>, ) -> Result<Module, WSError>
Sign a module with the secret key.
If the module was already signed, the signature is replaced.
key_id
is the key identifier of the public key, to be stored with the signature.
This parameter is optional.