| Crates.io | rseal |
| lib.rs | rseal |
| version | 0.1.0 |
| created_at | 2025-02-04 21:40:01.007661+00 |
| updated_at | 2025-02-04 21:40:01.007661+00 |
| description | Memory sealing operations |
| homepage | |
| repository | https://github.com/ab22593k/rseal |
| max_upload_size | |
| id | 1542858 |
| size | 27,647 |
A Rust library for memory sealing operations using Linux's mseal syscall.
RSeal provides a safe Rust interface for sealing memory regions, preventing them from being modified after initialization. This is useful for security-sensitive applications that need to protect critical data from tampering.
Add this to your Cargo.toml:
[dependencies]
rseal = "0.1.0"
use rseal::SealedBuffer;
fn main() -> Result<(), rseal::errors::RSealMemError> {
// Create a new sealed buffer with 4KB capacity
let mut buffer = SealedBuffer::new(4096)?;
// Write data to the buffer (before sealing)
let data = b"Sensitive data";
buffer.write(data);
// After this point, the memory cannot be modified
let sealed_data = buffer.read();
assert_eq!(&sealed_data[..data.len()], data);
Ok(())
}
SealedMemory<T>: Low-level wrapper for sealed memory regionsSealedBuffer: High-level wrapper for byte-oriented sealed memoryRSealError: Error types for sealing operationsRSealMemError: Memory-specific error typesMemory sealing is irreversible - sealed memory regions cannot be freed until process termination. Use this library judiciously and be aware of the memory usage implications.
RSeal uses the Linux mseal syscall to prevent further modifications to memory regions. Key features include:
Contributions are welcome! Please feel free to submit a Pull Request. Areas for improvement include:
This project is licensed under either of
at your option.
Currently supports Linux only. The mseal syscall is required.