Commit Graph

397 Commits

Author SHA1 Message Date
Martin Regen f53f71f8a4 Complex types fixes (#978)
fix #940 and #975 
- add namespace qualifier to complex type name
- improve handling of known subtypes
- fix Pss detection on .Net 462
- stronger check of valid DataTypeDefinition for servers which expose invalid structure (nodejs)
2020-05-15 12:54:20 +02:00
Alin Moldovean ed4cc1331f Implement support for AccessRestrictions and RolePermissions attributes (#977)
* Implement Server support for AccessRestrictions and RolePermissions attributes

* Add nodes with AccessRestrictions and RolePermissions in ReferenceServer
Add example for assigning roles to users.
2020-05-14 17:20:40 +03:00
Martin Regen 4cd7100d55 Azure pipeline improvements (#965)
- stages now run parallel, cut runtime by a few minutes if we get enough hosted agents...
- supposedly fix the intermittent build errors for solutions, always restore before build or test
- simplify pipeline scripts by changing a few project names
- seperate script for code coverage
- add upload to codecov and codacy, for the latter only if the token is set
- move nohttps build to dotnet build stage
- fix a VS2019 warning in .editorconfig
- give lgtm more coverage by using sample projects

For code coverage, check:
https://codecov.io/gh/OPCFoundation/UA-.NETStandard

For lgtm results, check:
https://lgtm.com/projects/g/OPCFoundation/UA-.NETStandard/?mode=list
2020-05-05 12:06:20 +02:00
Alexander Köpke 3e61a85901 Update from .NET 4.6 to .NET 4.6.2 (#959)
Upgraded all project from .NET 4.6 to .NET 4.6.2 that also .NET framework applications can use latest version of Kestrel

* Updated Kestrel to 2.2.0 (for Opc.Ua.Core)
* Simplified csproj (removed ItemGroup Condition="'$(TargetFramework)' == 'netstandard1.3'") because currently we don't build netstandard1.x anymore
* Removed Kestrel 1.1.3 code from Stack/Opc.Ua.Core/Stack/Https/HttpsListener.cs 
* add conditions to Stack/Opc.Ua.Core/Stack/Https/HttpsTransportChannel.cs 
  * [HttpClientHandler.ServerCertificateCustomValidationCallback](https://docs.microsoft.com/en-us/dotnet/api/system.net.http.httpclienthandler.servercertificatecustomvalidationcallback?view=netcore-3.1&viewFallbackFrom=netframework-4.6.2) should not be available in .NET 4.6.X
* Updated travis.ci to use latest mono version (original version causes build errors)
* Added nuget reference .NET Standard Library to mono projects to be compatible with latest Kestrel version

Own Travis.ci and Azure Pipeline builds run sucessfully.
2020-05-01 09:57:15 +02:00
Martin Regen 20aeb22989 Fix bytestring JSON array encoding, add code coverage (#943)
- more random Variant encoding tests, incl. arrays
- fix bytestring JSON array encoding, null or empty bytestring difference is now preserved
- add solution builds to Azure pipeline build, appveyor can be retired after a brief test period
- add code coverage to linux tests, artifact is published in pipeline build results
2020-04-14 15:55:22 +02:00
Alin Moldovean 81832f71a3 Update UA-Nodesets and generated code (#925)
* Update generated code and UA-nodeset files for 1.04.5 Errata

* Update UA-Nodeset files and generated code of Sample projects with latest version of ModelCompiler
2020-03-20 14:43:25 +02:00
Martin Regen 1ff1ae7e52 IOP 2020: Workshop fixes (#916)
- fix to validate structuredefinition if servers do not fill out the DataTypeDefinition correctly
- The GDS creates the CRL cert with its own CA serial number, invalidating the CA by default on some stacks
- complex structuretype must be virtual, non reversible union encoding could not be detected 
- fix binary schema validation, allow the \" character in a qualified name
- support use of simple subtypes in a complex type. For custom and standard subtypes.
- only support structure objects with valuerank scalar or onedimension
2020-03-18 18:49:53 +01:00
Martin Regen 32e0660a7a Enable Azurepipelines build (#907)
-Starter for Azure pipelin builds, a bunch of tests in appveyor and travis can be disabled once this is working
-fix Opc.Ua.Core rootnamespace
-a few minor changes due to Ctrl-K,D refactoring, removal of dead code
2020-02-28 07:51:48 +01:00
Martin Regen c39b1e3623 Tests and fixes for encoders and decoders (#897)
- Unit test project for Core, so far only types and cert validator
- CertValidator test moved to Core.Tests
- ComplexTypes client tests for encode / decode
- bug fixes for issues found in encoders/decoders and complex types tests

** breaking change for JSON encoding of NodeId **

encoding was not according to spec. see #874.

#874, #892 fixed
2020-02-06 17:38:00 +01:00
Alin Moldovean 3e640bf702 Update UA NodeSets and generated code (#895)
* Update UA NodeSets and generated code with the latest updates for 1.04.04 Errata Release.

* Revert error in generated code.
2020-01-30 16:08:19 +02:00
Martin Regen a1faa0f7a1 Remove netstandard1.3 (#887)
* remove netstandard1.3 and unify csproj settings
* switch tests to silent mode
2020-01-23 07:22:26 +01:00
Karl Deiretsbacher dc880584de Update ClientPage.xaml.cs
Replaced the dual license with MIT to make it consistent with all other sample source files.
2020-01-22 09:53:03 +01:00
Karl Deiretsbacher 3cc8373900 Update Program.cs
Replaced the dual license with MIT to make it consistent with all other sample source files.
2020-01-22 09:51:32 +01:00
Karl Deiretsbacher d6aa3f6300 Update ServerDiagnosticsCtrl.xaml.cs
Replaced the dual license with MIT to make it consistent with all other sample source files.
2020-01-22 09:49:51 +01:00
Karl Deiretsbacher 1ccd0f2880 Update ServerPage.xaml.cs
Replaced dual license with MIT. Only stack files have dual license.
2020-01-22 09:41:25 +01:00
Karl Deiretsbacher 6a4e3a6154 Update CustomTransportChannel.cs
Replaced dual license with MIT. Only stack files have dual license.
2020-01-22 09:40:36 +01:00
Karl Deiretsbacher ddec44102e Update Program.cs
Replaced the dual license with MIT to make it consistent with all other sample source files.
2020-01-22 09:27:26 +01:00
Kurt 300d9ffd62 Minor analyzer (roslynator) fixes (#880)
* Use nameof() where applicable

Category: Maintainability
https://github.com/JosefPihrt/Roslynator/blob/master/docs/analyzers/RCS1015.md

* Rethrow original exception

Preserves original stack trace of the exception, easier to diagnose
Category: Maintainability
https://github.com/JosefPihrt/Roslynator/blob/master/docs/analyzers/RCS1044.md
https://stackoverflow.com/a/178464

Remove variable from the catch if not logged (compiler warning).

* Combine Where->FirstOrDefault, use Find if applicable

Category: Performance
https://github.com/JosefPihrt/Roslynator/blob/master/docs/analyzers/RCS1077.md

In ApplicationConfiguration:
ServerSecurityPolicyCollection inherits from List<T>, so use List.Find (better performance than FirstOrDefault)

* Use List.Count rather than LINQ Any()

Category: Performance
https://github.com/JosefPihrt/Roslynator/blob/master/docs/analyzers/RCS1080.md
refsToRemove is a List<T>, which we know the count of (no need to iterate).

* Add [Flags] Attribute for OpenFileMode

Each enum is a bitflag here
Just noticed this is in the "Generated" folder... some prior commits had touched other "Generated" files -- see nameof commit.

* Minor performance behavior

- EventArgs.Empty instead of allocating a new blank EventArgs

It only really happens on Connect/Disconnect so it's not like a single allocation really matters

- Use array[0] instead of First()
https://stackoverflow.com/a/25607951
- Use !Any() instead of Count() == 0
If a dependent field is found, it will stop evaluating the rest and Add instead of Insert. Count() == 0 required evaluation of all

- Use All() instead of FirstOrDefault(any) == null
Clearer intent (all are not matching the group BrowseName => clear default)
Slightly faster as the first match found doesn't have to be compared against null

* Revert changes to generated files

* Fix mistake

fixes compile error
2020-01-09 09:28:37 +02:00
Martin Regen 368049d188 Improvements to complex types client (#879)
- allow for loading of single types with dependencies from DataTypeDefinitions only
- introduce a type dictionary to match xml qualified names with type ids.
breaking change (internally):
- simplify JSON encoding by providing a UseReversibleEncoding flag 
- add also JSON and XML encoding ids to type factory if supported
- follow coding conventions for test sample, add single type loading use case (before/after)
- fix a bug when a JSON extension object cannot be decoded when the namespace uri is encoded
2020-01-08 16:29:22 +01:00
Martin Regen 73d91d6e97 Bump up dependencies of UWP apps to use netstandard2.0 (#873)
- this is part of an effort to deprecate netstandard1.3 support (#761)
- as a result Windows 10 minimal version is now >= 16299 (Fall Creators Update 2017)
2020-01-07 17:34:38 +01:00
Alin Moldovean ea1d78a515 Merge pull request #854 from AlinMoldovean/master
ComplexTypes fix for using shared EncodableFactory in UA Sample Client
2019-11-21 14:49:42 +02:00
dependabot[bot] 1b11fb68b0 Bump Microsoft.NETCore.UniversalWindowsPlatform (#853)
Bumps [Microsoft.NETCore.UniversalWindowsPlatform](https://github.com/Microsoft/dotnet) from 5.4.0 to 5.4.2.
- [Release notes](https://github.com/Microsoft/dotnet/releases)
- [Commits](https://github.com/Microsoft/dotnet/commits)

Signed-off-by: dependabot[bot] <support@github.com>
2019-11-21 13:18:39 +01:00
AlinMoldovean 095dc40680 ComplexTypes fix for using shared EncodableFactory in UA Sample Client 2019-11-21 13:54:43 +02:00
Martin Regen 39dca2c103 Complex Types client library (#849)
Adds a complex type system client library extension for custom enumerations and structure types based on a server dictionary or DataTypeDefinition using emitted classes at runtime. 

- Custom types are added to the session factory, not to the global factory. Types are loaded when the session connects by adding 
`                var complexTypeSystem = new ComplexTypeSystem(session);
                await complexTypeSystem.Load();
`
- Custom type properties can be accessed with an accessor [propertyname] or [index]. Direct access through the properties is possible, but some cases do not update the optional or union flags correctly.
- Support includes V1.03 dictionaries and V1.04 DataTypeDefinitions (--> known issues).
- NetCoreComplexClient can be used for quick testing servers. It prints out all custom types with content and subscribes to all. Also includes sample how to write back complex type variables and how to output JSON.
- The UA Sample Client and the Quickstart Data Type client can be used for testing with UI. Many issues were adressed to be able to read and write complex types, however some support is limited, e.g. only editing simple fields is currently working (help wanted).
- Caveat: The complex type libaries for .Net Core must be built for .netcoreapp, so it needs a seperate nuget package for the complex type client extension.
- Support for a factory type builder class to allow to plugin other type builder methods (e.g. Codedom etc...)
- Added JSON test case and include the complex types client in the testing shell script, so the complex types lib is tested on mac/linux too.
- Few fixes in the JSON encoder.

Finding enough servers with custom types is an issue, so if you find servers with unsupported custom types please provide feedback.

Known limitations:
- Only V1.03 OPC binary dictionaries are supported (no XML Schema dictionaries).
- V1.03 dictionary structure definitions are only supported if they can be mapped to a V1.04 DataTypeDefinition. Nested types and cross dictionary refs should work.
- OptionSet is only partially implemented. Only shows the byte arrays, not the flags.
- Opaque Types in dictionaries are ignored.
2019-11-20 16:05:24 +01:00
Alin Moldovean dc9fa85a38 Fixes #822 - Certificate Validation fix. (#843)
* Remove BadCertificateUriInvalid from list of certificate validation errors that may be suppressed.
2019-11-06 09:49:08 +02:00
Andrew Field d7130a97d4 Spelling (#840) 2019-11-05 10:07:52 +02:00
Martin Regen 6971c76d88 Improve Data Type Quickstart Server (#831)
- add a few more dependent complex types for testing
- fix UI issue which prevents dialogs from showing data
* workaround for dialogs with imagestream, always throwing exceptions
* rebuild with v1.04 modelcompiler
2019-10-25 15:57:34 +02:00
AlinMoldovean df0cc4287d #791 - Update UA NodeSets and generated code with the latest updates for V1.04.3 Errata. 2019-10-02 17:44:53 +03:00
Alin Moldovean a1e26bf849 Interoperability fixes for HTTPS (#814)
* Fixes #709 - Allow HTTPS clients to send the certificate for servers that require TLS client authentication

* Fixes #692 - HTTPS Server listener - Use the first configured policy for HTTPS
2019-10-02 15:38:59 +03:00
Martin Regen 23b9c37b48 Make the SQL Db ApplicationNames locale nullable (#812)
App registration for push servers from GDS client stopped working, maybe due to new db version in VS. But nulling the locale fixes the issue.
Note: DB should be recreated or the locale column must be manually set to nullable in the SQL Db.
#811 fixed
2019-10-01 08:27:53 +02:00
Martin Regen 550ed0a45f renew Universal Windows package certs (#810)
* renew certs
* update csproj with new hash
2019-09-30 08:35:34 +02:00
Martin Regen 93146020a4 Certificate Validator tests and Pem writer fix (#701)
- add more tests verify how longer cert chains are built and verified with the cert validator
- some tweaks to cert factory to allow for building Sub CA certs
- allow to set the Basic Constraint  / Path Length for CA certs
- fix #695 PKCS#8 format is now used
- add additional check to verify incomplete chain signatures
2019-04-12 16:47:34 +02:00
Martin Regen 64db8c73a9 IOP GDS cert related fixes (#674)
* do not require server capabilities
* fixes for cert creation key usage flags
2019-03-18 12:37:04 +01:00
AlinMoldovean 8b374a7448 Copyright year set to 2019 in license notices. 2019-02-14 12:34:33 +02:00
Alin Moldovean ea1911c4a1 Update UA NodeSets and generated code with the latest fixes for V1.04 (#637) 2019-02-05 16:00:12 +02:00
Martin Regen ce4921988e Refactor gds internal interface to use cert group and type strings (#578)
…instead of node id

It simplifies storage of cert group and type in attached db as string.
All GDS unit tests pass.
Breaking change (for GDS) due to interface change.
2018-10-29 14:54:32 +01:00
Martin Regen d007a41d15 Add Aes profile support (#574)
* add the Aes128 and Aes256 profiles
* Aes profies were tested on IoP workshop against Ascolab, Softing, Matrikon, Milo, ProSys and others
* Pss padding is not supported on all platforms, so autodetect if it is supported and filter out Aes256 if not
* not a breaking change: not specifying the SecurityProfileUri in the config xml will automatically add all supported profiles but not deprecated profiles (e.g. Basic256Sha256, Aes128, Aes256). Aes256 is only added if the platform supports Pss padding. This will simplify the maintenance of config xml, since automatically all supported and secure profiles are exposed.
2018-10-29 09:58:45 +01:00
Martin Regen 493009dd53 Prototyping gds (#46)
* allow GDS configuration which doesn't auto approve
2018-09-25 12:20:50 +02:00
AlinMoldovean 2fc2d97975 Update logic for user certificate validation to allow self signed certificates. 2018-09-13 17:52:10 +03:00
AlinMoldovean 4ed82868da Update GDS certificate stores after code review. 2018-09-13 15:30:14 +03:00
AlinMoldovean ed40dea643 Update GDS certificate stores after code review. 2018-09-13 15:26:18 +03:00
AlinMoldovean 9ff7f61fa1 Certificate stores renamed according to Part 12 specification recommendation. #383 2018-08-07 17:54:14 +03:00
AlinMoldovean fd6d13a995 Create custom configuration settings for user certificates in ReferenceServer. #383 2018-08-06 17:22:23 +03:00
AlinMoldovean 036320221b Create custom configuration settings and validators for user certificates. #383 2018-08-06 17:13:49 +03:00
Martin Regen ced33e1957 Improvements for cloud based Gds and V1.04 nodes (#508)
- all changes for cloud based GDS
 - build version of .net standard libs is now set in version.props, it may require updates for the official builds.
  - add new stuff for v1.04 nodeset, e.g. QueryApplications Api
  - gds.client/gds.server common dll changes to support a cloud based GDS.
2018-07-31 13:32:21 +02:00
Martin Regen ebe2330c8f Appveyor build fix (#507)
* replace outdated certs
* fix universal windows test build until 7/31/19
2018-07-31 09:58:53 +02:00
Alin Moldovean 92bef97e51 Fix for Mantix #4321 + deprecated security polices removed from config.xml files (#505)
* Fix for Mantis #4231. Refuse to use untrusted certificates to encrypt user identity tokens sent to servers.

* Deprecated security policies removed from default server config.xml files.
2018-07-18 08:28:07 +03:00
Martin Regen e6916f31be License info in V1.04 is not quite right (#503)
* Use OPC REDISTRIBUTABLES Agreement of Use in nuget packages (#424)

* Security policy Basic128Rsa15 removed from default server configurations.
2018-07-17 17:31:59 +03:00
Alin Moldovean 0d08d40180 Update NodeSets and generated code with latest fixes for V1.04 (#487)
Update NodeSets and generated code with latest fixes for V1.04 Errata
2018-06-26 09:29:36 +03:00
Alin Moldovean 1c7a208dc0 Fixes #436. Update method call validation in SampleNodeManager. (#477) 2018-06-19 09:00:11 +03:00