[−][src]Trait nitrokey::GetPasswordSafe
Provides access to a PasswordSafe
.
The device that implements this trait must always live at least as long as a password safe retrieved from it.
Required methods
fn get_password_safe(
&mut self,
user_pin: &str
) -> Result<PasswordSafe<'_, 'a>, Error>
&mut self,
user_pin: &str
) -> Result<PasswordSafe<'_, 'a>, Error>
Enables and returns the password safe.
The underlying device must always live at least as long as a password safe retrieved from
it. It is mandatory to lock the underlying device using lock
after the password safe
has been used. Otherwise, other applications can access the password store without
authentication.
If this method returns an AesDecryptionFailed
(Nitrokey Pro) or Unknown
(Nitrokey
Storage) error, the AES data object on the smart card could not be accessed. This problem
occurs after a factory reset using gpg --card-edit
and can be fixed using the
Device::build_aes_key
command.
Errors
AesDecryptionFailed
if the secret for the password safe could not be decrypted (Nitrokey Pro only)InvalidString
if one of the provided passwords contains a null byteUnknown
if the secret for the password safe could not be decrypted (Nitrokey Storage only)WrongPassword
if the current user password is wrong
Example
use nitrokey::{Device, GetPasswordSafe, PasswordSafe}; fn use_password_safe(pws: &PasswordSafe) {} let mut manager = nitrokey::take()?; let mut device = manager.connect()?; match device.get_password_safe("123456") { Ok(pws) => { use_password_safe(&pws); }, Err(err) => eprintln!("Could not open the password safe: {}", err), }; device.lock()?;
Implementors
impl<'a> GetPasswordSafe<'a> for DeviceWrapper<'a>
[src]
fn get_password_safe(
&mut self,
user_pin: &str
) -> Result<PasswordSafe<'_, 'a>, Error>
[src]
&mut self,
user_pin: &str
) -> Result<PasswordSafe<'_, 'a>, Error>
impl<'a> GetPasswordSafe<'a> for Pro<'a>
[src]
fn get_password_safe(
&mut self,
user_pin: &str
) -> Result<PasswordSafe<'_, 'a>, Error>
[src]
&mut self,
user_pin: &str
) -> Result<PasswordSafe<'_, 'a>, Error>
impl<'a> GetPasswordSafe<'a> for Storage<'a>
[src]
fn get_password_safe(
&mut self,
user_pin: &str
) -> Result<PasswordSafe<'_, 'a>, Error>
[src]
&mut self,
user_pin: &str
) -> Result<PasswordSafe<'_, 'a>, Error>