
We Encrypt the Connection. What About the AI?
What my research into TLS 1.3, AES-256-GCM, and local LLM inference taught me about the security of enterprise AI
Figures and the key line from each chapter. Expand any chapter to go deeper.
Chapters (6)
CHAPTER 01 · 1 MIN
Why I Started Questioning AI Security
But when someone pastes customer information into an AI application, or connects an agent to a company database, the security question doesn't end once the connection is encrypted.
I've become pretty reliant on AI over the last year. Between software development, researching unfamiliar technologies, and working with coding agents, I use these tools almost every day. And as companies adopt AI for their own employees and internal systems, I've started wondering how much information we're trusting them with.
One thing that caught my attention was encryption.
In web development, we've spent years making sure information is protected in transit with HTTPS and protocols like TLS 1.3. That matters, and modern implementations do a good job of securing the connection.
But when someone pastes customer information into an AI application, or connects an agent to a company database, the security question doesn't end once the connection is encrypted. The application still has to process that information. Depending on the system, it might pass through an AI harness, a retrieval service, a model endpoint, a connected tool, or an observability platform.
I kept thinking about healthcare and education, where sensitive information falls under laws like HIPAA and FERPA. What happens if an employee gives an AI assistant information it wasn't supposed to receive? What protections do enterprise providers actually offer? And could additional encryption help without making these systems too slow or expensive to run?
Those questions became a research project in my Advanced Computer Security class at Ashland University, which I worked on with Chris VanHesteren, Sean Burns, and Gavin Zeager. I wanted to understand the security boundaries, but I also wanted to measure the engineering tradeoffs myself.
One disclaimer before going further: I'm a student, not a lawyer. Nothing here is legal advice.
CHAPTER 02 · 1 MIN
Where Does Your Data Actually Go?
Being able to read the data and being a vulnerability are different things.
When people picture "using AI," they usually picture a chat box and a model. In most real products, the model is one component of a bigger system.
The piece in the middle is usually called the harness: the runtime wrapped around the model. It assembles the context window from your message, a system prompt, the conversation so far, and anything it retrieves. It decides when to call tools, runs those calls, feeds the results back to the model, and repeats until the task is done. More and more, those tools connect through the Model Context Protocol (MCP), which gives an agent a standard way to reach file systems, ticketing systems, databases, and internal APIs.
That architecture is what makes agents useful. It's also why "Is the connection encrypted?" is only the first question. Follow one prompt through the figure and ask three things at every stop: Can this component read the data? Is it supposed to? And what actually goes wrong here?
Being able to read the data and being a vulnerability are different things. The model endpoint can read your prompt, and it has to, because inference runs on plaintext tokens. If your company has an agreement covering that provider, that access is authorized. That's the system working as designed.
The interesting problems sit at the edges people forget. Tool credentials are often broader than the task needs. Retrieved documents and tool results land in the same context window as your instructions, so untrusted text gets a chance to issue instructions of its own. And observability is easy to overlook. OpenAI's Agents SDK, for example, enables tracing by default, its traces can include model and tool inputs and outputs, and its trace_include_sensitive_data setting is True unless you change it. That's a sensible default for debugging. It also means a trace store can quietly become one more copy of whatever your users pasted.
CHAPTER 03 · 1 MIN
What Are We Really Protecting?
An envelope can move the point where plaintext begins. It can't remove it, because the model has to read the prompt to answer it.
My first instinct was that sending regulated data to an AI system was just a bad idea. The actual rules are more nuanced, and more useful.
HIPAA doesn't prohibit cloud processing. HHS guidance on cloud computing allows covered entities to use cloud providers for electronic health information under a business associate agreement and the Security Rule's safeguards. It even treats a provider that stores only encrypted data, without the key, as a business associate. FERPA works similarly: a school can share education records with an outside service as a "school official" when, among other conditions, the vendor performs an institutional function, stays under the school's direct control, and uses the records only for the authorized purpose.
So the risk usually isn't "AI touched the data." It's disclosure to a system nobody approved, an agent that can reach more than it should, data kept longer than anyone intended, or a configuration that doesn't match the agreement.
Agents add a newer category of risk. The OWASP Top 10 for Agentic Applications, published in December 2025, ranks agent goal hijack first, followed by tool misuse and identity and privilege abuse. These aren't only hypothetical. In 2025, researchers disclosed EchoLeak (CVE-2025-32711), an indirect prompt injection in Microsoft 365 Copilot that could disclose data Copilot had access to. Microsoft fixed it on the server side.
That's where encryption comes back in, with an important distinction. TLS protects data between two endpoints. Wherever TLS terminates, at a load balancer, an API gateway, or a proxy, the payload is readable again. An application-layer envelope encrypts the body itself, so intermediaries pass along ciphertext and only the service holding the key can open it.
But something still has to open it. An envelope can move the point where plaintext begins. It can't remove it, because the model has to read the prompt to answer it.
CHAPTER 04 · 2 MIN
So We Tested the Cost of Additional Encryption
A lot of what I would have called “encryption overhead” was really formatting overhead.
If an envelope is useful at intermediaries, the obvious objection is cost. Encrypting twice sounds slow, so we measured it instead of assuming.
We ran one FastAPI service in two modes on the same machine: plaintext JSON over TLS 1.3, and the same JSON sealed in an AES-256-GCM envelope (version, key ID, nonce, and Base64 ciphertext) over the same TLS 1.3 connection. Both modes ran an identical workload. A k6 load generator drove 120 accepted benchmark runs: 90 in a grid of three payload sizes and three concurrency levels, in five randomized paired blocks per setting, plus 30 at fixed arrival rates. We treated each run, not each request, as one data point, so thousands of requests inside a single run couldn't make the results look more certain than they were.
The envelope had a real cost. Across the nine grid settings, median request latency rose 13–52% and completed requests per second fell 16–61%. In absolute terms, the added median latency ranged from about 0.015 ms for small messages under light load to about 65 ms for the largest messages under the heaviest load.
Two results surprised me.
First, the cipher wasn't the expensive part. An in-process profile put AES-GCM at roughly 7–13% of the server's envelope work, while JSON and Base64 handling took 78–94%. A lot of what I would have called “encryption overhead” was really formatting overhead.
Second, the cost nearly disappeared next to inference. In a separate ten-run follow-up with a local Qwen model, the envelope added less than 1% to total response time, with one-sided 95% upper bounds of 0.36% for 32-token responses and 0.65% for 256-token responses. When a model takes hundreds or thousands of milliseconds to answer, a few milliseconds of envelope work barely registers.
The limits matter as much as the results. This was one Apple Silicon machine, one server worker, Docker networking, and a deterministic workload. We didn't test a commercial AI service, a real TLS-terminating gateway, streaming responses, or resistance to any attack. In the fixed-arrival-rate runs, one 16 KiB result even went the opposite direction, by about 0.16 ms, and we still can't explain it. The full methodology and statistics are in the paper.
CHAPTER 05 · 1 MIN
What Companies and Researchers Are Doing About It
Those are meaningful controls. They also have to be turned on, scoped correctly, and matched to the products people actually use.
Enterprise AI providers aren't ignoring any of this. As of November 2026, OpenAI says it doesn't train on business or API data by default, encrypts data at rest with AES-256 and in transit with TLS 1.2 or higher, lets qualifying organizations configure retention, including zero data retention for the API, and offers a BAA to healthcare customers. Anthropic offers zero data retention and a HIPAA-ready API configuration with a BAA, and says retained data isn't used for training without permission.
Those are meaningful controls. They also have to be turned on, scoped correctly, and matched to the products people actually use. A company's agreement generally doesn't extend to an employee's personal account, and Anthropic notes that beta features are generally outside its BAA.
Researchers and platform teams are working on the harder problem: protecting data while it's being processed. Apple's Private Cloud Compute starts from the same fact my experiment ran into, that cloud AI "requires unencrypted access to the user's request." Its answer is stateless processing, no privileged runtime access for administrators, and software images that outside researchers can inspect. Confidential computing on GPUs is chasing similar guarantees for general cloud workloads. Local models avoid the third-party boundary entirely, though they move the security burden onto whoever runs the hardware.
Then there are controls that involve no cryptography at all: least-privilege scopes, which the MCP security guidance calls for directly, human approval before irreversible actions, and frameworks like NIST's Generative AI Profile, which treats data privacy and information security as separate risks to manage.
CHAPTER 06 · 2 MIN
What I Think Needs to Change
What it can't do is hide data from the system that has to understand it.
I started this project half expecting to conclude that we should encrypt everything twice. That's not where I ended up.
Encryption in transit is necessary, and the providers' controls are real. But the decisions that matter most for AI data happen above the network: what goes into the context window, which tools an agent can reach and with whose permissions, where traces and transcripts end up, how long anything is kept, and whether the system someone is using is approved for the data they're giving it.
If I were helping a team adopt agents, I'd start there. Give each agent the narrowest credentials that work. Treat retrieved documents and tool output as untrusted input. Know your retention and tracing settings before your first real user does. Keep regulated data in systems covered by the right agreements.
Additional encryption earns a place on that list, but a specific one: protecting payloads across infrastructure you operate but don't fully trust, like gateways, proxies, queues, and logging pipelines. Our results suggest the performance argument against it is weaker than it sounds once a model is in the loop, and that if it is too slow, the wire format is the first thing to fix. What it can't do is hide data from the system that has to understand it.
No single layer replaces the others. The goal isn't to stop using AI. It's to make sure the way we adopt it keeps up with the responsibility of protecting the information we give it.
Sources
- R. Redman, C. VanHesteren, S. Burns, G. Zeager, "Performance Overhead of Application-Layer AES-256-GCM Encryption over TLS 1.3," CYB 485, Ashland University, 2026.
- OWASP GenAI Security Project, Top 10 for Agentic Applications for 2026, Dec. 2025.
- NIST, AI 600-1: Generative Artificial Intelligence Profile, Jul. 2024.
- HHS Office for Civil Rights, Guidance on HIPAA & Cloud Computing.
- U.S. Department of Education, Who is a "school official" under FERPA?
- Model Context Protocol, Security Best Practices, spec 2025-11-25.
- OpenAI, Business data privacy, security, and compliance and Agents SDK tracing, accessed Nov. 2026.
- Anthropic, API and data retention, accessed Nov. 2026.
- Apple Security Research, Private Cloud Compute, Jun. 2024.
- NVD, CVE-2025-32711.