pub enum CloudCipher {
Encrypted(EncryptionService),
Plaintext,
}Expand description
Protection for payloads assigned to this cipher. Encrypted seals under
its keyring; Plaintext preserves the bytes. Protocol domains and blob
locators determine which cipher applies.
Variants§
Encrypted(EncryptionService)
Plaintext
Implementations§
Source§impl CloudCipher
impl CloudCipher
Sourcepub fn for_storage(
storage: HomeStorage,
encryption: Option<EncryptionService>,
) -> Option<Self>
pub fn for_storage( storage: HomeStorage, encryption: Option<EncryptionService>, ) -> Option<Self>
The at-rest cipher a home’s storage mode selects: an opaque home seals
under its store key (Encrypted), a browsable home stores in the clear
(Plaintext). The sibling of BlobPathScheme::for_storage — together
they map a HomeStorage to its
(path scheme, at-rest cipher) pair.
encryption is the store master service; it is required for (and only
consulted on) an opaque home. None is returned only for an opaque home
with no service (a locked store) — a browsable home is always
Plaintext regardless. A host streaming a Remote blob opens a
BlobRangeReader under this cipher, so a read applies the same
protection the upload sealed under.
Sourcepub fn seal(&self, plaintext: Vec<u8>, aad_context: &[u8]) -> Vec<u8> ⓘ
pub fn seal(&self, plaintext: Vec<u8>, aad_context: &[u8]) -> Vec<u8> ⓘ
Protect a whole payload assigned to this cipher. Encryption prefixes the selected key’s fingerprint in cleartext; plaintext returns the bytes unchanged. The caller supplies the protection domain’s context.
Sourcepub fn open(
&self,
stored: Vec<u8>,
aad_context: &[u8],
) -> Result<Vec<u8>, EncryptionError>
pub fn open( &self, stored: Vec<u8>, aad_context: &[u8], ) -> Result<Vec<u8>, EncryptionError>
Recover a whole payload read from storage. Inverse of Self::seal.
Sourcepub fn seal_scoped(
&self,
scope: BlobScope,
plaintext: Vec<u8>,
aad_context: &[u8],
) -> Vec<u8> ⓘ
pub fn seal_scoped( &self, scope: BlobScope, plaintext: Vec<u8>, aad_context: &[u8], ) -> Vec<u8> ⓘ
Protect a blob under its scope. Encrypted blobs carry the selected audience key’s fingerprint in cleartext; opening uses that key and derives the same scoped key.
Sourcepub fn open_scoped(
&self,
scope: BlobScope,
stored: Vec<u8>,
aad_context: &[u8],
) -> Result<Vec<u8>, EncryptionError>
pub fn open_scoped( &self, scope: BlobScope, stored: Vec<u8>, aad_context: &[u8], ) -> Result<Vec<u8>, EncryptionError>
Recover a blob under its resolved scope. Inverse of Self::seal_scoped.
Sourcepub fn suffix(&self) -> &'static str
pub fn suffix(&self) -> &'static str
A cipher-dependent suffix for auxiliary object names: .enc when
encrypted, empty when plaintext. Exact protocol slots and blob locators
determine their own paths without this suffix.
Sourcepub fn is_plaintext(&self) -> bool
pub fn is_plaintext(&self) -> bool
Whether this is a plaintext (unencrypted) home.
Sourcepub fn body_len(&self, header: SealedBlobHeader) -> u64
pub fn body_len(&self, header: SealedBlobHeader) -> u64
The final object length for a blob framed by header under this cipher:
the key tag plus the sealed body for an encrypted home, the plaintext
length verbatim for a browsable one. Known before a byte is sealed, so a
streaming upload can declare its length up front.
Sourcepub async fn open_body(
&self,
scope: BlobScope,
file_path: &Path,
aad_context: &[u8],
chunk_size: NonZeroU32,
) -> Result<BlobBody, FileError>
pub async fn open_body( &self, scope: BlobScope, file_path: &Path, aad_context: &[u8], chunk_size: NonZeroU32, ) -> Result<BlobBody, FileError>
Open a streaming BlobBody over the local plaintext file at file_path,
sealing each chunk under scope’s key for an encrypted home or passing the
plaintext through for a browsable one — without ever reading or sealing the
whole blob into memory. The streaming sibling of seal_scoped,
used by the upload drain.
Sourcepub async fn open_exact_body(
&self,
scope: BlobScope,
file_path: &Path,
aad_context: &[u8],
chunk_size: NonZeroU32,
expected_size: u64,
expected_hash: ObjectHash,
progress: PreparationProgress,
) -> Result<BlobBody, FileError>
pub async fn open_exact_body( &self, scope: BlobScope, file_path: &Path, aad_context: &[u8], chunk_size: NonZeroU32, expected_size: u64, expected_hash: ObjectHash, progress: PreparationProgress, ) -> Result<BlobBody, FileError>
Open a streaming body whose plaintext reader verifies the exact row size/hash while it is consumed and reports each source-buffer advance. This avoids a separate plaintext hashing pass before sealing.
Trait Implementations§
Source§impl Clone for CloudCipher
impl Clone for CloudCipher
Source§fn clone(&self) -> CloudCipher
fn clone(&self) -> CloudCipher
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreAuto Trait Implementations§
impl Freeze for CloudCipher
impl RefUnwindSafe for CloudCipher
impl Send for CloudCipher
impl Sync for CloudCipher
impl Unpin for CloudCipher
impl UnsafeUnpin for CloudCipher
impl UnwindSafe for CloudCipher
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more