1029 Commits

Author SHA1 Message Date
romanett c32c55446d Remove net6 / Label Pubsub Package as Release / Update Nuget Packages (#3121)
* remove .net 6 target
remove conditional packages
remove debug flag from pubsub

* Remove net 6 from azp

* Update Nuget Packages

* Update missed pipeline

* Add net 8 App Target framework

* fix asn1 package reference

* remove more net 6 references from AZP

* move main pipeline to net 8

* install net 8 in runners

* install net 8 in CC yml pipeline
2025-07-17 07:20:20 +03:00
Suciu Mircea Adrian ac05ef679d Update to latest dependencies. (#3095)
* Update to latest dependencies.

* Revert AppTargetFrameworks to net6.0
2025-06-24 17:31:18 +03:00
opcfoundation-org dcc02f179d Update to 1.05.04 nodeset (#3091)
* Update version.json (#3050)

* Fix XML Encoding and decoding of Matrix Element in Variant to conform to spec (#3053) (#3054)

* Fix XML Encoding and decoding to conform to spec

* fix test on linux

* fix typo

* Add missing DataValue & DiagnosticInfo Array Types

Co-authored-by: romanett <romanett98@gmail.com>

* Return NodeSet to 1.05.04.

* Remove OptionalPlaceholders on instances.

* Fix duplicate pragas.

* Fix glitches in generated files.

---------

Co-authored-by: Suciu Mircea Adrian <Mircea-Adrian.Suciu@softing.com>
Co-authored-by: romanett <romanett98@gmail.com>
Co-authored-by: Randy Armstrong <randy@sparhawksoftware.com>
2025-06-23 13:44:42 +03:00
romanett 23a02fc1fe Implement support for "mul" locale in LocalizedText Class & ResourceManager (#3076)
* Implement support for "mul" locale in LocalizedText Class

* Use ReadOnly Dictionary to ensure correct texts are generated

* Implement Support for client requested Mul locale and handle mul locales provieded to Resource Manager (return only requested locales)

* fix bug

* Add Tests for ResouceManager

* Add more Tests & additional constructor to LocalizedText

* return null if mul locale parsing fails instead of partial dictionary

* avoid unecessary cast

* revert to working version

* Implement perf fix for new SDKS
2025-06-05 10:24:32 +03:00
romanett a6efccb21f Allow to define a custom StringComparsion for Equals Operator (#3048)
* Add string comparison enhancements to ContentFilter.

- Introduce static `EqualsOperatorDefaultStringComparison` Property in the `ContentFilter` class for customizable string comparison.
- Update `IsEqual` method in the `Utils` class to accept an optional `StringComparison` parameter.

* Add Test

* fix default stringComparsion Operator to be Ordinal

* Remove obsolete DBNull check

* Add Comment
2025-05-27 12:14:14 +03:00
romanett 2a7de7d1d1 Make RelativePath.Parse throw SRE if NamespaceIndexes cannot be found. (#3071)
* Make RelativePath.Parse throw SRE if NamespaceIndexes cannot be found.
Add Tests to verify functionality

* Extend test coverage

* Add Test Case
2025-05-23 16:38:22 +03:00
romanett 2446ce8987 Fix XML Encoding of Null Variant to conform to spec (#3062)
* fix XML Encoding of Null Variant to conform to spec

* fix XmlEncodedValue for null variants values to be the null (same behaviour as ExtensionObject)

* Update Encoder to Produce <uax:Value xsi:nil=\"true\" /> output
2025-05-23 16:34:13 +03:00
Suciu Mircea Adrian e4c6c3b735 Update to latest nuget packages (#3069)
* Update to latest nuget packages

* Include System.Net.NetworkInformation once
2025-05-06 12:47:24 +03:00
Suciu Mircea Adrian d5fd96b7c1 Add version System.Diagnostics.DiagnosticSource to match Microsoft.Extensions.Logging.Abstractions version (#3061) 2025-04-20 14:33:59 +03:00
romanett 6a1b269887 Fix XML Encoding and decoding of Matrix Element in Variant to conform to spec (#3053)
* Fix XML Encoding and decoding to conform to spec

* fix test on linux

* fix typo

* Add missing DataValue & DiagnosticInfo Array Types
2025-04-15 16:31:28 +03:00
Suciu Mircea Adrian dbb9acba6c Allow setting the context in a temporary using scope for IEncoder instances (#3044)
* Allow setting the context in a temporary using scope for IEncoder instances

* make the setter of Current property private
2025-04-11 13:26:18 +03:00
Suciu Mircea Adrian 95d162ea76 Set default value for the ValueRank attribute of BaseVariableState and BaseVariableTypeState to ValueRanks.Any as in the specification (#3049)
* Set default value for the ValueRank attribute of BaseVariableState and BaseVariableTypeState to ValueRanks.Any as in the spec

* Removed unnecessary project reference
2025-04-10 16:59:40 +03:00
romanett 66ba504751 Make UserIdentityToken internally use byte Array instead of string for storing unencrypted password. (#3035)
* Make UserIdentity Token internally use byte Array instead of password.

* Add missing null check

* fix uninitialized array

* use Encoding.UTF8 instead of new Utf8Encoding()

* zero out array before setting the password
2025-04-03 16:20:31 +03: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 2f0770c569 [Server] Restore durable subscriptions on Server Restart (#3025)
* Enable Durable Subscriptions (#9)

* [Server] Durable Subscriptions (#2683)

* Implement a system test for DurableSubscriptions (#2839)
* Client Side
Co-authored-by: ALTERNATE-DEV\Archie <archie@dreamsandadventures.ca>

* make a static Method CalculateRevisedQueueSize

* Adress review feedback

* fix FilterRetainTests

* Add MonitoredItem Id to Queues
Use NodeIdDictionary where possible

* first proto

* fix reference server

* implement store

* initialize early

* fix issues

* Move to Reference Server & start implementing queue restore

* Persist queues

* Register queues in factory after restore

* Add Docs

* minor fixes

* Test Subscription Restore & Transfer

* fix Durable Subscription Test Browse

* Fix conversion of extension objects

* use CustomConverter for NumericRange

* Adress review Feedback

* Documentation improvements

* Update Readme

* update sampling group manager to work without session

* remove launch settings
2025-03-24 11:45:09 +02:00
opcfoundation-org fe0aec4969 1.05.04 final release fixes (#2893)
* Add missing constants for JSON encoding.

* Update generated files to 1.05.04.

* Update NuGets

* Fix compile errors due to abstract types.

* Update nodesets.

* Update JSON Encoder/Decoder.

* Update with JSON encoder.

* Change prefix char.

* Change prefix to uppercase.

* Fix JsonEncoder

* Fix null pointer.

* Update encoders to suppress artifacts.

* JSON encoding fixes.

* Fix JSON RawEncoding

* Update JSON encoders.

* Revert changes for Matrix in Variant.

* Update NodeSet.

* Resolve name conflict with new Opc.Ua types.

* Fix failing Tests

* Fix unit tests after change to Verbose/Compact encoding.

* Add final 1.05.04 generated classes and unit test fixes.

* Fix more unit tests.

* Update NodeSet to released version.

* Remove unintended changes to UANodeSet.xsd

* Update Schema/UANodeSet.xsd

* Merge breaking changes to JsonEncoder.cs from develop/main374

* Allow JObject in ExtensionObjects.

* fix version json

* Update generated files to UA-1.05.04-2025-01-08

* Some cleanup of the new APIs and Union implementation. (#2927)

* Some cleanup of the new APIs and Union implementation.

* fix build

* Handle status code Uncertain according to the specification (#2898)

* #2896: Write output arguments for good and uncertain status code

When a method state's call method is invoked the output arguments should be written in case the status code is good or uncertain. This behavior would be conform with the current specification.

* #2896: The service result corresponds the method call result

The result of the Call method in the CustomNodeManager2 class represents the status of the CallMethodResult. It does not correspond to the ServiceResult of the CallResponse, thus returning Good as a general response is incorrect behavior.

* Add SetHiResClockDisabled  & fix Rejected Store Creation in ApplicationConfigurationBuilder (#2909)

Add the method SetHiResClockDisabled to IApplicationConfigurationBuilder
Fix the type of RejectedStore Created by the Builder to: CertificateStoreIdentifier

* revert based on feedback

* move some logic from class code to encoder/decoder

* Fix race condition on Nuget build (#2930)

- nodeset xmlzip is created in obj folders if multiple targets are built in parallel

* update common comments

* Update NodeSet files.

* Fix ReadSwitchField Implementation.

* Make UserIdentity.DisplayName writeable.

* Fix merge failures.

* Fix XmlElement encoding and bad NamespaceIndex fallback logic.

* Fix 2D array raw encoding.

* Add support for DesignToolOnly.

---------

Co-authored-by: Randy Armstrong <randy@sparhawksoftware.com>
Co-authored-by: Martin Regen <mregen@microsoft.com>
Co-authored-by: Martin Regen <7962757+mregen@users.noreply.github.com>
2025-03-07 15:25:33 +02:00
romanett ef9387b525 Enable Durable Subscriptions (#2978)
* Enable Durable Subscriptions (#9)

* [Server] Durable Subscriptions (#2683)

* Implement a system test for DurableSubscriptions (#2839)
* Client Side
Co-authored-by: ALTERNATE-DEV\Archie <archie@dreamsandadventures.ca>

* make a static Method CalculateRevisedQueueSize

* Adress review feedback

* fix FilterRetainTests

* Add MonitoredItem Id to Queues
Use NodeIdDictionary where possible
2025-02-28 13:46:49 +02:00
Suciu Mircea Adrian 28d2227fc4 Revert "Enable Nullability for important Certificate Handling classes (#2989)" (#3007)
This reverts commit 23d167abb7.
2025-02-20 10:24:51 +02:00
Martin Regen c75c8a0153 By default set NoDelay and Lingerstate to 5 sec (#3000)
Set NoDelay=true to disable the Nagle algorithm and set Lingerstate to 5 seconds by default.

After careful evaluation of the PR provided by @sxleixer in #2882 we found that the default setting of the socket with NoDelay=false can not only cause issues on the client side, but also on the server side.

Due to the nature of Nagle's implementation the issue only occurs when many small service requests or responses are sent over the network. In that case, when packets are still in flight, the secondary small packets are delayed and combined until the MTU is exceeded or the previous packages are acknoledged.

The expectation in the UA protocol is to not add additional latency in the client-server communication.

As a conclusion defaulting to NoDelay=true appears to be the better default option which works for all use cases.
If there are new bandwidth issues related to more and larger packets imposed by this change, they should be solved at the UA application level by combining service requests of the same type.

Setting Lingerstate to 5 seconds should help to finish communications when sockets are closed.

Co-authored-by: @sxleixer <mail@ralfschleicher.de>
2025-02-18 05:20:57 +01:00
Archie Miller 37cebe33be [Server] Add support for SupportsFilteredRetain (#2913)
* Work In Progress

* Working Implementation of SupportsFilteredRetain

* Potential solution

Contains test debug messages that should be cleaned up

* Update comments showing discussion required

* Address Comments

* Use the NodeId from the ConditionState for the ConditionId.

Existing case was not guaranteed to be correct.
2025-02-17 13:42:24 +02:00
romanett 23d167abb7 Enable Nullability for important Certificate Handling classes (#2989)
* enable nrts for CertificatIdentifier&CertificateStoreIdentifier&CertificateTrustList

* make RSA Utils and  Certificate Stores nullable

* Make Certificate validator nullable

* fix nullability of CertificateTypeParameter
2025-02-13 16:53:06 +02:00
Martin Regen cbf789d41e Fix a case where NodeId.Null is modified (#2995)
* Add tests to catch if NodeId.Null is modified in DEBUG, fix an issue where NodeId.Null was overwritten

* add (C)

* only enable immutable NodeId to catch issues

* typos and comments
2025-02-13 10:54:41 +02:00
romanett 703b52da13 Make FiniteStateMachine DoTransition virtual (#2988)
* Add Lock to finiteStateMachineDoTransition

* assign lock

* Revert "assign lock"

This reverts commit f8d2b9392c.

* Revert "Add Lock to finiteStateMachineDoTransition"

This reverts commit 2449006ac1.

* make DoTransitionVirtual

* make CauseProcessingCompleted virtual
2025-02-12 10:44:54 +02:00
Suciu Mircea Adrian d540baf10f Remove oldest channel if not used by session, when number of channels reaches MaxChannelCount - 1 (#2986)
* Remove older channel if not used by session, when number of channels reaches MaxChannelCount - 1

* Corrected channelCount and renamings

* Operate on snapshot

* Snapshot the entire concurentdictionary
2025-02-11 17:13:26 +02:00
romanett 8e408dba3e fix Token renewal (#2990) 2025-02-11 17:05:08 +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
Suciu Mircea Adrian 14d78caf21 Set default value for NonceLength to 32 (#2970) 2025-01-28 16:41:08 +02:00
Suciu Mircea Adrian 7c0e806736 Set initial value of LastActiveTickCount (#2953) 2025-01-23 15:25:17 +02:00
mrsuciu f4c852a61d Merged develop/main374 into master 2025-01-22 15:31:50 +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
Suciu Mircea Adrian 8733a33594 Fix net462 build (#2949) 2025-01-20 17:00:26 +01:00
Martin Regen 61056d0d30 Some .NET 9 maintenance and JSON encoder improvements (#2922)
- Reduce memory allocations in JSON encoder by using stackalloc/ArrayPool
- Fix some new warnings in .NET9 code analyzers
- Fix fuzzing error in JsonDecoder
- do not use .NET9 libraries with .NET8 LTS builds #2931, #2940
- Bump langversion to 9 (max VS2019)
- Use official ASP.Net 2.3. libraries for .NET Framework (rel. Jan 15th)
2025-01-20 08:45:12 +01:00
Suciu Mircea Adrian 62b4f050bc Add ECDSA support for importing private key from PEM (#2941)
* Add ECDSA support for reading private key from PEM

* Padded x, y EC point coordinates and the d private key with leading zeros to match keySize

* CreateCertificateWithPEMPrivateKey creates either ECDSA or RSA certificate depending on certificate type
2025-01-17 17:51:21 +02:00
Martin Regen a0b12d7116 Fix race condition on Nuget build (#2930)
- nodeset xmlzip is created in obj folders if multiple targets are built in parallel
2025-01-16 21:33:41 +01: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
romanett 6038a69656 [ECC] Implicitly set CertificateType of Certificate Identifier & allow Revocation with ECC Issuer Certificate & fix VerifyECDsaKeyPair (#2924)
* implicitly set certificate type of certificate identifier
extend CertificateFactory to allow Revocation with ECC Issuer Certificate

* Add Crl tests for ECC

* fix X509 PFXUtils VerifyECDsaKeyPair
2025-01-13 17:08:37 +02:00
Stephan Larws df881be3ac Handle status code Uncertain according to the specification (#2898)
* #2896: Write output arguments for good and uncertain status code

When a method state's call method is invoked the output arguments should be written in case the status code is good or uncertain. This behavior would be conform with the current specification.

* #2896: The service result corresponds the method call result

The result of the Call method in the CustomNodeManager2 class represents the status of the CallMethodResult. It does not correspond to the ServiceResult of the CallResponse, thus returning Good as a general response is incorrect behavior.
2025-01-08 13:36:41 +01:00
romanett 444b2c8e51 Add port number check in the MatchEndpoints method to ensure the correct endpoint is returned (#2925) 2025-01-07 17:08:23 +01:00
mtx500 57d638ea90 Typos again (#2906)
* Fixed a lot of typos in comments, strings and local variable names. No changes to misspelled function names/parameters.

* Fixed some more typos
2024-12-20 09:33:13 +02:00
romanett de688aca18 [Server] Improve GetManagerHandle & introduce a threadSafe NodeIdDictionary (#2915)
* Make NodeIdDictionary threadsafe by changing the underlying dict from `Dictionary` to `ConcurrentDictionary`
* reduce blocking in CustomNodeManager2 for GetManagerHandle & other uncritical supporting functions
2024-12-19 17:17:25 +01:00
Suciu Mircea Adrian 6489c1283f Removed unreachable code (#2916) 2024-12-19 09:04:20 +02:00
Suciu Mircea Adrian 5e11541b81 Set corresponding security signature hash and validate ECDSA security signature hash algorithm length for ECC certificates (#2912)
* Use correctly and validate certificate ECDSA signature hash algorithm

* Added tests for validating length of EC certificate signature

* Improved invalidation condition of SignatureAlgorithm

* Changed result text

* Test fix

* Added helper method to set hash algorithm depending on key size;
Reverted ApplicationInstance code

* Fix test CreateSelfSignedForECDsaDefaultTest
2024-12-19 08:50:09 +02:00
Stephan Larws 5b3f91d9dd Handle status code Uncertain according to the specification (#2898)
* #2896: Write output arguments for good and uncertain status code

When a method state's call method is invoked the output arguments should be written in case the status code is good or uncertain. This behavior would be conform with the current specification.

* #2896: The service result corresponds the method call result

The result of the Call method in the CustomNodeManager2 class represents the status of the CallMethodResult. It does not correspond to the ServiceResult of the CallResponse, thus returning Good as a general response is incorrect behavior.
2024-12-17 13:38:51 +02:00
Martin Regen 9a434b860c Fix misc. build issues and warnings (#2908)
- Fix errors and warnings on stricter build systems.
- Some Linux distri do not support brainpool, detect if tests can be run.
2024-12-13 17:41:14 +01:00
Martin Regen dc661bac46 Fix server CurrentTime source timestamp and improve readerwriter locks (#2903)
Fix server time source timestamp is not updated.
There are duplicate objects in generated code, on of which which holds the last timestamp was not updated.

Move all readerwriter locks outside of try/finally to avoid a SynchronizationLockException when a reader writer lock is disposed or is cancelled.

Currently there is no obvious fundamental bug in how the readerwriter locks are used, but outside the try/finally clause e.g. a disposed lock may not trigger a false exception.
2024-12-13 08:59:28 +01:00
romanett f431d53c89 Fix Null reference Exception in NodeState for AccessRestrictions (#2894)
* fix cast that throws when Enum is null
2024-12-11 08:48:09 +01:00
Martin Regen 5ed73fcd95 merge latest release 2024-12-07 17:30:58 +01:00
romanett 67a0df1960 Fix read of NodeId attribute AccessRestrictions by casting return type from Enum to ushort (#2883)
In the read NodeId servcie call an enum is by default cast to Int32, so the cast to ushort is needed here to return the expected type for the AccessRestrictions.
2024-12-05 08:39:09 +01:00
romanett 6c62eb26fd Fix serialization of CertificateTrustList (#2879) 2024-12-04 09:42:19 +01:00