Struct pwsafe::PwsafeWriter [−][src]
pub struct PwsafeWriter<W> { /* fields omitted */ }
Password safe writer.
Examples
An example shows how to create an empty database.
use pwsafe::PwsafeWriter; use std::fs::File; use std::io::BufWriter; let filename = "pwsafe.psafe3"; let file = BufWriter::new(File::create(filename).unwrap()); let mut db = PwsafeWriter::new(file, 2048, b"password").unwrap(); let version = [0x0eu8, 0x03u8]; let empty = [0u8, 0]; db.write_field(0x00, &version).unwrap(); // Version field db.write_field(0xff, &empty).unwrap(); // End of header db.finish().unwrap(); // EOF and HMAC
Methods
impl<W: Write> PwsafeWriter<W>
[src]
impl<W: Write> PwsafeWriter<W>
pub fn new(inner: W, iter: u32, password: &[u8]) -> Result<Self, Error>
[src]
pub fn new(inner: W, iter: u32, password: &[u8]) -> Result<Self, Error>
Creates a new PwsafeWriter
with the given password.
pub fn write_field(&mut self, field_type: u8, data: &[u8]) -> Result<(), Error>
[src]
pub fn write_field(&mut self, field_type: u8, data: &[u8]) -> Result<(), Error>
Encrypts and writes one field.
pub fn finish(&mut self) -> Result<(), Error>
[src]
pub fn finish(&mut self) -> Result<(), Error>
Writes EOF block and HMAC.
Auto Trait Implementations
impl<W> Send for PwsafeWriter<W> where
W: Send,
impl<W> Send for PwsafeWriter<W> where
W: Send,
impl<W> Sync for PwsafeWriter<W> where
W: Sync,
impl<W> Sync for PwsafeWriter<W> where
W: Sync,