pub struct XarReader<R: Read + Seek + Sized + Debug> { /* private fields */ }
Expand description
Read-only interface to a single XAR archive.
Implementations§
source§impl<R: Read + Seek + Sized + Debug> XarReader<R>
impl<R: Read + Seek + Sized + Debug> XarReader<R>
sourcepub fn into_inner(self) -> R
pub fn into_inner(self) -> R
Obtain the inner reader.
sourcepub fn heap_start_offset(&self) -> u64
pub fn heap_start_offset(&self) -> u64
The start offset of the heap.
sourcepub fn table_of_contents(&self) -> &TableOfContents
pub fn table_of_contents(&self) -> &TableOfContents
Obtain the table of contents for this archive.
sourcepub fn table_of_contents_decoded_data(&mut self) -> XarResult<Vec<u8>>
pub fn table_of_contents_decoded_data(&mut self) -> XarResult<Vec<u8>>
Obtain the decoded content of the table of contents.
sourcepub fn checksum_data(&mut self) -> XarResult<Vec<u8>>
pub fn checksum_data(&mut self) -> XarResult<Vec<u8>>
Obtain the raw bytes holding the checksum.
sourcepub fn digest_table_of_contents_with(
&mut self,
checksum: ChecksumType
) -> XarResult<Vec<u8>>
pub fn digest_table_of_contents_with( &mut self, checksum: ChecksumType ) -> XarResult<Vec<u8>>
Digest the table of contents content with the specified algorithm.
sourcepub fn find_file(&self, filename: &str) -> XarResult<Option<File>>
pub fn find_file(&self, filename: &str) -> XarResult<Option<File>>
Attempt to find the File entry for a given path in the archive.
sourcepub fn write_file_data_heap_from_file(
&mut self,
file: &File,
writer: &mut impl Write
) -> XarResult<usize>
pub fn write_file_data_heap_from_file( &mut self, file: &File, writer: &mut impl Write ) -> XarResult<usize>
Write heap file data for a given file record to a writer.
This will write the raw data backing a file as stored in the heap. There’s a good chance the raw data is encoded/compressed.
Returns the number of bytes written.
sourcepub fn write_file_data_heap_from_id(
&mut self,
id: u64,
writer: &mut impl Write
) -> XarResult<usize>
pub fn write_file_data_heap_from_id( &mut self, id: u64, writer: &mut impl Write ) -> XarResult<usize>
Write heap file data for a given file ID to a writer.
This is a wrapper around Self::write_file_data_heap_from_file that resolves the File given a file ID.
sourcepub fn write_file_data_decoded_from_file(
&mut self,
file: &File,
writer: &mut impl Write
) -> XarResult<usize>
pub fn write_file_data_decoded_from_file( &mut self, file: &File, writer: &mut impl Write ) -> XarResult<usize>
Write decoded file data for a given file record to a writer.
This will call Self::write_file_data_heap_from_file and will decode that data stream, if the file data is encoded.
sourcepub fn write_file_data_decoded_from_id(
&mut self,
id: u64,
writer: &mut impl Write
) -> XarResult<usize>
pub fn write_file_data_decoded_from_id( &mut self, id: u64, writer: &mut impl Write ) -> XarResult<usize>
Write decoded file data for a given file ID to a writer.
This is a wrapper for Self::write_file_data_decoded_from_file that locates the File entry given a file ID.
sourcepub fn get_file_data_from_path(
&mut self,
path: &str
) -> XarResult<Option<Vec<u8>>>
pub fn get_file_data_from_path( &mut self, path: &str ) -> XarResult<Option<Vec<u8>>>
Resolve data for a given path.
sourcepub fn unpack(&mut self, dest_dir: impl AsRef<Path>) -> XarResult<()>
pub fn unpack(&mut self, dest_dir: impl AsRef<Path>) -> XarResult<()>
Unpack the contents of the XAR archive to a given directory.
sourcepub fn checksum(&mut self) -> XarResult<(ChecksumType, Vec<u8>)>
pub fn checksum(&mut self) -> XarResult<(ChecksumType, Vec<u8>)>
Obtain the archive checksum.
The checksum consists of a digest format and a raw digest.
sourcepub fn verify_table_of_contents_checksum(&mut self) -> XarResult<bool>
pub fn verify_table_of_contents_checksum(&mut self) -> XarResult<bool>
Validate the recorded checksum of the table of contents matches actual file state.
Will Err
if an error occurs obtaining or computing the checksums. Returns Ok
with a bool indicating if the checksums matched.
sourcepub fn rsa_signature(
&mut self
) -> XarResult<Option<(Vec<u8>, Vec<CapturedX509Certificate>)>>
pub fn rsa_signature( &mut self ) -> XarResult<Option<(Vec<u8>, Vec<CapturedX509Certificate>)>>
Obtain RSA signature data from this archive.
The returned tuple contains the raw signature data and the embedded X.509 certificates.
sourcepub fn verify_rsa_checksum_signature(&mut self) -> XarResult<bool>
pub fn verify_rsa_checksum_signature(&mut self) -> XarResult<bool>
Verifies the RSA signature in the archive.
This verifies that the RSA signature in the archive, if present, is a valid signature for the archive’s checksum data.
The boolean return value indicates if signature validation was performed.
sourcepub fn cms_signature(&mut self) -> XarResult<Option<SignedData>>
pub fn cms_signature(&mut self) -> XarResult<Option<SignedData>>
Attempt to resolve a cryptographic message syntax (CMS) signature.
The data signed by the CMS signature is the raw data returned by Self::checksum.
sourcepub fn verify_cms_signature(&mut self) -> XarResult<bool>
pub fn verify_cms_signature(&mut self) -> XarResult<bool>
Verifies the cryptographic message syntax (CMS) signature, if present.