Skip to main content

generate_container

Function generate_container 

Source
pub fn generate_container(
    plaintext: Zeroizing<Vec<u8>>,
    password: Zeroizing<Vec<u8>>,
    dimensions: ContainerDimensions,
    output_path: &Path,
) -> Result<GenerateReport, GenerateError>
Expand description

Builds a dimensions container around plaintext and writes it to output_path.

Both secrets are taken by value in a Zeroizing wrapper, as in crate::pipeline::EmbedPipeline::embed: this function becomes their owner and wipes them where they stop being needed.

dimensions is already validated — the only way to hold one is ContainerDimensions::new — so this function cannot be handed a size the loader would refuse. Pass ContainerDimensions::default for the historical square container when no particular size is wanted.

The container it writes does not hide that it was generated. It hides which of several generated containers carries a message; see the module documentation for the difference, which is the whole of what this mode promises.

§Errors

Returns a GenerateError when the system random number generator cannot be read, the compressed payload does not fit the requested size, no candidate texture passes the container gates, a cryptographic step fails, or the file cannot be written.