Fix cases where a cancellable WaitAsync(ct) on a SemaphoreSlim within a try/finally could end up in a deadlock.
Fix: The WaitAsync must be outside the try/finally block. if the WaitAsync is cancelled, it should not release the semaphore
Manage the GDS Server Users in a Database. The implementation is based on the IUsersDatabase Interface which allows the User of the library to provide its own implementaion.
For testing a Json/Linq Users Database implementation is provided.
Passwords are hashed with the PBKDF2 with 10k iterations.
In the default config the standard users with the demo passwords are created, so the behaviour for existing applications is not changed.
With this Pull Request i improve the reusability of the Code by changing reverences to CertificateGroup to the Interface ICertificateGroup, through this change users can extend the functionality of CertificateGroup by providing an own implementation.
Furthermore I fix two issues of the GDS:
- The GDS does not trust its own CA Certificate, therefore it rejects connection attempts from clients with a CA signed certificate (e.g. after a sucessful registration & a new CA signed Application certificate received -> Client tries to connect with the new certificate to get the TrustList -> gets rejected)
-> new Method AddOwnCertificateToTrustedStoreAsync added to Class ApplicationInstance
-> you can call this after starting the GDS Server with CA-Certificate of the GDS as parameter
- The GDS does not revoke Certificate in the TrustedList Store CRL, so OPC UA Applications can´t get revoked certs
-> this is fixed by adding a call to UpdateAuthorityCertInTrustedList to the method RevokeCertificateAsync
The goal is to reduce the overall number of builds, stop using end of life platforms in the build pipeline and to support
build of future/deprecated build targets in a custom build step, which is also triggered weekly in the ci builds.
In addition:
- added a doc which describes the release and versioning strategy of this project
- produce the Nuget packges with .NET 8 assemblies.
- produce a Docker build based on a .NET 8 based container.
- add custom test targets to test outdated platforms. Need a manual step to enable for VS or command line.
- bug fixes: the latest move to an alternate crypto library for Bouncy Castle, which is only used for the GDS support and .NET Framework 4.6.2./netstandard2.0, revealed already a few issues which were previously not found.
- only .NET8/.NET6/.NET Framework 4.8 are tested in Pull requests. Remaining builds in weekly scheduled builds.
Since some distributions stop to trust SHA1 signatures by default, replace some internal algorithm checks with SHA256 versions.
The test case to force signature check also reenables ECC tests for .NET 4.8 which had been previously disabled.
- Implement the reconnect and republish with async service calls.
bug fixes:
- subscription Ids should start from a random number
- the keep alive interval calculation is too short, adding +1 for the timeout
- on BadSessionIdInvalid recreate session immediately
- on a restarted server with new certificate, also reload endpoints when BadCertificateInvalid is returned
Currently, due to some internal cloning of sessions, subscriptions and monitored items it is not possible to use subclassed variants which are properly recreated after a session reconnect.
- Add a `ISessionInstantiator` interface to allow to subclass a `Session` and override virtual function.
- Add a `Subscription.CloneSubscription` and `MonitoredItem.CloneMonitoredItem` virtual method to recreate those with event handlers and client handles.
- A sample implementation with `TestableXXX` classes is provided to test the BadInvalidTimestamp fix by injecting modified timestamps in the session class.
- Remove duplicate `IDisposable` with `Session`. `IClientBase` is disposable already.
- adds `knownTypes` parameter to `Session.Load` and `Session.Save` to support save and restore of custom Subscriptions and Monitored items.
bug fixes:
- IOP: an empty DataTypeDictionary throws an exception when loaded by the complex type system, server are allowed to leave it empty to save memory.
- BadInvalidTimestamp should not be returned when the timestamp in the requestheader is out of sync. #2364
Root cause: Target's IsInverse flag which has incorrect value is used during the removal of source's reference
Fix: Retrieve the source's reference by the targetId first and remove it.
Introduces an exception, to notify the user when supplying an invalid argument to the method CreateCACertificateAsync
This exception was introduced, as in the current implementation the same subject name has to be used as in the configuration or else the certificate is not copied to the trusted store.
XmlEncoder.WriteArray and XmlDecoder.ReadArray always use the OPC UA XML namespace (http://opcfoundation.org/UA/2008/02/Types.xsd) for the field element that contains the array, regardless of the namespace that the caller may have pushed.
- CloseAsync still used the 'Close' synchronous function
- remove a duplicate definition of IDisposable on ISession
- reduce the log output when the server publish time is out of sync
- bug: if the nested complex type is derived from an abstract type like a Union, the decoder uses the abstract type instead of the actual type to decode
- fix: the loop to determine the supertype of the type to be decoded stops too early and returns an invalid type reference, e.g. for Unions. Instead the loop will now continue until a valid BuiltInType or a Structure or Enumeration type is found.
- improve various log messages, comments etc.
- multiple internal improvements in naming convention handling of async functions
- add FetchSuperTypesAsync
- replace new UTFEncoding() with Encoding.UTF8 singleton
- Add a property to `ApplicationInstance` to `DisableCertificateAutoCreation`
- Add the test case to validate property function
- Refactor some private API to follow coding style with `Async`suffix
- By default behavior is unchanged
Three new DataTypes plus Variables containing them were added to the Reference Server:
- VectorUnion (as Scalar and Array): The VectorUnion contains three fields (X, Y, Z) and a SwitchField. When it is used as value, it is generated randomly (SwitchField set to None or one of the Fields)
- VectorWithOptionalFields (as Scalar and Array): The VectorWithOptionalFields contains again three fields (X, Y, Z), but they are all optional. When it is used as a value, it is generated with 0 to all fields activated.
- MultipleVectors (as Scalar and Array): The MultipleVectors type contains 6 Components. A regular Vector, a VectorUnion (from before), a VectorWithOptionalFields (also from before) and the same as Arrays.
Referencing package OPCFoundation.NetStandard.Opc.Ua.Core from a .NET6 targeted project that in it self are using Microsoft.Extensions.Logging.Abstractions 6.0.4 will cause downgrade problems.
Instead for .NET6 targeted applications reference 6.0.x versions of Microsoft.Extensions.Logging.Abstractions.
- Improvements when many sessions need to be opened
- Introduce a OpenAsync version which usesmore async calls for session creation
- add async interfaces to cert validator
- refactor lock of encodeable factory
- add a `EndAsync` property to WriteRequest to allow to await a service call
- add a `EndSendRequestAsync` method to allow implementation of awaitable service calls