Skip to main content

Security Model (Security)

The OPC UA security model has two layers:

  1. Transport Layer — Is the channel signed/encrypted (MessageSecurityMode)
  2. Identity Layer — What credentials does the user use to log in? (UserTokenType)

The two layers are independent; you can use either "encrypted channel + anonymous login" or "plaintext channel + username and password."

Further Reading

MessageSecurityMode​

ModeValueTamper-proofEncryption
Invalid0——
None1××
Sign2✓×
SignAndEncrypt3✓✓

SecurityPolicy​

Defining a specific cipher suite:

Policy URIAlgorithmStatus
#None—None Mode Only
#Basic128Rsa15RSA-1.5 + AES-128 + SHA-1Deprecated (Not SDK supported)
#Basic256RSA-OAEP + AES-256 + SHA-1Deprecated (Not SDK supported)
#Basic256Sha256RSA-OAEP + AES-256 + SHA-256Main SDK Purpose
#Aes128_Sha256_RsaOaepAES-128 + SHA-256 + RSA-OAEPThis feature is not currently SDK supported.
#Aes256_Sha256_RsaPssAES-256 + SHA-256 + RSA-PSSThis feature is not currently SDK supported.

This is the current SDK default setting Basic256Sha256 and the recommended OPC Foundation "current standard strength." The deprecated Basic128Rsa15 and Basic256 are no longer supported.

Certificate (X.509)​

OPC UA endpoint authentication with X.509 certificates:

  • Client Certificate (PFX) — Contains a private key; held by the client
  • Server Certificate — Server-side storage, client-side optional verification (TOFU or pre-import)
  • Mutual Trust — Both parties need to add the other party's public key to their own trusted/ directory.

The certificate SAN(Subject Alternative Name) must contain a value in the URI form of urn:<vendor>:<product>:<instance>, and URI this value ApplicationUri must match, otherwise the handshake will be rejected.

UserToken (Login credentials)​

TokenValueNote
Anonymous0Anonymous
Username1Username + Password
Certificate2X.509 User Certificate (which may be different from the transport-layer certificate)
Issued3OAuth2 / SAML Token-based authentication (not currently SDK implemented)

Combination of an encrypted channel and user identity​

ScenarioMessageSecurityModeUserTokenApplicable
Intranet DevelopmentNoneAnonymousFastest, 0 overhead
Internal Network ProductionSignUsernameTamper-Resistant + Identity Auditing
Public Network ProductionSignAndEncryptUsername or CertificateStandard Production Configuration
High SecuritySignAndEncryptCertificateTwo-factor authentication (certificate-based login + encrypted channel)

Handshake Procedure​

Client                           Server
│ ──Hello (Endpoint URL)──────▶│
│ ◀────Acknowledge─────────────│
│ ──OpenSecureChannel(cert)───▶│
│ ◀────channel established─────│
│ ──CreateSession(usercert)───▶│
│ ◀────sessionId───────────────│
│ ──ActivateSession(uToken)───▶│
│ ◀────activated───────────────│
│ ──Read/Write/Browse/...─────▶│
│ ◀────responses───────────────│

If any step fails, the result will be StatusCode (BadCertificateInvalid / BadIdentityTokenRejected / BadUserAccessDenied / ...).

Timestamp Verification​

NTP This is a mandatory requirement.

In SignAndEncrypt Sign mode, both parties verify the timestamp; a discrepancy of more than ~10 minutes will result in rejection. This must be configured in the production environment NTP.