pub struct Recipient { /* private fields */ }Expand description
A passphrase-based recipient. Anyone with the passphrase can decrypt the file.
If an scrypt::Recipient is used, it must be the only recipient for the file: it
can’t be mixed with other recipient types and can’t be used multiple times for the
same file.
This API should only be used with a passphrase that was provided by (or generated
for) a human. For programmatic use cases, instead generate an x25519::Identity.
Implementations§
Source§impl Recipient
impl Recipient
Sourcepub fn new(passphrase: SecretString) -> Self
pub fn new(passphrase: SecretString) -> Self
Constructs a new Recipient with the given passphrase.
The scrypt work factor is picked to target about 1 second for encryption or
decryption on this device. Override it with Self::set_work_factor.
Sourcepub fn set_work_factor(&mut self, log_n: u8)
pub fn set_work_factor(&mut self, log_n: u8)
Sets the scrypt work factor to N = 2^log_n.
This method must be called before Self::wrap_file_key to have an effect.
§Panics
Panics if log_n == 0 or log_n >= 64.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Recipient
impl RefUnwindSafe for Recipient
impl Send for Recipient
impl Sync for Recipient
impl Unpin for Recipient
impl UnwindSafe for Recipient
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
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more