Struct goldboot_image::ImageHandle
source · pub struct ImageHandle {
pub primary_header: PrimaryHeader,
pub protected_header: Option<ProtectedHeader>,
pub config: Option<Vec<u8>>,
pub digest_table: Option<DigestTable>,
pub directory: Option<Directory>,
pub path: PathBuf,
pub file_size: u64,
pub id: String,
}Expand description
Represents a goldboot image on disk.
§Binary format
| Section | Encryption Key |
|---|---|
| Primary Header | None |
| Protected Header | Password + SHA256 |
| Image Config | Password + SHA256 |
| Cluster Table | Cluster Key |
| Digest Table | Password + SHA256 |
| Directory | Password + SHA256 |
The target data is divided into equal size sections called “blocks”. Blocks that are nonzero will have an associated “cluster” allocated in the image file. Clusters are variable in size and ideally smaller than their associated blocks (due to compression). If a block does not have an associated cluster, that block is zero.
Fields§
§primary_header: PrimaryHeaderThe primary file header
protected_header: Option<ProtectedHeader>The secondary header
config: Option<Vec<u8>>The encoded config used to build the image
digest_table: Option<DigestTable>The digest table
directory: Option<Directory>The section directory
path: PathBufThe filesystem path to the image file
file_size: u64The size in bytes of the image file on disk
id: StringThe image’s ID (SHA256 hash)
Implementations§
source§impl ImageHandle
impl ImageHandle
sourcepub fn load(&mut self, password: Option<String>) -> Result<()>
pub fn load(&mut self, password: Option<String>) -> Result<()>
Load all sections into memory except the cluster table. If the image is encrypted, the sections will be decrypted.
sourcepub fn change_password(
&self,
_old_password: String,
new_password: String
) -> Result<()>
pub fn change_password( &self, _old_password: String, new_password: String ) -> Result<()>
Modify the password and re-encrypt all encrypted sections. This doesn’t re-encrypt the clusters because they are encrypted with the cluster key.