An email encryption gateway encrypts, decrypts and signs mail on behalf of the whole organisation, so it holds private keys that can read every protected message and a mail routing position that can quietly copy or redirect them. Unlike end-to-end encryption on a user's device, gateway or policy-based encryption deliberately centralises keys, certificates and plaintext handling on one platform, whether it runs on your own servers or as a cloud service. That design is what makes encryption usable at scale, and it is also why the gateway's own admin roles, service accounts, key store, logs and recovery deserve the same care as a certificate authority. This vendor-neutral guide is for messaging engineers, PKI owners and security operations teams who run or own such a gateway. For the encryption standards themselves see the OpenPGP and S/MIME Email Encryption Guide; for choosing a product see the Email Encryption buyer's guide.
Key takeaways
- The gateway is a key custodian. Any private key it holds for decryption or signing can expose or forge mail for every mailbox it serves, so key storage and key admin rights are the centre of the threat model.
- Policy is a security control. Whoever can edit encryption rules, bypass lists or routing can switch protection off for chosen recipients without touching a single key.
- Connectors are privileged non-human identities. Mail flow connectors, directory bind accounts, certificate enrolment credentials and portal API keys need owners, narrow scope and rotation.
- Decrypted content needs a defined home. Plaintext copies in queues, quarantine, journaling and the external recipient portal must be inventoried, retained deliberately and access logged.
- Recovery depends on key escrow done well. Backed up keys under split custody let you read archived mail after a rebuild; badly stored escrow copies are the easiest way to lose all of it.
What makes up a gateway's attack surface
Gateways package these functions differently, but most combine the same parts. Each holds sensitive material and each involves its own privileged identities.
| Component | What it holds or does | Privileged identities involved | Primary hardening |
|---|---|---|---|
| Key and certificate store | Private keys for S/MIME or OpenPGP, domain keys for gateway to gateway encryption, signing keys | Key administrators, gateway service account, HSM or key service client | Non-exportable keys in an HSM or key service, split key admin role |
| Policy and rule engine | Decides what is encrypted, signed, decrypted or bypassed | Policy administrators, automation API clients | Change control, two-person approval for bypass rules |
| Mail flow connectors | Receive mail from and return it to the mail platform | Connector certificates, relay credentials, transport rules in the mail platform | Mutual TLS or certificate pinned connectors, monitored routing changes |
| Directory and certificate lookup | Finds recipients' public keys and user attributes | Directory bind account, LDAP or API credentials | Read only scope, encrypted transport |
| Certificate enrolment | Requests and renews user and gateway certificates from a CA | CA account, enrolment API key or registration authority certificate | Scoped enrolment profile, stored in a secrets manager |
| External recipient portal | Lets outside recipients read and reply to encrypted mail | Portal admins, recipient accounts, one-time passcode or SSO trust | MFA for admins, rate limiting, session limits, message expiry |
| Queues, quarantine and journaling | Plaintext or decrypted copies in transit and in review | Quarantine reviewers, journaling and archive accounts | Least privilege review roles, retention limits, access logging |
RFC 8551 (S/MIME 4.0) notes that a trusted gateway may remove an encryption envelope while keeping the signature intact. That is the normal job of an inbound gateway, and it is exactly why the decrypted copy, and the system that makes it, become high value. Relevant ATT&CK techniques include T1114 Email Collection, T1114.003 Email Forwarding Rule (the same outcome achieved through gateway routing), T1552 Unsecured Credentials for connector secrets in scripts and T1098 Account Manipulation for added admin rights. See the T1114 Email Collection Defensive Guide.
Administrative roles and separation of duties
NIST SP 800-53 AC-5 (separation of duties) and AC-6(5) (privileged accounts) set the goal: no single gateway role should be able to export a decryption key, read decrypted mail and change the audit settings that would show it.
| Role | Can do | Should not be able to do | Typical holders |
|---|---|---|---|
| Platform administrator | Patching, connectors, authentication, networking | Export keys, read quarantined content, change audit forwarding alone | Two to four messaging engineers |
| Key administrator | Generate, import, renew and revoke keys and certificates | Edit encryption policy or bypass rules | PKI team |
| Policy administrator | Edit encryption, signing and decryption rules | Manage keys or approve their own bypass entries | Messaging security team, with peer approval |
| Quarantine or message reviewer | Release or delete held messages within a scope | View all mailboxes or change policy | Service desk or security operations, scoped by group |
| Auditor | Read logs and reports | Change anything | Security operations, internal audit |
| Key escrow custodian | Hold a share of the recovery secret | Use it alone | Senior staff outside the messaging team |
- Dedicated admin identities: separate admin accounts with phishing-resistant MFA (IA-2(1)), used from a privileged access workstation. See the Privileged Access Workstations Guide.
- Built-in administrator: where the appliance or tenant has an all powerful local account, set a long random password, store it under split control and use it only for break-glass.
- Bypass rules need approval: rules that exempt a domain, sender or recipient from encryption or from decryption scanning are the quiet way to undo the control. NHI Mgmt Group recommends a two-person rule and an expiry date on every bypass entry.
- Directory groups as a back door: if gateway roles map from directory groups, anyone who controls the directory can grant themselves key admin. Monitor those groups as tier 0.
Keys, certificates and escrow
NIST SP 800-57 Part 1 frames the decisions: separate keys by purpose, define cryptoperiods, and protect keys at the level of the most sensitive data they protect. For a gateway that translates into a short list.
- Separate signing and encryption keys: As general key management practice, use each key for a single purpose. A signing key does not need escrow; an encryption key usually does, because archived mail must stay readable.
- Non-exportable storage: hold gateway private keys in an HSM or cloud key service where the platform supports it, so a compromised admin account can use a key but cannot copy it. See the HSM Deployment and Operations Guide.
- Escrow under split knowledge: encrypt escrowed encryption keys with a key held by different custodians from the gateway admins, and keep escrow copies out of the routine gateway backup set.
- Algorithm currency: RFC 8551 makes AES-128 GCM and AES-256 GCM mandatory content encryption algorithms and keeps AES-128 CBC only as a legacy requirement that may be demoted. Configure authenticated encryption for outbound mail wherever recipients support it, and review the fallback list each year.
- Certificate lifecycle: track every gateway and user certificate with an owner and renewal date (SC-17). The enrolment credential that requests certificates from your CA is itself a non-human identity that can mint trusted identities; scope its profile to email protection only.
- Revocation plan: know how you would revoke and replace a gateway key, how partners would learn the new certificate and how long old mail stays readable with escrowed keys.
See the Cryptographic Key Management Guide for cryptoperiods and custody models.
Service accounts and integration credentials
A gateway rarely works alone. It talks to the mail platform, the directory, the CA, the archive and sometimes data loss prevention and ticketing tools. Each link is a credential.
| Integration | Credential | Risk if misused | Control |
|---|---|---|---|
| Mail platform inbound and outbound connectors | TLS certificate, relay IP allowlist, connector secret | Mail routed around the gateway or through an attacker relay | Certificate based connectors, alerts on routing and transport rule changes |
| Directory lookup | Bind account or API client | Directory enumeration, credential reuse | Read only, restricted attributes, rotated (IA-5) |
| Certificate authority | Enrolment API key or RA certificate | Issuing trusted email certificates for any address | Profile limited to email protection, stored in a secrets manager |
| Archive and journaling | Journal mailbox or archive API key | Bulk read of decrypted mail | Dedicated account, access logged, reviewed quarterly |
| Automation and reporting API | API key or OAuth client | Silent policy change or data export | Least privilege scopes, short lifetimes, IP restriction |
Treat these accounts under IA-9 (service identification and authentication) and record each in your non-human identity inventory with an owner. See the Service Account Security Guide and the API Key Management Guide. Transport between the gateway and partner mail servers is covered in the SMTP Security, STARTTLS and MTA-STS Guide.
Plaintext, portal and data handling
- Inventory where plaintext exists: inbound decryption, content scanning, quarantine, journaling and the recipient portal all hold readable copies. Message encryption protects content only between the points that hold the keys, so every decryption point is in scope for SC-28 (protection at rest).
- Retention by design: set message expiry in the external portal and retention limits for quarantine (SI-12). Our default suggestion is portal messages expire within 30 to 90 days unless a business owner records a longer need.
- Portal accounts: outside recipients authenticate with one-time passcodes, registered passwords or federated sign-in. Rate limit passcode attempts, cap session length and log every portal sign-in and download.
- Reviewer scope: quarantine reviewers should see only the groups they support, and release of a held decrypted message should be logged with the reviewer's identity.
Logging and monitoring
Forward gateway logs to a SIEM that gateway administrators cannot alter (AU-9), and log use of privileged functions (AC-6(9)). Priority events:
- Key generation, import, export attempts, deletion and escrow recovery.
- Changes to encryption, decryption and bypass policy, and to routing or connectors on both the gateway and the mail platform.
- Admin role grants, new API keys and authentication failures for admin accounts.
- Bulk quarantine release, bulk portal downloads and changes to log forwarding itself.
See the SIEM Guide and the Email Gateway and Message Trace Detection Guide.
Hardening an existing gateway: a phased approach
- Inventory (weeks 1 to 2): list every key, certificate, connector, service account, API key, admin and bypass rule, with an owner for each.
- Admin separation (weeks 2 to 4): move admins to dedicated MFA accounts, split key, policy and audit roles, and vault the built-in account. Pilot with one admin first and keep the old role assignments documented for rollback.
- Keys (weeks 4 to 8): move private keys into an HSM or key service where supported, separate signing from encryption keys and set up split custody escrow. Test decryption of archived mail before retiring any old key store.
- Connectors and integrations (weeks 6 to 10): convert to certificate based connectors, scope the directory and CA accounts and rotate every integration secret.
- Logging and response (weeks 8 to 12): forward logs, build the alerts above and write a key compromise runbook covering revocation, partner notification and re-keying.
- Recovery test (quarter end): rebuild a gateway from backup and escrow in an isolated environment and confirm it decrypts a sample of archived mail.
Timings are NHI Mgmt Group recommendations for a mid-sized estate; adjust to your change windows.
Decision guidance
- Self-hosted or service: a self-hosted gateway gives you direct control of key storage and network placement but makes patching and HSM integration your job. A cloud service shifts operation to the provider; ask where keys live, who at the provider can use them and whether you can hold your own key (see the BYOK, HYOK and External Key Management Guide).
- Escrow or not: escrow encryption keys when archived mail must stay readable for legal or business reasons; do not escrow signing keys.
- Small organisations: with one or two admins, full role separation may be unrealistic. Compensate with MFA, a vaulted built-in account, logs forwarded to a provider or managed service the admins do not control, and quarterly review of bypass rules.
Detection and measurement
- Keys in hardware: percentage of gateway private keys held non-exportable.
- Bypass hygiene: number of active bypass rules, and percentage with an owner and expiry date.
- Integration credential age: days since last rotation for each connector and API secret.
- Admin coverage: percentage of admin accounts that are dedicated and protected by phishing-resistant MFA.
- Recovery readiness: date of the last successful restore and archive decryption test.
Framework mapping
| Control area | NIST SP 800-53 Rev 5 | NIST CSF 2.0 |
|---|---|---|
| Admin roles and separation | AC-2(7), AC-5, AC-6(5) | PR.AA-05 |
| Admin authentication | IA-2(1) | PR.AA-03 |
| Connectors and service accounts | IA-5, IA-9 | PR.AA-01 |
| Keys and certificates | SC-12, SC-13, SC-17 | PR.DS-02 |
| Decrypted content at rest and retention | SC-28, SI-12 | PR.DS-01 |
| Policy change control | CM-3, CM-6 | PR.PS-01 |
| Logging and review | AU-6, AU-9, AU-12, AC-6(9) | PR.PS-04, DE.CM-03 |
| Backup and recovery | CP-9, CP-10 | PR.DS-11, RC.RP-01 |
Common failure patterns
- Escrow beside the data: escrowed keys are stored in the same backup as the gateway, so one stolen backup exposes years of mail.
- Permanent bypass lists: a partner domain was exempted for a migration and never removed.
- One admin role: the same people manage keys, policy and logs.
- Unwatched routing: a transport rule or connector change in the mail platform sends mail around the gateway, and nobody alerts on it.
- Forgotten enrolment credential: the CA API key used at deployment still has broad issuance rights.
- Untested archive decryption: keys were rotated or rebuilt and old mail can no longer be opened.
Practitioner checklist
- Inventory every gateway key, certificate, connector, service account, API key and bypass rule with an owner.
- Split platform, key, policy, review and audit roles across different people.
- Give every admin a dedicated account with phishing-resistant MFA and vault the built-in account.
- Hold private keys non-exportable and separate signing from encryption keys.
- Escrow encryption keys under split custody, away from routine backups.
- Require approval and expiry dates for bypass rules.
- Use certificate based connectors and alert on routing changes on both sides.
- Scope and rotate directory, CA, archive and API credentials.
- Forward logs to a SIEM the gateway admins cannot change.
- Test a rebuild and archive decryption at least once a year.
Standards and references
- NIST: SP 800-177 Rev. 1 Trustworthy Email
- IETF: RFC 8551 S/MIME Version 4.0 Message Specification
- NIST: SP 800-57 Part 1 Rev. 5 Recommendation for Key Management
- NIST: SP 800-53 Rev. 5 Security and Privacy Controls
- NIST: Cybersecurity Framework 2.0
- NCSC: Secure system administration
- MITRE ATT&CK: Email Collection
Related NHI Mgmt Group resources: OpenPGP and S/MIME Email Encryption Guide · Email Encryption · Email Security Guide · Securing the PAM Vault Itself