pithos_lib 0.8.0

Library and components for encrypting / compressing pithos (.pith) files
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
//! Extract one archive entry through the Linux no-follow filesystem adapter.

use pithos_lib::archive::{AccessKeys, Archive, OpenOptions};
use pithos_lib::crypto::PrivateKey;
use pithos_lib::fs::extract;
use pithos_lib::source::FileSource;
use std::path::Path;

fn main() -> Result<(), Box<dyn std::error::Error>> {
    let reader = PrivateKey::from_private_pem_bytes(&std::fs::read("reader.pem")?)?;
    let archive = Archive::open(
        FileSource::open("report.pith")?,
        OpenOptions::default().with_access_keys(AccessKeys::new().with_key(reader)),
    )?;

    extract(&archive, "report.txt", Path::new("extracted"))?;
    Ok(())
}