End-to-end encryption
With end-to-end encryption, your application encrypts each document for the agents that may print it. Printsluis stores and routes the encrypted document, but cannot read it. Only the agents on your customer’s network can.
The .NET SDK does this by default, from version 2.0.
What it protects against
Section titled “What it protects against”| Protected? | |
|---|---|
| Someone who gets hold of Printsluis’s database, storage, backups or logs | Yes. They hold only encrypted documents, and no key to open them. |
| People who operate Printsluis, or a request to hand over stored data | Yes. Printsluis has no key that decrypts the documents. |
| A Printsluis service that is compromised while it runs, and hands out a key of its own | Yes, if your application pins its agents. Without pinning, your application trusts the keys Printsluis hands out. |
| Someone who controls the agent’s machine | No. The agent decrypts, so whoever controls that machine can read what it prints. |
| Printsluis sending a document of its own to an agent | No. Agents print what they receive, as they do without encryption. |
| The job’s details | No. See What Printsluis can see. |
Without end-to-end encryption, documents are still encrypted when stored and deleted as soon as a job is final, but with keys that Printsluis holds: the running service can read them.
How it works
Section titled “How it works”Every agent has two keys, created on its own machine and kept in the Windows key store, where they cannot be exported:
- an identity key, created when the agent pairs, with which it authenticates and signs;
- an encryption key, which it replaces every 90 days. The agent signs each new encryption key with its identity key and registers it with Printsluis. The previous key is kept for 7 days, for jobs already encrypted for it.
When your application prints:
- It asks Printsluis for the encryption keys of every agent that can print the target: the printer’s own agent, the agents of its routes, and the agents behind the fallback alias.
- It checks that each key is signed by its agent’s identity key. With pinning, it also drops every key whose identity it doesn’t trust.
- It encrypts the document once with a random key, and seals that key for each remaining agent.
- It submits the encrypted document with
"encrypted": true. Printsluis checks only that the document is encrypted for an agent that can print the job’s printer. - The agent that claims the job decrypts it, checks it, and prints it as usual. ZPL still goes through the
agent’s command filter. If decryption fails, the job fails with
decryption_failedand nothing is printed.
The encryption is HPKE (RFC 9180) with P-256, HKDF-SHA256 and AES-256-GCM; documents are encrypted with AES-256-GCM. Identity keys are ECDSA P-256. An encrypted document is 181 bytes larger for one agent, plus 145 bytes per further agent. The size limits apply to the document itself, not to that overhead.
What Printsluis can and cannot see
Section titled “What Printsluis can and cannot see”Only the document’s content is encrypted. Printsluis needs the rest to route and report on the job.
| Printsluis can see | Printsluis cannot see |
|---|---|
| Format, document size, printer, copies and print options | The document’s content |
externalReference and metadata |
|
| The job’s status, timeline and failure codes | |
| Which agents a document was encrypted for (by key ID) |
So keep personal data out of externalReference and metadata, encrypted or not: they are stored as plain text
and are searchable.
In the .NET SDK
Section titled “In the .NET SDK”Encryption is on by default. The configuration, with the optional list of trusted agents:
{ "Printsluis": { "BaseAddress": "https://api.printsluis.nl/", "ApiKey": "pgw_...", "Encryption": { "Mode": "Required", "TrustedAgents": [ "SHA256:A5BYxvLAy0ksUzsKTRTvd8wPeKvMztUofYShogEc+4E" ] } }}Mode: Required(the default) encrypts every document, and never falls back to sending it unencrypted. When no usable key is left,PrintAsyncthrows before anything is submitted.Mode: Offsends documents unencrypted, for example while agents are being updated.TrustedAgentsis optional. When set, the SDK only encrypts for agents whose fingerprint is in the list.- The SDK caches the keys for 5 minutes per target. When an agent rotated its key in the meantime, it fetches the keys again and retries once, with the same idempotency key.
Details and error codes: .NET SDK.
Pinning agents
Section titled “Pinning agents”Without pinning, your application trusts the agents’ keys that Printsluis hands out, after checking that each is signed by its agent’s identity key. That protects stored data, but a compromised Printsluis service could hand out an identity and key of its own. Pinning rules that out: your application only encrypts for agents whose identity it checked itself.
Each agent’s identity has a fingerprint, in the form SSH uses for host keys:
SHA256:A5BYxvLAy0ksUzsKTRTvd8wPeKvMztUofYShogEc+4ETo pin an agent:
- Get the fingerprint on the agent’s own machine, from the agent’s IT:
PrintsluisAgent.exe pairprints it, andPrintsluisAgent.exe diagnoseshows it on itsIdentityline. See Installing the agent. - Add it to
TrustedAgents.
Don’t copy the fingerprint from the portal or from GET /v1/agents: those come from Printsluis, and pinning only
helps when the fingerprint did not.
Then:
- When you add an agent (a new site, a route, a replacement PC), add its fingerprint. Until then, printing to its
printers fails with
encryption_untrusted, and the error lists the agents’ IDs and fingerprints to compare. - When an agent pairs again, its fingerprint changes: update the list.
- The 90-day rotation of encryption keys needs no change: the fingerprint is of the identity key, which signs each new encryption key.
Requiring encryption
Section titled “Requiring encryption”An admin can turn on Only accept encrypted documents in the portal’s settings. Printsluis then refuses
unencrypted jobs with 422 encryption_required, so no readable document reaches it by mistake. Turn it on once
every application that prints for the organization encrypts its documents.
- Test prints from the portal and the API still work: Printsluis made those labels itself.
- Reprints copy the original document as it was, encrypted or not.
Agents
Section titled “Agents”Agents need a version that supports encryption. GET /v1/agents shows hasEncryptionKey for each agent. An agent
without a key still prints unencrypted documents. Printing an encrypted document to a target whose agents have no
key fails with encryption_unavailable; update the agents first. Agents that update themselves get a key without
pairing again.
Other languages
Section titled “Other languages”The HTTP API accepts encrypted and unencrypted documents. The building blocks are public:
GET /v1/encryption-keys returns, for a target, each agent’s identity key, its encryption key, the key’s creation
time and the identity key’s signature; a job is submitted with document.encrypted: true and the encrypted
document, base64-encoded, in document.content. See the API reference.
Any HPKE library that supports the suite above can produce the encrypted document. The exact byte format is not described on this site yet; until it is, use the .NET SDK for encrypted printing, or send documents unencrypted.