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
keybyte[]32-byte key.
noncebyte[]12-byte nonce, never reused under the same key.
plaintextbyte[]What to encrypt.
associatedDatabyte[]Authenticated but not encrypted.
cancellationTokenCancellationTokenCancels the operation.