pub struct VeilContext { /* private fields */ }Expand description
Main entry point for veil operations.
Implementations§
Source§impl VeilContext
impl VeilContext
Sourcepub fn with_backend(backend: Box<dyn TeeBackend>) -> Result<Self>
pub fn with_backend(backend: Box<dyn TeeBackend>) -> Result<Self>
Create a VeilContext with a specific backend (for testing or advanced use).
Calls initialize_primary_key() on the backend.
Sourcepub fn protect(&mut self, data: &[u8]) -> Result<ProtectedData>
pub fn protect(&mut self, data: &[u8]) -> Result<ProtectedData>
Protect data by generating a Data Key, encrypting, and wrapping.
The returned ProtectedData can be serialized and stored anywhere.
Sourcepub fn unprotect(&mut self, protected: &ProtectedData) -> Result<Vec<u8>>
pub fn unprotect(&mut self, protected: &ProtectedData) -> Result<Vec<u8>>
Decrypt protected data. Requires the same TEE that produced it.
Sourcepub fn backup(
&self,
protected: &ProtectedData,
strategy: &dyn RecoveryStrategy,
secret: Option<&[u8]>,
) -> Result<BackupBundle>
pub fn backup( &self, protected: &ProtectedData, strategy: &dyn RecoveryStrategy, secret: Option<&[u8]>, ) -> Result<BackupBundle>
Backup protected data using a chosen recovery strategy.
secret is strategy-specific (e.g., passphrase bytes for PassphraseRecovery).
Sourcepub fn restore(
&self,
bundle: &BackupBundle,
ciphertext: &[u8],
strategy: &dyn RecoveryStrategy,
secret: &[u8],
) -> Result<ProtectedData>
pub fn restore( &self, bundle: &BackupBundle, ciphertext: &[u8], strategy: &dyn RecoveryStrategy, secret: &[u8], ) -> Result<ProtectedData>
Restore protected data from a backup using the matching recovery strategy.
Auto Trait Implementations§
impl Freeze for VeilContext
impl !RefUnwindSafe for VeilContext
impl Send for VeilContext
impl Sync for VeilContext
impl Unpin for VeilContext
impl UnsafeUnpin for VeilContext
impl !UnwindSafe for VeilContext
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more