pub fn write_to(
    plain: &[u8],
    path: &Path,
    key: &Key,
    associated_data: &[u8]
) -> Result<(), WriteError>
Expand description

Atomically encrypt, add magic and version bytes as file-header, and write the specified plaintext to the specified path.

This is achieved by creating a temporary file in the same directory as the specified path (same filename with a salted suffix). This is currently known to be problematic if the path is a symlink and/or if the target path resides in a directory without user write permission.