mirror of
https://github.com/OPCFoundation/UA-.NETStandard.git
synced 2026-10-21 00:56:28 +08:00
32099910dd
## Proposed changes Three spec alignment fixes for the 1.5.378 line. - **Session AuthenticationToken** (`SessionManager`): CreateSession now always assigns a random 32 byte opaque AuthenticationToken. Previously a numeric, incrementing token was used for sessions created on a secured endpoint. OPC 10000-6 7.4.1 requires a random token of at least 32 bytes for HTTPS, and a single format keeps all transports consistent. - **OpenSecureChannel response policy** (`UaSCBinaryClientChannel`, `UaSCBinaryChannel.Asymmetric`): a client channel opened with a SecurityPolicy other than None now requires the OpenSecureChannel response to use the same SecurityPolicy and SecurityMode and to carry the server certificate. Previously the response could switch the channel to SecurityPolicy None (OPC 10000-4 5.6.2.1, OPC 10000-6 6.7.2.3). Channels configured for None are unchanged. - **Identity token decryption errors** (`Session`, `RsaUtils`): every failure while decrypting a user identity token is now reported as `Bad_IdentityTokenInvalid` without an inner result, as OPC 10000-4 7.40.2.1 specifies; the cause is logged on the server instead. An invalid length prefix in RSA-decrypted data now fails the same way as other decryption errors instead of `Bad_EndOfStream`. ## Behaviour changes - AuthenticationTokens on secured endpoints are ByteString (opaque) NodeIds instead of numeric NodeIds. - ActivateSession with an undecryptable identity token returns `Bad_IdentityTokenInvalid` in all cases, also when the client requests inner diagnostics. ## Tests - `ClientOpenSecureChannelDowngradeTests` (Core): secured client rejects a None OpenSecureChannel response; None client still accepts it. - `RsaUtilsDecryptTests` (Core): round trip; invalid length prefixes fail with the same exception type as invalid padding. - `SessionSecurityRegressionTests` (Server): opaque 32 byte tokens on a shared secured channel id; uniform ActivateSession status for identity token decryption failures. Local results (net10.0): Core 7938 passed / 0 failed, Server 511 passed / 0 failed, Client 1063 passed / 3 failed. The three Client failures (`TransferSubscriptionNativeAsync` x2, `ShortHaulStabilityTestAsync`) pass when run in isolation on both this branch and unmodified master378. The new tests also pass on net48 (Release). ## Types of changes - [x] Bugfix (non-breaking change which fixes an issue) 🤖 Generated with [Claude Code](https://claude.com/claude-code) --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>