Commit Graph

59 Commits

Author SHA1 Message Date
Suciu Mircea Adrian 6ea334a17c [master378] [CTT] Fix application certificate renewal to use configured trust stores (#4678)
Ignore supplied issuers for the default application group and validate
replacements using installed CA certificates. Add regression tests.

# Description

Certificate renewal could fail when the client omitted the issuer
certificate, even though that CA was already installed on the server.

Use the server’s configured trust stores and ignore supplied issuers for
the default application group. Clients must install CA trust material
before renewal; supplied issuers are no longer imported.

Existing validation policy and ApplyChanges behavior are preserved.

## Checklist

_Put an `x` in the boxes that apply. You can complete these step by step
after opening the PR._

- [X] I have signed the
[CLA](https://opcfoundation.org/license/cla/ContributorLicenseAgreementv1.0.pdf)
and read the
[CONTRIBUTING](https://github.com/OPCFoundation/UA-.NETStandard/blob/master/CONTRIBUTING.md)
doc.
- [X] I have added tests that prove my fix is effective or that my
feature works and increased code coverage.
- [ ] I have added all necessary documentation.
- [ ] I have verified that my changes do not introduce (new) build or
analyzer warnings.
- [ ] I ran **all** tests locally using the **UA.slnx** solution against
at least .net **framework** and .net **10**, and all passed.
- [ ] I fixed **all** failing and flaky tests in the CI pipelines and
**all** CodeQL warnings.
- [ ] I have addressed **all** PR feedback received.
2026-10-08 16:32:23 +02:00
Suciu Mircea Adrian db39629d2a [CTT][master378] Fix ServerConfiguration URI values for CTT push-management checks (#4592)
Populate ApplicationUri and ProductUri from application configuration,
guarding absent optional nodes. Add push tests verifying both values
match the advertised server identity.

# Description

Addresses the reported CTT complaint for Push Model for Global
Certificate and TrustList Management, where these ServerConfiguration
properties returned null:
- ApplicationUri (ns=0;i=25706)
- ProductUri (ns=0;i=25725)
Initializes both properties from the application configuration, with
guards for absent optional nodes.
Validation: regression tests verify Good status and nonempty values
matching the advertised server identity. All five variants pass; the
full push fixture reports 116 passed, 9 expected skips, and no failures
on .NET 10. CTT itself has not been rerun.


## Checklist

_Put an `x` in the boxes that apply. You can complete these step by step
after opening the PR._

- [X ] I have signed the
[CLA](https://opcfoundation.org/license/cla/ContributorLicenseAgreementv1.0.pdf)
and read the
[CONTRIBUTING](https://github.com/OPCFoundation/UA-.NETStandard/blob/master/CONTRIBUTING.md)
doc.
- [X] I have added tests that prove my fix is effective or that my
feature works and increased code coverage.
- [ ] I have added all necessary documentation.
- [X] I have verified that my changes do not introduce (new) build or
analyzer warnings.
- [ ] I ran **all** tests locally using the **UA.slnx** solution against
at least .net **framework** and .net **10**, and all passed.
- [ ] I fixed **all** failing and flaky tests in the CI pipelines and
**all** CodeQL warnings.
- [ ] I have addressed **all** PR feedback received.
2026-09-29 18:37:17 +02:00
Copilot 6a304ef8e2 Fix GDS Push UpdateCertificate ignoring configured SecurityConfiguration policy (master378) (#3936)
## Proposed changes

Backport of the #3931 fix to master378. On this branch, server-side GDS
Push `UpdateCertificate` validated the new application certificate with
a throwaway `CertificateValidator` that was never seeded with the
server's `SecurityConfiguration`. It therefore enforced hard-coded
defaults (`MinimumCertificateKeySize = 2048`,
`RejectSHA1SignedCertificates = true`) regardless of operator
configuration — e.g. a server configured for a 1024-bit minimum still
rejected a re-issued 1024-bit certificate with
`BadCertificatePolicyCheckFailed`. Regression originated in #3795
(integrity check switched from a lenient `X509Chain` check to the full
validator).

The master branch reworked this area entirely, so the fix is
re-implemented from scratch here, adapted to master378's
`X509Certificate2` types.

- **`ConfigurationNodeManager.UpdateCertificateAsync`**: replaced the
throwaway `CertificateValidator` with a lenient `X509Chain` integrity
check that verifies only chain integrity — valid signatures and a
complete issuer chain — using the caller-supplied issuers as the trust
anchor (`AllowUnknownCertificateAuthority`, revocation `NoCheck`,
downloads disabled). Policy (min key size, SHA-1, revocation) is
intentionally **not** applied here; it remains governed by the server's
`SecurityConfiguration` on its normal communication channels, so
configured values are honored in both stricter and more-lenient
directions.

Chain status handling: `NoError`/`UntrustedRoot` pass;
`NotSignatureValid`/`PartialChain`/`NotValidForUsage`/`InvalidBasicConstraints`
fail with `BadSecurityChecksFailed`; and the chain element count must
match the supplied issuer count to reject incomplete chains.
2026-07-03 11:35:58 +02:00
Marc Schier 43ce7ed229 Code clean up and improvements (#3532)
This pull request modernizes the OPC UA .NET codebase and tests, removes .NET Standard 2.0 support from certificate/security code, and updates test code to use C# 12 and .NET 8+ features for clarity and maintainability.
- Certificate and BouncyCastle interop files (e.g., CertificateBuilder.cs, X509Extensions.cs, X509SignatureFactory.cs) are refactored to drop NETSTANDARD2_0 support and use modern .NET APIs and conditional compilation.
- Test code across the codebase is updated to use default, strongly-typed Parse methods, collection expressions, and improved async/await patterns.
- Exception handling and assertions in tests are modernized, and test method naming is made consistent with Async suffixes.
- The project and build files are updated to clarify Roslynator analyzer usage and remove obsolete netstandard tags.
- General code and test cleanup includes improved null safety, type safety, and removal of deprecated or unused code.
2026-02-09 13:37:06 +01:00
romanett 8966e1d358 [Server] Use Classes instead of Interfaces for NodeManagers to ensure compatibility for 1.5.378 (#3497)
* Point to concrete classes instead of interfaces

* cleanup
2026-01-25 19:12:32 +01:00
romanett 8b11d2bfa8 [Server] Add several interfaces to improve testability & prepare for Dependency Injection (#3448)
* add server interfaces

* Add IConfigurationNodeManager, IDiagnosticsNodeManager, IMasterNodeManager, IStandardServer, IApplicationInstance interfaces to Server. Add IMainNodeManagerFactory to create Diagnostics & MainNodeManager

* Use IApplicationInstance interface where appropriate

* fix review feedback
2026-01-12 08:06:12 +01:00
romanett a3a6709d6f Refactor server for full async subscription management (#3442)
Refactor to make OPC UA server subscription and monitored item management fully asynchronous, improving scalability and responsiveness. All key methods in ISubscription, ISubscriptionManager, and related classes are now async, with synchronous counterparts removed.
2026-01-08 21:16:12 +09:00
Copilot e92e469923 [GDS] Add configurable validation limits for trust list file read/write operations (#3411)
* Initial plan

* Add trust list file size validation with configurable limits

Co-authored-by: romanett <7413710+romanett@users.noreply.github.com>

* Fix potential integer overflow in trust list size validation

Co-authored-by: romanett <7413710+romanett@users.noreply.github.com>

* Fix integer overflow in client trust list read validation

Co-authored-by: romanett <7413710+romanett@users.noreply.github.com>

* Add comprehensive tests for trust list size validation

Add TrustListValidationTest with tests for:
- Normal-sized trust lists (verify basic functionality)
- Trust lists exceeding 16MB limit (verify BadEncodingLimitsExceeded error)
- Trust lists just under limit (~15MB) (verify boundary condition)

Co-authored-by: romanett <7413710+romanett@users.noreply.github.com>

* Make limits configurable on client side

* fix tests

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: romanett <7413710+romanett@users.noreply.github.com>
Co-authored-by: Roman Ettlinger <romanett98@gmail.com>
2026-01-06 11:33:23 +09:00
Marc Schier 2960388560 Update headers and license files (#3388)
Update license headers to copy right year 2025, replace RCL/GPL headers with MIT, replace the nuget license with MIT (via license expression).
2025-12-04 19:44:40 +01:00
romanett 0e4b4619c8 Obsolete Sync Certificate Validator Methods (#3338)
* Obsolete Sync Certificate Validator Methods

* Update Tests

* Use HttpClientHandler directly instead of relying on reflection
2025-11-15 07:04:58 +01:00
Marc Schier 35db52a7a6 Move from .net 9 to .net 10 SDK and build new target framework .net 10 (#3333) 2025-11-13 10:45:47 +01:00
Marc Schier 712e770fbe Restructure core and built in types into base assembly and nuget (#3326)
This change adds a **new Opc.Ua.Types** nuget that contains core types that do not rely on generated code.  Why the name?  Because almost all code that was in the Types subfolder is part of it, and because we do not want to change the name of the Opc.Ua.Core nuget/assembly because code relies on it.  Any other name like base or bootstrap felt out of place due to the current structure already defining the name "types".  Key design is to depend on only a small set of libraries with limited transitive dependencies, that includes hashcode, logging.abstraction, and for non standard20 builds System.Text.Json (needed for localizedText mul parsing).  Also, key is to support .netstd 2.0 to support source generators and to allow removal of EEC_SUPPORT defines by removing std2.0 from core and all libraries.

The changes are mostly restructuring, and thus small but contain some key changes:

- **Status code** struct now comes with a Symbol field, which is used to carry symbols in case the code is not generated.  Currently (until generated) the status code struct must be manually created with a symbol or the ToSymbolicId extension must be called in the core project.  Future will generate Status code constants just like NodeId that contain the symbol which also removes the reflection-based lookup.  Several tests needed to be adjusted as they checked the status code symbol strings instead of the code.
- **Core identifiers** are copied as they were needed for code to compile, that includes attributes, a subset of status codes and node identifiers.  These will never change so no need to generate them.
- The types folder now contains **encoders**, except for json which is still in core.  Once the json encoder is ported to system.text.json it will also be included and Newtonsoft.Json dropped as dependency (-> #3329).  
- Since types relies on **IOperationContext** and **ISystemContext**, and these export IUserIdentity which relies on crypto, these were split and extended in core with ISessionOperationContext and ISessionSystemContext, which mean changes to ServerSystemContext and introduction of SessionOperationContext and SessionSystemContext classes that extend OperationContext and SystemContext.  Some runtime checks in the server are therefore needed to get at the session and auth info, however, those are anyway optional fields and are not on the critical paths, and thus a type check is in order (and was done in the past already, but against OperationContext class).
- **Manifest resources** are now split between Core (nodeset zip, some generated resoures) and Types (built in bsd/xsds).  This needs to be revisited later if the bsd/xsd need to be regenerated during type generation.  Note that the embedded resource names changed as a result. Since these are only used internally and do not constitute public API this feels reasonable vs duplication of resources in 2 assemblies.
- Reflection however now needs to load not just the built in **encodeables** from Opc.Ua.Types assembly, but also the generated encodeables from Opc.Ua.Core assembly.  For this a new helper Utils method was added to get the Core assembly when linked against Opc.Ua.Core otherwise null.
- Whatever utils methods needed to be split out into the new Opc.Ua.Types assembly, they are now in **CoreUtils** static class in Opc.Ua.Types, and Utils.xxxx forwards to them to ensure minimal changes.  Later we would want to obsolete them in favor of CoreUtils, although it might make sense to split them again into domain specific utilities, such as networking, files, etc
2025-11-10 19:33:24 +01:00
Suciu Mircea Adrian 1f47847324 Added RejectCertificateUriMismatch property and explicit ApplicationUri validation after certificates are loaded (#3244)
* Added RejectCertificateUriMismatch property and explicit ApplicationUri validation after certificates are loaded

* Perform duplicate detection on thumbprint only

* Ported handle multiple ApplictionUri, removed assign ApplictionUri from certificate

* Missing letter

* Fixed LoadPrivateKeyAsync when no applicationUri is passed.

* Add tests for validating certificates with multiple AplicationUris on ApplicationInstance level and server side

* Renamed into CheckOrCreateCertificateAsync, logged Certificate, improved tests

* Added retry logic for transient connect errors in CreateSessionApplicationUriValidationTests

* Added TODO log when telemetry instance available

* Removed unused ValidateServerCertificateApplicationUri(X509Certificate2 serverCertificate)
2025-10-31 14:17:31 +01:00
romanett 0efd9b2863 [Server] Include domains and applicationName in ServerCertificate for CreateSigningRequest Method with parameter regeneratePrivateKey = true (#3263)
* Include domains and applicationName in ServerCertificate for CreateSigningRequestAsync with parameter regeneratePrivateKey = true

* Update Libraries/Opc.Ua.Server/Configuration/ConfigurationNodeManager.cs

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

---------

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2025-10-22 22:07:16 +02:00
Marc Schier ff0095c93d Make GDS tests stable and add better logging to unit tests (#3271)
- Allow setting ReturnDiagnostics on the session factory to ensure the diagnostic settings are part of "Create" also.  Set them to SymbolicIdAndText by default.
- Better logging in unit tests, now also logs to progress including exception traces, also prefixes SERVER and TEST on console to attach the logs to the server or client side.
- GDS client stability improvements to ensure client reliably reconnects between calls when connection is lost.
- Do not dispose the application certificate when it is updated from GDS client to avoid existing sessions to crash with CryptographicException.  This needs more improvements later on because it is rather hacky today.
- Remove the certificate cache in CertificateFactory (as per discussion and agreement) which allowed re-enabling the older UserIdentity API
- Logging improvements here and there to analyze issues in unit tests better
2025-10-20 18:02:45 +02:00
Marc Schier 8e7a73c7df Introduce telemetry context and proper use of ILogger (#3213) 2025-09-25 20:25:31 +02:00
romanett ca731c3fd8 [Server] Make IAsyncNodeManager interface composable (#3186) 2025-09-04 19:16:17 +02:00
romanett a86077ac38 Make GDS Tests use ECC for connection. Update Certificate wait check to use polling mechanism. (#3167)
* Update GDS Client to use async Client API
* Make GDS Tests use ECC for connection. Update Certifiacte wait check to use polling mechanism
* Use Async Server Methods
* Add specialized ECC Test procdure
* Add Exception handling to allow errors during server application certificate exchange

---------

Co-authored-by: Marc Schier <marcschier@users.noreply.github.com>
2025-08-22 16:55:25 +02:00
romanett fb2a096789 Update GDS Client to use async Client API and deprecate sync Calls. (#3164)
* Update GDS Client to use async Client API
2025-08-18 17:21:58 +02:00
Marc Schier 9830e5d53e Enable roslynizer and fix all analyzer issues (#3157)
* Fix warnings and suggestions
* Enable roslynator
2025-08-16 04:10:24 -07:00
romanett cae5fb25da [Server] Implement Support for Async Method Calls (#3090)
* Implement support for async method Call in the server
* Implement Cancellation
* Add new generated async supported Endpoints & Server Methods
* Make SecureChannelContext AsyncLocal
* Implement SubscriptionAsync
* Add Async Request Queue
* Implement sync calls for async NodeManagers. Add Warning
* Use second file for Async Interface
2025-08-12 10:44:57 +02:00
romanett 751d614dc6 make ICertificateStore use Async suffixes (#3148) 2025-08-08 12:24:03 +02:00
romanett d4e44c6311 Add async suffix to methods returning a Task (#3145)
* Add async suffix to asnyc methods
2025-08-07 13:55:15 +02:00
romanett 7f037ef23e Enforce Valid Certificate Store configuration (#3023)
* fix Null Reference Exceptions on nonconfigured certificate stores

* try to fix gds tests

* Use explicit null check

* Validate Certificate Store configuration on startup in SecurityConfiguration.Validate.
Remove Obsolete CertificateStore Properties.

* remove unecessary fields

* fix tests

* fix client config

* Validate Stores by opening them

* fix typo

* check stores instead of storepath

* fix ClientTest

* Add Tests for Validate Mehtod of SecurityConfiguration

* Update ApplicationConfiguration xsd to respect stricter validation
2025-03-28 16:07:48 +02:00
romanett 7cbeee7155 [Test] Add ECC Certificates to various tests (#2961)
* Generate ECC Certificates in Client Tests

* Add more tests

* reenable check of certificate

* fix tests

* Dont use random in test

* fix unsupported certificate types

* fix Hash algorithm for nistP384 curve on linux as the friendly name is ECDSA_P384 instead of nistP384

* use friendly name by default and add special case only for linux while taking care of nullability

* disable special casing for finding correct certificates

* fix tests on net 462

* update Certificate Identifier
2025-02-11 14:20:21 +02:00
romanett 493da5d5be Extend ServerConfiguration & GDS Server for ECC (#2817)
* update ServerConfiguration Node to support multiple Application Certificates. Trust List Support for User Certificates & Https Certificates

* GDS ready for ECC Step1

* fix test

* fix build

* ensure hash algorithm is set

* update configurations to new format, fix minor ecc bugs

* implicitly set certificate type of certificate identifier
extend CertificateFactory to allow Revocation with ECC Issuer Certificate

* Revert "update configurations to new format, fix minor ecc bugs"

This reverts commit 9ee17f3aff.

* Allow GDS Certificate Group to have multiple CA Certificates with different Certificate Types

* fix minor bugs

* adress review feedback

* fix some issues

* fix creation of CA signed ECC Certificates

* Update configurations to new ApplicationCertificateFormat and add extra CA Certificates for ECC Certificates

* remove brainpool certs from configuration

* Generate ECC Certificates in Client Tests

* Revert "Generate ECC Certificates in Client Tests"

This reverts commit 90b395f4ff.

* fix crl tests on platforms not supporting ECC

* fix crl test

* Update READMEs for ECC
2025-01-21 16:34:48 +02:00
romanett 4a44238b8c [Server] Allow Subject Name Change of Application Certificate in GDS Push scenario (#2833)
* allow Subject Name change

* modifiy subject names in push test
2025-01-21 12:23:14 +02:00
romanett 760bfd92bc [Server] Fix: Return full CertificateChain after Certificate Update (#2861)
* simpler update process

* update endpoint descriptions

* adress review feedback

* cleanup
2025-01-13 17:17:15 +02:00
Martin Regen 5ed73fcd95 merge latest release 2024-12-07 17:30:58 +01:00
Martin Regen f76c457c72 Support .NET 9.0 build (#2865)
* support .NET 9.0 build
* provide a helper to use the X509CertificateLoader also on older .NET versions
2024-11-28 12:57:10 +01:00
Suciu Mircea Adrian f001eabcc8 Add support for ECC profiles (#2398)
- Port support for ECC NIST/Brainpool profiles from prototyping_ecc branch
- Implement CertProvider to load certs per connection / profile
- Backward compatibility of configuration for existing apps
- SecurityConfiguration specifies app cert types for each profile
- Autodetect the ECC support for brainpool/nist based on platform (mac OS 10 doesn't support brainpool)
- ECC supported on net48 / net5.0 / net 6.0 / netstandard2.1
- ECC supported on windows / linux / macOS (brainpool not < macOS11)
- Self signed certs for each profile are created on start similar to RSA
- RSA only profiles are supported on .NET standard 2.0

Co-authored-by: Martin Regen <mregen@microsoft.com>
2024-10-17 16:02:20 +02:00
romanett 00b1c46168 [Server] GDS Push: Enable regeneratePrivatekey for CreateSigningRequest method of Server (#2778)
* Enable regeneratePrivatekey for CreateSigningRequest method of Server
* only put needed info into cert, limit lifetime, use public key to get the key size
2024-10-09 06:37:25 +02:00
Martin Regen 1c6253a729 AddRejected method for ICertificateStore (#2720)
- Add a light weight AddRejected certificate store method to `ICertificateStore` to ensure rejected cert history remains small and doesn't have a lot of overhead.
- Number of history certificates is configurable using a new `MaxRejectedCertificates` entry.
- Rejected certs are only saved to directory cert store, others do ignore the attempt
- Fix the caching of `CertificateValidator` and flag some `ÒpenStore` methods deprecated which do not support the caching. Fixes across the board to support the methodology. Basically `store.Close` keeps the cache, `store.Dispose` clears the cache, so recommendation is to use `var store = certStoreIdentifier.OpenStore(); try { ... }-- finally { store.Close }`
2024-09-03 15:23:32 +02:00
romanett 84628ee3a2 Remove default rejected store creation (#2696)
Disable auto creation of Default Rejected Store
2024-08-05 07:33:23 +02:00
romanett 6ad287396e [GDS] Add Method GetCertificates to GDS for Pull Support and ServerConfiguration for Push Support / Fix CheckRevocationStatus (#2553)
* add GetCertificates Method to standard Server & GDS
* fix CheckRevocationStatus to use X509 Chain with Online Revocation Check & remove Check from GetCertificates
2024-06-05 07:40:01 +02:00
romanett 884ddf38b2 Remove unnecessary casts to RoleBasedIdentity when checking for WellKnownRoles (#2578)
* Improve casts to RoleBasedIdentity when checking for WellKnownRoles
* make IUserIdentity immutable
* add temp variable to make operation thread safe
2024-04-11 08:25:51 +02:00
mtx500 cf7f2219a1 Fixed Typos. No functional changes. (#2581)
* Fixed typos across the board. No functional changes.
2024-04-11 08:21:16 +02:00
romanett d717f67440 GDS: Add Audit Events to GDS and missing Events to ServerConfigurationNode (#2554)
* add events TrustListUpdateRequested & CertificateUpdateRequested
* add events: CertificateRequested, ApplicationRegistrationChanged, CertificateRequested
Make the GDS an Auditing Server by adding all needed Audit Events to the GDS:

ApplicationRegistrationChangedAuditEventType
https://reference.opcfoundation.org/GDS/v105/docs/6.6.12

CertificateDeliveredAuditEventType
https://reference.opcfoundation.org/GDS/v105/docs/7.9.13

CertificateRequestedAuditEventType
https://reference.opcfoundation.org/GDS/v105/docs/7.9.12

Add missing evetns to Server ConfigurationNode:

TrustListUpdateRequestedAuditEventType
https://reference.opcfoundation.org/GDS/v105/docs/7.8.2.10

CertificateUpdateRequestedAuditEventType
https://reference.opcfoundation.org/GDS/v105/docs/7.10.13
2024-03-29 10:46:18 +01:00
romanett 22096f4050 GDS: implement ApplicationSelfAdmin privilege in GlobalDiscoverySampleServer (#2338)
-Implement the support for ApplicationSelfAdmin privilege
-implement the workflow in a test to pull the trust list after sucessfully receiving a gds signed certificate. 
-this authorization is described here in the OPC Spec: https://reference.opcfoundation.org/GDS/v105/docs/7.6
2024-02-27 08:25:08 +01:00
mtx500 d95e5fae1d Typos in names of functions. Breaking change! (#2523)
* Fixed typos in names of functions, some in public API. This may be a breaking change.
2024-02-20 16:12:52 +01:00
romanett 4f43f68cd9 User Management Improvements for Standard Server (Support Well Known Roles) (#2444)
- move IUserDatabase + RoleBased Identity into standard Server
- subclass SystemConfigurationIdentity from RoleBased Identity for backward compatibility
- add OPC UA Spec Defined Roles to the RoleBasedIdentity
2024-01-16 22:24:51 +01:00
Martin Regen 0b24d62b7c Use EphemeralKeySet for certificates with private key on supporting platforms (#2421)
- In order to reduce leaking private key files on windows, `EphemeralKeySet`  is used on supporting platforms.
- Keys from the Ephemeral Keyset can not be used with `CopyWithPrivateKey`, add support to copy these keys, e.g. for GDS push support.
- MacOS throws PlatformNotSupported when ephemeral keyset is used.
- Kestrel needs a dedicated key without the ephemeral keyset flag.
- Dispose private keys where possible to reduce number of leaked files in tests.
- For bouncy castle legacy support, do not use the `PersistKey` flag by default on netstandard2.0 and net462. However keys may still leak.
2023-12-22 10:55:07 +01:00
Martin Regen f378bd483f CSR doesn't preserve ASN.1 encoding of the Subject for GDS push (#2018)
- Preserve the ASN.1 encoding of a CSR Subject in the issued certificate.
- However, a certificate issuer is allowed to change the Subject. Make the check on GDS Push only check the Subject string, to ensure the app config can still find the pushed cert after restart.
- found an issue during debugging the session disconnect may run into unnecessary exceptions as `ChannelShutdown` may be  called twice.
2022-12-12 16:32:05 +01:00
Martin Regen 0cb51ea050 GDS Server fixes for 1.05.02 and .NET 4.8 (#1973)
* Fix for ReadTrustList test failure.
* fix .NET4.8 GDS push
* include .NET 4.8 in test pipeline
* fix audit event that may throw exception when server is halted

Co-authored-by: Randy Armstrong <randy@sparhawksoftware.com>
2022-11-04 08:32:49 +01:00
Martin Regen f273634d74 Improve https transport and other bug fixes (#1908)
-Make the https callbacks fully async / code cleanup. 
-Default https client to use MaxConnectionsToServer = 64 for #1550
-Fix https missing reconnect error code
other fixes unrelated to https:
- move trust list audit event to AuditEvents.cs, fix issue that the event is not filtered since reportAuditEvent cannot be used
- fix an issue when BrowseNext for multiple continuation tokens doesn't add the results array properly
- bump up .NET Core 3.1 Nuget dependencies
- improve .NET reference client app for use with https
2022-08-20 23:44:09 +02:00
Martin Regen 0ad5c4c3a3 Refactor audit events (#1895)
- Move the auditing flag to server internal
- Hook up new configuration setting to the Auditing node
- A Security Admin can change the Audit setting.
- Refactor audit events to be extensions in one class.
- enable auditing and diagnostics by default for higher test coverage.
- refactor dependency of some events to bindings, e.g. TcpServerChannel should not be used as reportevent parameter
2022-08-12 20:04:02 +02:00
Suciu Mircea Adrian 274dfaddba Implementation of audit event triggers (#1867)
* Implementation of audit event triggers
2022-07-17 18:41:43 +03:00
Martin Regen 51549f5ed8 Strict rules to compare X500 distinguished names (#1784)
- Certificates should compare X500DistinguishedName with binary ASN.1 compare
- Other compares should follow ordinal and not resort DN entries
- Fix all related issues to pass tests, e.g. GDS certificates accepted with reversed Subject, cert validation
- Add defensive checks in cert validation 

Co-authored-by: mrsuciu <Mircea-Adrian.Suciu@softing.com>
2022-05-06 16:11:34 +02:00
Martin Regen 5cbffcfe77 Support async ICertificateStore CRL interface methods (#1666)
- integrate 'LoadPrivateKey' in the interface to allow to implement cert stores which require a passcode to load/store certificates
Change of behavior:
- Introduce a 'NoPrivateKeys' flag to reduce the risk of leaking a private key to a unsecure store.
  - CertificateStoreIdentifier opens 'NoPrivateKey' stores
  - CertificateTrustList opens 'NoPrivateKey' stores
  - CertificateIdentifier opens store with private keys for application or GDS authority certificates
- CertificateTrustList reuses a store if it is not disposed. A user can just close the store to keep the list of certificates in memory.
- DirectoryStore `Load` does not read private keys anymore, only file names for delete. Reading all private keys caused false errors, e.g. here: #1670 

Co-authored-by: mheege-abb <marcus.heege@de.abb.com>
Co-authored-by: mheege-abb <85437567+mheege-abb@users.noreply.github.com>
2022-01-25 07:16:28 +01:00
Martin Regen a147eb55c5 Tracing and Logging improvements for the UA Core and libraries (#1631)
- support for Microsoft.Extensions.Logger.ILogger in Opc.Ua.Core as the new logging interface
- backward compatible with config and TraceEvents
- new API Utils.SetLogger allows to set ILogger
- updated Console samples to demonstrate ILogger support with Serilog
- support for EventSource logging
- see Docs/Logging.md for more info
2021-12-16 00:20:08 +01:00