[opcuaclient] OpcUaClient — CRL/revocation handling #335
Reference in New Issue
Block a user
Delete Branch "auto/opcuaclient/5"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
Explicit revoked-cert handling and three new certificate-validation knobs.
OpcUaClientDriverOptions.cs— newOpcUaCertificateValidationOptionsrecord exposed asCertificateValidation:RejectSHA1SignedCertificates = true(deliberately tighter default; SHA-1 certs are spec-deprecated)RejectUnknownRevocationStatus = false(conservative for ops without CRL infrastructure)MinimumCertificateKeySize = 2048OpcUaClientDriver.cs— replaced theif (AutoAcceptCertificates)validator hook with an unconditionalOnCertificateValidationhandler that delegates to a static, testableEvaluateCertificateValidationpipeline returning aCertificateValidationDecisionrecord. Order:BadCertificateRevoked/BadCertificateIssuerRevoked→ always reject with a distinct "REVOKED" log line1.2.840.113549.1.1.5/1.2.840.10045.4.1) when flag setBadCertificateRevocationUnknown/BadCertificateIssuerRevocationUnknowngated by the new flagBadCertificateUntrustedhonouring existingAutoAcceptCertificatesTest plan
dotnet build src/ZB.MOM.WW.OtOpcUa.Driver.OpcUaClient— clean (0 / 0)dotnet test tests/ZB.MOM.WW.OtOpcUa.Driver.OpcUaClient.Tests— 127 / 127 passed (12 new inOpcUaClientCertValidationTests: defaults, every decision-pipeline branch, SHA-1 detection helper, key-size helper). SHA-1 cert synthesis uses a customX509SignatureGeneratorbecause .NET 10'sCertificateRequest.CreateSelfSignedrejects SHA-1.🤖 Auto-generated by the Mode-B execution loop. Closes #277.
Closes #277
Adds explicit revoked-vs-untrusted distinction to the OpcUaClient driver's server-cert validation hook, plus three new knobs on a new OpcUaCertificateValidationOptions sub-record: RejectSHA1SignedCertificates (default true — SHA-1 is OPC UA spec-deprecated; this is a deliberately tighter default) RejectUnknownRevocationStatus (default false — keeps brownfield deployments without CRL infrastructure working) MinimumCertificateKeySize (default 2048) The validator hook now runs whether or not AutoAcceptCertificates is set: revoked / issuer-revoked certs are always rejected with a distinct "REVOKED" log line; SHA-1 + small-key certs are rejected per policy; unknown-revocation gates on the new flag; untrusted still honours AutoAccept. Decision pipeline factored into a static EvaluateCertificateValidation helper with a CertificateValidationDecision record so unit tests cover all branches without needing to spin up an SDK CertificateValidator. CRL files themselves: the OPC UA SDK reads them automatically from the crl/ subdir of each cert store — no driver-side wiring needed. Documented on the new options record. Tests (12 new) cover defaults, every branch of the decision pipeline, SHA-1 detection (custom X509SignatureGenerator since .NET 10's CreateSelfSigned refuses SHA-1), and key-size detection. All 127 OpcUaClient unit tests still pass. Closes #277 Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>