Print encryption info

This commit is contained in:
Truman Kilen 2023-08-09 16:40:29 -05:00
parent 36628900e5
commit e790cfe6b3
2 changed files with 16 additions and 0 deletions

View file

@ -24,6 +24,8 @@ pub struct Pak {
mount_point: String, mount_point: String,
index_offset: Option<u64>, index_offset: Option<u64>,
index: Index, index: Index,
encrypted_index: bool,
encryption_guid: Option<u128>,
compression: Vec<super::Compression>, compression: Vec<super::Compression>,
} }
@ -34,6 +36,8 @@ impl Pak {
mount_point, mount_point,
index_offset: None, index_offset: None,
index: Index::new(path_hash_seed), index: Index::new(path_hash_seed),
encrypted_index: false,
encryption_guid: None,
compression: vec![], compression: vec![],
} }
} }
@ -108,6 +112,14 @@ impl PakReader {
&self.pak.mount_point &self.pak.mount_point
} }
pub fn encrypted_index(&self) -> bool {
self.pak.encrypted_index
}
pub fn encryption_guid(&self) -> Option<u128> {
self.pak.encryption_guid
}
pub fn get<R: Read + Seek>(&self, path: &str, reader: &mut R) -> Result<Vec<u8>, super::Error> { pub fn get<R: Read + Seek>(&self, path: &str, reader: &mut R) -> Result<Vec<u8>, super::Error> {
let mut data = Vec::new(); let mut data = Vec::new();
self.read_file(path, reader, &mut data)?; self.read_file(path, reader, &mut data)?;
@ -343,6 +355,8 @@ impl Pak {
mount_point, mount_point,
index_offset: Some(footer.index_offset), index_offset: Some(footer.index_offset),
index, index,
encrypted_index: footer.encrypted,
encryption_guid: footer.encryption_uuid,
compression: footer.compression, compression: footer.compression,
}) })
} }

View file

@ -164,6 +164,8 @@ fn info(aes_key: Option<aes::Aes256>, action: ActionInfo) -> Result<(), repak::E
println!("mount point: {}", pak.mount_point()); println!("mount point: {}", pak.mount_point());
println!("version: {}", pak.version()); println!("version: {}", pak.version());
println!("version major: {}", pak.version().version_major()); println!("version major: {}", pak.version().version_major());
println!("encrypted index: {}", pak.encrypted_index());
println!("encrytion guid: {:032X?}", pak.encryption_guid());
println!("{} file entries", pak.files().len()); println!("{} file entries", pak.files().len());
Ok(()) Ok(())
} }