Interface ISecureBlobEncryptor
- Namespace
- Stratara.Abstractions.Security
- Assembly
- Stratara.Abstractions.dll
Streaming AES-GCM wrapper for blob payloads. Encryption + decryption bind the stream to a
KeyScope and a purpose via associated data, so a leaked ciphertext cannot
be decrypted against another scope's key or reused under a different purpose.
public interface ISecureBlobEncryptor
- Extension Methods
Methods
DecryptAsync(Stream, KeyScope, CancellationToken)
Decrypt encryptedStream for scope. The embedded key id
and purpose are read from the stream; an associated-data mismatch throws.
Task<Stream> DecryptAsync(Stream encryptedStream, KeyScope scope, CancellationToken cancellationToken = default)
Parameters
encryptedStreamStreamThe encrypted stream produced by EncryptAsync(Stream, KeyScope, string, CancellationToken) (or a supported legacy format).
scopeKeyScopeThe key scope the ciphertext was bound to.
cancellationTokenCancellationTokenPropagated to the key store and stream operations.
Returns
EncryptAsync(Stream, KeyScope, string, CancellationToken)
Encrypt plainStream under the current key for scope,
binding the ciphertext to purpose.
Task<Stream> EncryptAsync(Stream plainStream, KeyScope scope, string purpose, CancellationToken cancellationToken = default)
Parameters
plainStreamStreamThe plaintext to encrypt.
scopeKeyScopeThe key scope whose current key encrypts the payload.
purposestringA caller-defined label folded into the associated data (e.g.
"blob","attachment").cancellationTokenCancellationTokenPropagated to the key store and stream operations.