Table of Contents

Class SegmentedAead

Namespace
The.Security.Cryptography
Assembly
Instagile.dll

Format of streams encrypted as a sequence of independently authenticated AES-GCM segments, after Tink's AES-GCM-HKDF streaming AEAD.

public static class SegmentedAead
Inheritance
SegmentedAead
Inherited Members

Remarks

A stream is a header (random salt and nonce prefix) followed by segments of 64 KiB plaintext, each sealed with its tag. Each stream has its own segment key, derived from the main key, the salt and the associated data; each segment's nonce is the prefix, its index and whether it is the last, so that segments cannot be modified, reordered, dropped or appended without failing verification.

Methods

DecryptStream(Stream, ISegmentCipher)

Decrypt the output of EncryptStream(Stream, ISegmentCipher) with a segment key derived for it; the result owns both.

public static Stream DecryptStream(Stream ciphertext, ISegmentCipher cipher)

Parameters

ciphertext Stream
cipher ISegmentCipher

Returns

Stream

EncryptStream(Stream, ISegmentCipher)

Encrypt a stream with a segment key derived for it; the result owns both.

public static Stream EncryptStream(Stream plaintext, ISegmentCipher cipher)

Parameters

plaintext Stream
cipher ISegmentCipher

Returns

Stream

GetCiphertextLength(long)

The length of EncryptStream(Stream, ISegmentCipher)'s output for a plaintext of the given length.

public static long GetCiphertextLength(long plaintextLength)

Parameters

plaintextLength long

Returns

long