Brytalearn.How things workFind something
Encryption, end-to-end messages, VPNs and cryptographic keys Feedback on this lesson
INTERACTIVE EXPLANATION

Who can read a message as it travels online?

Send a fictional note, become a network observer, and open the layers for which you have a key. Compare protected connections, end-to-end encryption and a VPN using real browser cryptography.

Enable JavaScript to change the conditions and run the interactive experiment.

Make a discovery

Protection has endpoints. A connection can be encrypted while its receiving service can still read the message. Add an inner layer whose key belongs only to the participants, and the service can relay the bytes without opening that content.

  • Identify where a protection layer begins and ends.
  • Predict who can read content from explicit key ownership.
  • Distinguish transport protection, end-to-end content protection and a VPN tunnel.
  • Separate message content from account context, endpoints, size and timing.
  • Explain what authenticated encryption does when an envelope changes.
  • Distinguish encoding, encryption, hashing and signing by trying each.
  • Explain why authenticated keys, endpoint security and application rules still matter.
  • Use published reference values to check a real operation without claiming product certification.

Make a prediction

Two encrypted connections meet at a chat service. Can that service still read a message without another content layer?

  • Yes, the connections end there
  • No, the word encrypted excludes every middle role
  • Only if the message is written in uppercase
Read the explanation

A receiving endpoint can open its own connection. End-to-end content protection adds a different boundary.

Understand it

Make a prediction before sending

Maya has a fictional message for Leo. With protected connections alone, can the chat service read it? The answer depends on where those connections end, not just whether a lock is pictured.

Follow the first connection

The initial connection key belongs to Maya and the service in our route. Nearby observers lack that key. At the service, the connection layer opens and reveals whatever was inside it.

Give the message its own inner layer

For end-to-end content protection, only the two phones hold the inner content key in this model. The service can pass that protected content along without being able to open it.

Start the next connection

The service uses a separate outgoing connection key toward Leo. Two protected connections through a service are not automatically the same thing as an inner end-to-end content layer.

Wrap part of the journey in a VPN

The tunnel ends at its gateway. The gateway can remove its own layer. If the remaining application traffic is unprotected, it can read it; if a separate connection layer remains, it does not automatically have that key.

Look beyond the message text

Size, timing, routing and account context can remain visible. A service may recognize a signed-in account even if the apparent network address changes. Hidden content is not the same as automatic anonymity.

Change one byte

Authenticated encryption checks the protected content and associated envelope information. With an altered ciphertext and unchanged key, nonce and tag, the receiver refuses to release plaintext. A refusal does not identify the person or event that caused it.

Choose the right kind of evidence

Encoding changes a representation. A hash computes a digest without a secret key. A signature can be checked with a public key. These operations answer different questions, and none alone establishes that an endpoint is honest.

Look closer at the science

The primitive is real; the route is a teaching model

This page uses the browser Web Cryptography API for AES-GCM, SHA-256 and ECDSA P-256. It does not perform a TLS handshake, operate a VPN or implement MLS. All role keys live in one page runtime; the role boundaries explain ownership but do not isolate real participants.

A precisely defined envelope

The original container has a six-byte header: version 1, layer code, then a four-byte big-endian message ID. It then stores a twelve-byte nonce, ciphertext and a sixteen-byte authentication tag. The header is authenticated associated data. One layer adds 34 bytes; this is not TLS or VPN overhead.

Count encoded bytes

UTF-8 encodes é as two bytes. Hi! is three bytes: one teaching envelope is 37 bytes, two nested envelopes are 71, and three are 105. Nesting encrypts the complete inner frame, including its existing header, nonce, ciphertext and tag.

Per-key nonces must not repeat

A fresh 128-bit AES key is generated with the browser cryptographic API. Each key owns a 96-bit monotonic nonce counter. A nonce is consumed before encryption begins, including concurrent requests. Resetting a counter requires replacing its key; none is derived from a short name or ordinary random-number generator.

Authentication can cover readable information

GCM associated data is checked but not encrypted. In the published examples, the same plaintext with the same public reference key and nonce can have the same ciphertext but a different tag when AAD changes. Those fixed examples are isolated tests, not instructions to reuse a nonce for fresh messages.

A shared-key tag is not a public signature

Any holder of the shared key can create a valid GCM envelope. A digital signature instead uses a private signing key and a corresponding public verification key. Calling that public key a particular person’s key requires a trustworthy association.

Verification does not conceal a message

ECDSA P-256 with SHA-256 checks the signature/message/public-key relationship. The message can remain readable. WebCrypto represents this signature as 64 bytes of fixed-width r followed by s, rather than ASN.1 DER.

A hash does not identify its author

SHA-256 gives a 32-byte digest. If someone changes both a message and its displayed unkeyed hash, the new pair can match. A trusted reference digest or an appropriately verified signature has a different role. This lesson does not teach raw SHA-256 as password storage.

An authenticated replay can still be a replay

A previously valid envelope can authenticate again. Our optional seen-message-ID rule declines repeated acceptance at the application layer. The rule is separate from AES-GCM, and turning it off does not make an unchanged tag invalid.

Key setup is an explicit assumption

The journey creates shared keys locally and assigns them to roles. Actual systems must establish and authenticate keys between endpoints. This lesson does not demonstrate secure key exchange, forward secrecy, group membership, recovery or compromised-device protection.

Metadata depends on the configuration

IP endpoints, approximate sizes and timing remain observable in our route. Hostname exposure depends on DNS protection, Encrypted Client Hello and deployment details. The VPN comparison assumes relevant traffic and DNS use the tunnel without bypasses; no live traffic capture is performed.

Confidentiality is not availability or endpoint control

A delivery service can withhold bytes it cannot decrypt. A recipient can copy or photograph content it legitimately opens. Cryptographic operations do not prevent every action at an endpoint or every inference about communication.

Where this is used

Understand an encrypted chat claim

Ask who holds content keys, where connections terminate, what metadata is retained and which endpoint assumptions apply. A single lock picture cannot answer all of these.

Understand a VPN’s role

Find the tunnel endpoint, then inspect the protection still present afterward. A gateway address, a connection layer and an authenticated service account are different aspects of a journey.

Check a file or message

Choose evidence suited to the question: representation, digest, shared-key authentication or a public-key signature. Keep the expected value and trusted key source attached.

Try it yourself: A paper note and the people who hold its rule

Supplies

  • Two sheets of paper
  • Pencil
  • Optional colored pencils
  1. Make two alphabet strips

    Write A–Z twice. Shift one strip three places: A lines up with D and B with E, wrapping at the end. Fold or tear the paper; scissors are not needed.

  2. Encode a fictional note

    Use MEET AT NOON. Replace letters with the shifted ones and preserve spaces. The result should be PHHW DW QRRQ.

  3. Give the relay a copy of the rule

    Mark Sender, Relay and Recipient positions. Put rule copies at Sender and Relay. Relay can recover the fictional note; protecting a trip to Relay did not exclude Relay.

  4. Move the intended rule holders

    Repeat with rule copies at Sender and Recipient only. The intended content boundary has changed. A real piece of paper cannot enforce who looks at or copies the rule.

  5. Challenge the weak cipher

    Let Relay try the shifts. There are 25 nonzero shifts plus the unchanged alphabet. This short familiar message is easy to find. The classroom rule is not modern encryption.

  6. Leave some facts outside

    Put a fictional recipient and the message length on the folded note. Record what can be seen without opening it, and one limit of the paper analogy.

What changed when the intended rule holders changed—and what did the paper fail to protect?

Use only fictional messages. No real secrets, passwords, contacts or intercepted messages. This original activity teaches boundaries with an intentionally weak shift cipher; it does not measure security.

Check your understanding

Does someone need a secret key to read a Base64 message?

  • Yes, because it looks scrambled
  • No, it is a public encoding
  • Only on a phone
Answer and explanation

No, it is a public encoding Decode the bytes in one click. Representation is not secret-key protection.

A chat service receives a message on one protected connection and forwards it on another. Who can read it here?

  • The chat service
  • Automatically nobody between the phones
  • Only a nearby network observer
Answer and explanation

The chat service The protected connections end at the service; another content layer is needed to exclude it in this model.

Only the two phones hold the inner content key. What can the service do?

  • Relay ciphertext without opening the content layer
  • Receive no bytes at all
  • Read the secret key from the public nonce
Answer and explanation

Relay ciphertext without opening the content layer Receiving, relaying and decrypting are different operations.

A VPN tunnel carries otherwise unprotected application traffic. Can its gateway read that traffic after opening the tunnel?

  • No, a VPN automatically protects every later step
  • Yes, in this setup
  • Only if end-to-end encryption is also added
Answer and explanation

Yes, in this setup The tunnel ends at its gateway. A separately protected connection would present another layer.

The service cannot decrypt end-to-end content. Does that prove it learns nothing?

  • Yes, all communication facts disappear
  • No; account context, timing or other metadata may remain
  • Only the message’s font remains
Answer and explanation

No; account context, timing or other metadata may remain Content confidentiality is different from anonymity or hiding every traffic attribute.

A ciphertext byte changes but its tag, key and nonce stay the same. What should this receiver release?

  • A partly garbled message
  • The secret key so it can be repaired
  • No plaintext; authentication failed
Answer and explanation

No plaintext; authentication failed The authenticated-decryption operation rejects the altered envelope.

Someone changes both a file and the plain SHA-256 hash beside it. Does their new matching pair prove the original author approved it?

  • Yes, every matching hash identifies its author
  • No, anyone can compute this unkeyed hash
  • Yes, if the digest has 64 hex characters
Answer and explanation

No, anyone can compute this unkeyed hash A trusted expected digest or verified signature supplies a different kind of evidence.

A public key verifies a signature on a readable message. What follows?

  • The message is now secret
  • The message can never be replayed
  • It verifies under that key; whose key it is needs a trustworthy association
Answer and explanation

It verifies under that key; whose key it is needs a trustworthy association Signature validity, confidentiality, identity binding and replay rules are separate questions.

Sources and model limits

  • Original fictional phones, router, gateway, server cabinet and envelopes are illustrative geometry, not manufacturer CAD or a physical picture of cryptographic computation.
  • All keys are in this page’s runtime. Real operations do not turn the lesson into a secure messaging product or enforce isolation between people.
  • The connection, content and tunnel layers are original AES-GCM containers, not implementations of TLS, MLS or IPsec wire formats or handshakes.
  • Scenarios assume functioning algorithms, authenticated key setup, uncompromised endpoints and the shown key holders. Their role matrix is not a universal guarantee for all products.
  • Only fixed fictional messages are used. No message is sent to another person, no browser traffic is intercepted and no live VPN connection is created.
  • Fresh keys make normal sessions’ bytes differ. Shared links retain lesson settings, not private keys or a promise of independently decrypting an earlier session.
  • Reference-vector success checks specific numerical operations, not certification of an entire browser or product.
  • The paper shift cipher has only 26 possible shifts including no shift. It illustrates a boundary and is intentionally unsuitable for protecting secrets.

Transport confidentiality, integrity and endpoint boundaries

Current TLS 1.3 protocol specification. Our selected service is the connection endpoint; no TLS handshake is implemented here.

IETF · RFC 9846, TLS 1.3

End-to-end architecture, delivery services and metadata limits

MLS architecture, especially security considerations. Mechanism reference, not a claim to implement MLS.

IETF · RFC 9750, MLS architecture

Tunnel boundaries and separate outer/inner packet protection

IPsec architecture, §§4–5. Generic encrypted-tunnel illustration does not imply every VPN uses IPsec.

IETF · RFC 4301, IPsec architecture

Hostname visibility is configuration dependent

Encrypted Client Hello specification. Do not assume every HTTPS hostname is universally exposed or universally hidden.

IETF · RFC 9849, Encrypted Client Hello

Browser AES-GCM, SHA-256 and ECDSA operations

Stable W3C Recommendation. Unsupported operations show an explicit unavailable state.

W3C · Web Cryptography API

GCM construction, associated data, failure and nonce requirements

Original NIST recommendation; this lesson uses 128-bit authentication tags.

NIST · SP 800-38D

Exact AES-128 GCM reference outputs

Worked examples 1, 2 and 4; independent expected bytes for both empty and nonempty plaintext. Derived mutation tests are identified separately.

NIST · GCM worked examples

Public Base64 encoding and reference cases

Sections 4 and 10. Encoding does not require a secret decoding key.

IETF · RFC 4648

SHA-256 and public P-256 signature fixture

Section 8.1; verification uses the published public point and signature. Published private material is not used for visitor sessions.

IETF · RFC 4754

Reuse terms for NIST material

Distinguishes employee works, third-party material and Standard Reference Data. The lesson presents original tables of numerical facts with citation.

NIST · copyright and licensing

Independent subject review is pending.

Read the sources and model assumptions