Encrypt `plaintext` (a complete plaintext segment buffer) and return the SEGA envelope.
(
key: &WalEncryptionKey,
plaintext: &[u8],
)
| 25 | /// Encrypt `plaintext` (a complete plaintext segment buffer) and return the |
| 26 | /// SEGA envelope. |
| 27 | pub(crate) fn encrypt_segment( |
| 28 | key: &WalEncryptionKey, |
| 29 | plaintext: &[u8], |
| 30 | ) -> Result<Vec<u8>, ArrayError> { |
| 31 | encrypt_segment_envelope(key, &SEGA_MAGIC, plaintext).map_err(|e| { |
| 32 | ArrayError::EncryptionFailed { |
| 33 | detail: e.to_string(), |
| 34 | } |
| 35 | }) |
| 36 | } |
| 37 | |
| 38 | /// Decrypt an encrypted array segment blob (starting at byte 0 = `SEGA`). |
| 39 | /// |