From f287c4002a947a79eb998aa5e1f98eb17b688c66 Mon Sep 17 00:00:00 2001 From: pstayets Date: Fri, 14 Aug 2026 21:16:45 -0700 Subject: [PATCH] =?UTF-8?q?blog:=20AES-256-GCM=20Encryption=20=E2=80=94=20?= =?UTF-8?q?expand=20zero-dependency=20post=20for=20GSC=20striking-distance?= =?UTF-8?q?=20query?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: pstayets --- src/data/blogPosts.json | 4 ++-- ...dependency-encryption-x25519-aes-gcm.astro | 20 +++++++++++++++---- 2 files changed, 18 insertions(+), 6 deletions(-) diff --git a/src/data/blogPosts.json b/src/data/blogPosts.json index d9e1e213..9741c888 100644 --- a/src/data/blogPosts.json +++ b/src/data/blogPosts.json @@ -1254,8 +1254,8 @@ }, { "slug": "zero-dependency-encryption-x25519-aes-gcm", - "title": "Zero-Dependency Agent Encryption: X25519 + AES-256-GCM in Pure Go", - "description": "How Pilot implements authenticated key exchange, tunnel encryption, nonce management, and replay protection using only Go's standard library.", + "title": "AES-256-GCM Encryption: Zero-Dependency Go Implementation Guide", + "description": "AES-256-GCM encryption explained with code: X25519 key exchange, GCM authenticated encryption, nonce handling, and wire format in zero-dependency Go.", "date": "Feb 12", "category": "Security", "tags": [ diff --git a/src/pages/blog/zero-dependency-encryption-x25519-aes-gcm.astro b/src/pages/blog/zero-dependency-encryption-x25519-aes-gcm.astro index d53d98e1..37c30676 100644 --- a/src/pages/blog/zero-dependency-encryption-x25519-aes-gcm.astro +++ b/src/pages/blog/zero-dependency-encryption-x25519-aes-gcm.astro @@ -1,7 +1,7 @@ --- import BlogLayout from '../../layouts/BlogLayout.astro'; -const bodyContent = `

Pilot Protocol implements its entire encryption stack -- X25519 key exchange plus AES-256-GCM authenticated encryption -- using nothing but Go's standard library. No OpenSSL, no libsodium, no third-party crypto module. This article shows exactly how that implementation works: the key exchange code, the wire format, nonce handling, and the security properties you get as a result.

+const bodyContent = `

AES-256-GCM encryption is the authenticated-encryption mode that protects every message in transit on Pilot Protocol -- implemented, together with X25519 key exchange, using nothing but Go's standard library. No OpenSSL, no libsodium, no third-party crypto module. This article shows exactly how that AES-256-GCM encryption works end to end: the key exchange code, the wire format, nonce handling, and the security properties you get as a result.

Every encryption library is a dependency. Every dependency is an attack surface. When OpenSSL disclosed Heartbleed in 2014, it affected a large share of TLS servers on the internet -- not because of a flaw in the cryptographic algorithms, but because of a buffer over-read in a library that virtually every project imported without auditing. The xz Utils backdoor in 2024 demonstrated that even compression libraries can become supply chain weapons when a determined attacker gains commit access.

@@ -84,10 +84,14 @@ Agent A Agent B

The X25519 computation itself is sub-millisecond; the dominant setup cost is the one network round-trip for the handshake, which is bounded by the peers' RTT. The crypto cost is paid once per tunnel, not per packet.

-

AES-256-GCM: Authenticated Encryption

+

AES-256-GCM Encryption: How the Mode Works

After key exchange, all tunnel frames are encrypted with AES-256-GCM (RFC 5288). GCM (Galois/Counter Mode) is an authenticated encryption mode that provides both confidentiality (the data is encrypted) and integrity (any modification is detected). It is the same cipher suite used by TLS 1.3 for HTTPS traffic worldwide.

+

GCM is built from two operations. The first is AES in counter mode (CTR): the block cipher encrypts an incrementing counter, and the resulting keystream is XORed with the plaintext. That is how a block cipher encrypts arbitrary-length data. The second is GHASH, a universal hash function computed over the ciphertext that produces the authentication tag. Because the tag is a function of the ciphertext, an attacker who flips a single bit in transit must also forge a valid tag for the modified message. Without the key, that forgery is detected and the packet is rejected before any plaintext is released. This is what makes GCM "authenticated": confidentiality and integrity arrive in one pass, with one key, from one Seal call.

+ +

The construction also explains the two invariants an implementation must enforce. First, a nonce must never be reused under the same key -- the counter mode makes the keystream identical for identical nonces, which is why Pilot uses the two-part nonce construction described below. Second, the authentication tag must be verified before the plaintext is trusted. Go's Open function does both atomically: it returns an error on tag mismatch and never yields unauthenticated plaintext.

+

Encryption in Go

The implementation uses Go's crypto/aes package for the AES block cipher and crypto/cipher for the GCM mode. Here is the simplified flow:

@@ -323,11 +327,19 @@ const faqItems = [ question: "Why not just use TLS for AI agent encryption?", answer: "Standard TLS runs over TCP and commonly depends on X.509 certificate issuance and revocation. Pilot Protocol runs over UDP and derives tunnel secrets with X25519 without requiring X.509 at this layer, avoiding that certificate lifecycle and the larger dependency surface that crypto/tls brings in.", }, + { + question: "What is AES-256-GCM encryption?", + answer: "AES-256-GCM is the Galois/Counter Mode of the AES block cipher with a 256-bit key. It is an authenticated encryption (AEAD) mode: AES in counter mode encrypts the data, and the GHASH universal hash produces an authentication tag over the ciphertext, so confidentiality and integrity are provided in one pass with one key. It is the mode TLS 1.3 uses for HTTPS and the mode Pilot Protocol uses for its tunnel encryption.", + }, + { + question: "AES-256-GCM vs ChaCha20-Poly1305: which should you use?", + answer: "Both are authenticated encryption schemes with the same security goals. AES-256-GCM is the more widely deployed option and benefits from hardware acceleration (AES-NI on x86, the crypto extensions on ARMv8), which is why it is the default in TLS 1.3 and in Pilot Protocol's tunnels. ChaCha20-Poly1305 is a strong alternative designed for software implementations without AES hardware support, which is why WireGuard uses it. The practical choice depends on your deployment: where AES hardware acceleration is available, AES-256-GCM is the pragmatic default.", + }, ]; ---