Security

OPC UA security & certificates

Security is built into OPC UA, not bolted on. A connection negotiates a security policy and mode, then client and server authenticate each other with X.509 certificates. Understanding these two ideas (modes and trust) resolves most security questions and connection failures.

The four pillars

PillarWhat it protects
EncryptionConfidentiality: nobody can read the traffic
SigningIntegrity: messages can't be tampered with
AuthenticationIdentity, of the application (certificate) and user
AuthorisationPermissions: what an authenticated user may do

Security modes

  • None, no signing/encryption. Only for isolated testing.
  • Sign: messages are signed (integrity + auth) but not encrypted.
  • Sign & Encrypt: signed and encrypted. Use this in production.

Each mode pairs with a security policy (the cipher suite, e.g. Basic256Sha256 or the newer Aes256 policies). Prefer modern policies and disable deprecated ones.

Which OPC UA security policy should you use?

Use the newest policy that both client and server offer, with SignAndEncrypt. In practice that means Aes256_Sha256_RsaPss or Aes128_Sha256_RsaOaep where available, Basic256Sha256 where they are not, and never the deprecated SHA-1 policies. Check the list in the server's endpoint configuration, then disable what you do not use.

Policy (name as most stacks show it)StatusUse it?
NoneNo signing or encryptionIsolated testing only
Basic128Rsa15Deprecated (SHA-1)No: disable
Basic256Deprecated (SHA-1)No: disable
Basic256Sha256Current, widely supportedYes, where the newer policies are not offered
Aes128_Sha256_RsaOaepCurrent, newer RSA policyYes, preferred when both sides support it
Aes256_Sha256_RsaPssCurrent, newer RSA policyYes, preferred when both sides support it

How certificate trust works

Every OPC UA application has its own instance certificate. On connect, client and server exchange certificates; each keeps a small PKI store:

pki/
 ├─ own/          # this application's own cert + private key
 ├─ trusted/certs # certificates we trust
 ├─ trusted/crl   # certificate revocation lists
 ├─ issuer/       # CA certs (if using a CA)
 └─ rejected/     # certs seen but not yet trusted
The classic first-connect failure: the peer's certificate lands in rejected/. Move it to trusted/certs on both ends, then reconnect. This single step fixes most "BadSecurityChecksFailed" errors.

Self-signed vs CA-signed

Self-signed certificates are fine for small, static deployments: you manually trust each one. For fleets, a Certificate Authority (or the OPC UA GDS: Global Discovery Server) scales trust: trust the CA once and every certificate it issues is trusted automatically.

User authentication

Application (certificate) identity is separate from user identity. A server can accept anonymous, username/password, or user certificate tokens. Match what the server expects, and prefer named users over anonymous in production so actions are attributable.

Hardening checklist

  1. Use Sign & Encrypt with a modern policy; disable None and deprecated policies.
  2. Replace default/self-signed certs with managed ones; set sensible expiry and rotate.
  3. Require named users; disable anonymous where possible.
  4. Apply least-privilege authorisation: read-only unless write is truly needed.
  5. Keep CRLs current; remove stale certs from trusted/.
  6. Put OPC UA on a segmented network; restrict the port to known clients.
  7. Patch your OPC UA stack: treat it like any other networked service.
Stuck on a handshake error right now? Jump to connection troubleshooting.

Questions engineers ask

Why is my OPC UA certificate rejected?

The receiving side has not trusted it yet: it sits in the rejected folder until someone moves it to the trusted folder. If you use a CA, the CA certificate must be in the issuer store with a current revocation list. The ApplicationUri and host name in the certificate must also match the application and the address you dial.

What happens when an OPC UA certificate expires?

The peer rejects it with BadCertificateTimeInvalid and the connection fails, often without warning on a running line. Track expiry dates, renew before they pass, and check the clocks on both machines: a wrong clock gives the same error.

Should I use self-signed or CA-signed certificates?

Self-signed certificates suit a few static connections, because you trust each one by hand. For many machines, a certificate authority or a Global Discovery Server scales better: trust the issuer once and every certificate it signs is accepted.

Is OPC UA security enough on its own for an OT network?

It covers the connection: authentication, integrity and encryption. It does not replace network segmentation, least-privilege user roles and patching of the OPC UA stack. Treat it as one layer of plant security, not the whole of it.

Matching status codes: BadSecurityPolicyRejected, BadCertificateUntrusted, BadCertificateTimeInvalid, BadCertificateUriInvalid, BadCertificateHostNameInvalid, BadSecurityChecksFailed.

Last updated 1 December 2026 · Educational resource.

Next: Free tools & test servers →

Free download
OPC UA Troubleshooting & Integration Checklist
The field-tested checklist engineers use to diagnose certificates, ports and namespace problems fast, plus a Python (asyncua) client template.
Get the free checklist →
Free, no course, no login