Table of Contents

Interface IAesGcmCipher

Namespace
NArk.ArkadeIntents.Lightning
Assembly
NArk.ArkadeIntents.dll

AES-256-GCM, as the one primitive a host may have to supply itself.

public interface IAesGcmCipher

Remarks

Everything else in the claim packet — the ECDH, the HKDF — runs anywhere .NET runs. This one does not: under Blazor WebAssembly AesGcm is unsupported and throws PlatformNotSupportedException, because the browser runtime has no OpenSSL behind it. The browser does have AES-GCM, in WebCrypto, so the gap is reachable — but only by a host that can call JavaScript, which a library cannot.

Hence a seam of exactly one operation. The wire format stays defined here and is not the host's business; what the host supplies is a way to compute it.

Named for the algorithm rather than for AEAD in general, because the algorithm is not a choice: the packet has to open on the counterparty's side, where it is AES-256-GCM and nothing else. An interface promising to accept any AEAD would invite substituting one, and the resulting packet would be refused by a daemon rather than by a compiler.

Methods

EncryptAsync(byte[], byte[], byte[], byte[], CancellationToken)

Encrypts plaintext under AES-256-GCM.

Task<byte[]> EncryptAsync(byte[] key, byte[] nonce, byte[] plaintext, byte[] associatedData, CancellationToken cancellationToken = default)

Parameters

key byte[]

32-byte key.

nonce byte[]

12-byte nonce, never reused under the same key.

plaintext byte[]

What to encrypt.

associatedData byte[]

Authenticated but not encrypted.

cancellationToken CancellationToken

Cancels the operation.

Returns

Task<byte[]>

Ciphertext with the 16-byte authentication tag appended — the layout WebCrypto returns and the layout Go's aead.Seal produces, so an implementation that separates them must concatenate before returning.