BadSecurityPolicyRejected
BadPolicy mismatch
BadSecurityPolicyRejected means the server does not offer, or has disabled, the security policy your client asked for. Call GetEndpoints with security None, read the SecurityPolicyUri values the server actually advertises, and configure the client to one of them. Do not re-enable deprecated policies to make a client work.
What you actually see
A client that connects fine to one server refuses to connect to another, and the failure happens immediately at channel open with no certificate dialog at all.
Why it happens
- The client requests a policy the server never offersA client pinned to Basic256Sha256 against a server offering only Aes256_Sha256_RsaPss and None has nothing to negotiate. The endpoint list is the authority; a policy hard-coded in client configuration is just a request.
- The server was hardened and deprecated policies were removedTurning off Basic128Rsa15 and Basic256 is standard hardening. Older clients and PLC-embedded clients that only implement the SHA-1 era policies then stop connecting, usually the morning after a security change window.
- The stack build does not implement the policySpec support and stack support are different statements. open62541 1.5 lists None, Basic128Rsa15, Basic256, Basic256Sha256 and Aes256Sha256RsaPss and no ECC policies at all, so an ECC policy negotiated on paper cannot be honoured by that build.
- The client connected to a discovery endpoint rather than the session endpointDiscovery endpoints commonly offer only None. A client that takes the discovery endpoint's URL and then demands a secure policy on it is asking for something that endpoint does not provide.
- Certificate key type incompatible with the requested policyAn RSA certificate cannot be used with an ECC policy and the reverse. Some servers report the mismatch as a rejected policy rather than as a certificate policy failure, which sends people looking in the wrong place.
How to fix it
In diagnostic order: work down, do not skip ahead.
- List what the server actually offersCall GetEndpoints with security None against opc.tcp://host:4840 and print SecurityPolicyUri and SecurityMode for every endpoint. UaExpert shows the same list in its endpoint selection dialog when you add the server.
- Pick a policy from that list, not from your configuration templateSet the client to a SecurityPolicyUri the server advertises, and remember the mode and the policy are independent: the same policy typically appears once with Sign and once with SignAndEncrypt.
- Check the server side if the policy should be thereOn a server you control, confirm the policy is enabled in the endpoint configuration and that the server has a certificate whose key type matches. A policy enabled with no usable certificate is silently not offered.
- Upgrade the weaker side rather than weakening the stronger oneIf an old client only speaks Basic128Rsa15, the correct answer is a client or firmware upgrade. Re-enabling deprecated SHA-1 era policies on the server to accommodate one device lowers the bar for every other connection to that server.
- Avoid best-effort policy selectorsA selector that picks the best available can silently choose None when discovery returns no secure endpoint descriptors, and the documented guidance is that it is better to fail connecting. Pin the policy and mode explicitly in production configuration.
Where it shows up, by tool and stack
| Tool / stack | What to do there |
|---|---|
| UaExpert | The Add Server dialog lists every endpoint with its policy and mode, so the negotiation is visible before you connect. If the policy you want is not in that list, the server is not offering it and no client setting will change that. |
| open62541 (C) | Version 1.5 supports None, Basic128Rsa15, Basic256, Basic256Sha256 and Aes256Sha256RsaPss, with no ECC. Build the client or server with encryption enabled or the secure policies are simply absent from the binary. |
| asyncua (Python) | set_security_string names the policy explicitly, for example Basic256Sha256,SignAndEncrypt,cert.der,key.pem. Nothing negotiates on your behalf, so a policy the server does not offer fails immediately. |
| UA-.NETStandard (C#) | SelectEndpoint picks from what GetEndpoints returned, so a rejection usually means you constructed the EndpointDescription yourself rather than selecting from the server's list. Enumerate first, then select. |
| Siemens S7-1500 | The set of policies the CPU offers depends on firmware and on the OPC UA server settings in the CPU configuration. Read the endpoint list from the CPU rather than assuming a policy is available. |
| OPC Publisher | It documents that using a best security-mode selector can end up choosing None if the server returns no secure endpoint descriptors during discovery, and that failing to connect is preferable. Configure the policy explicitly. |
What it looks like in the log
OpenSecureChannel failed: BadSecurityPolicyRejected for http://opcfoundation.org/UA/SecurityPolicy#Basic256
Requested security policy is not supported by this endpoint
The security policy does not meet the requirements set by the server
Confirm the fix
Call GetEndpoints and confirm the policy you configured appears verbatim in the returned list, then connect on that exact policy and mode combination and complete a Read.
Stop it happening again
Standardise one modern policy across the estate, inventory which devices can actually speak it before hardening, and configure clients by selecting from GetEndpoints instead of hard-coding a policy URI.
Stuck on more than one of these? The troubleshooting clinic works through broken configurations end to end, on camera.
Troubleshooting clinic →Last verified 7 September 2026 against OPC UA 1.05.07. OPC UA Connect is an educational resource and is not affiliated with the OPC Foundation.