1029 Commits

Author SHA1 Message Date
Martin Regen e606f3aa8c Stabilize TCP receive (#904)
- Various issues found during server testing with ref server
- Take a different approach on the nesting issue
- Fix a duplicate buffer free issue 
- stabilize binary decoder
2020-02-19 13:34:55 +01:00
Martin Regen 9f015128f0 Fix for non reversible encoding of Unions/Structures (#905)
* fix for non reversible encoding of Unions and structures
* handle exception when server returns null terminated dictionary bytestring
2020-02-18 17:11:11 +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
Alin Moldovean 636f5c03f9 Implement validation for duplicate nonces (#893)
* - Add Server nonce validation for duplicate nonces.
- Add configuration flag to bypass validation exceptions

* Add ITransportChannel.CurrentToken interface for nonce validation.
2020-01-30 15:06:13 +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
AlinMoldovean bcccd718a4 Fix for handling of AccessLevel and AccessLevelEx attributes. 2020-01-14 18:00:23 +02:00
Wadjet-Informatics e9ebd49350 Prevent deep recursion and excessive thread creation in TcpMessageSocket (#845)
- instead of creating task or nested calls to get message packets uses a loop which is more efficent and stack safe.
2020-01-13 13:27:54 +01:00
Martin Regen f7ab80d304 Update kestrel nuget version (#882)
* update kestrel nuget version
* update nuspec
2020-01-10 12:28:23 +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
AlinMoldovean ba620f2a08 Implement import of DataTypeDefinition attribute from NodeSet files. 2019-12-06 10:24:32 +02:00
AlinMoldovean 77a183ec6b Nonce validation fix in Client Session. The minimum nonce length should be 32 in CreateSession and ActivateSession responses. 2019-11-28 19:10:07 +02:00
AlinMoldovean 2d2c108a68 Fixes #847 - Fix in DiscoveryClient.Create() 2019-11-21 15:35:51 +02:00
Alin Moldovean 131f53811f Merge pull request #851 from MilosKonecny/master
Stability in BinaryDecoder improved.
2019-11-21 13:40:42 +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
AlinMoldovean 13cba2baf7 Length validation in user token decryption. 2019-11-19 16:01:28 +02:00
Miloš Konečný 110ab6b5c0 BinaryDecoder: Stability improved, exception ArgumentOutOfRangeException is avoided. 2019-11-18 21:22:09 +01:00
AlinMoldovean 8504055a83 Add server nonce validation in Client session. 2019-11-12 17:00:07 +02:00
Sebastian Bäumler c9a20988e5 Removed duplicated code. (#844)
Same Code will be called by static function "RequireEncryption()"
2019-11-11 16:44:23 +02: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
Alin Moldovean f015ece891 Fixes #832 - Avoid deep recursion in TcpMessageSocket.ReadNextBlock() (#836)
* Fixes #832 - Avoid deep recursion in TcpMessageSocket.ReadNextBlock()
2019-10-30 09:52:46 +02:00
Martin Regen ef06464776 fix schema validator and dictionary loader (only binary) (#833)
* fix schema validator and dictionary loader (only binary scheme)
# include some .bsd files for validation
* add check for some configuration fields, to return a meaningful error.
2019-10-29 18:16:37 +01:00
AlinMoldovean 089bcd0e6f Fixes #780. ExpandedNodeId.CompareTo() fix. 2019-10-29 10:11:44 +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
Sebastian Bäumler f6a70031e1 Improvements to enable UANodeSet to import/export AccessLevelEx as uint32 (#815) 2019-10-02 16:39:04 +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
AlinMoldovean 099a003144 Fixes #805 2019-09-27 16:11:33 +03:00
AlinMoldovean f10151507b Fix #751 - possible handle leak in stress test 2019-09-26 10:55:41 +03:00
jlorek fad62ed965 Fixes #771 (#781)
Fixes a copy & paste bug discovered by @hevgen
2019-08-14 14:52:29 +03:00
AlinMoldovean b53ec37199 Copy invalid certificate to rejected store for all validation errors. 2019-07-23 17:17:39 +03:00
Alin Moldovean 07e2b807fb Fixes #748. CertificateValidation event not fired for BadCertificateChainIncomplete. (#752) 2019-07-10 10:25:54 +03:00
AlinMoldovean 76cd3953ed Fix for abandoned socket connection in UaSCUaBinaryTransportChannel.Reconnect() 2019-06-19 15:38:14 +03:00
AlinMoldovean 9b02652262 Fixes #729. Connection with self-signed certificate fails with BadCertificateChainIncomplete. 2019-06-07 16:08:09 +03:00
AlinMoldovean 24e44dd3f3 Compliance fix in CertificateValidator 2019-05-23 15:12:39 +03:00
AlinMoldovean f062bfdc89 Compliance fixes in CertificateValidator.
Added setting in SecurityConfiguration to require revocation lists for all CAs
2019-05-21 17:42:59 +03: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
AlinMoldovean 33bfecea50 Add getter for stream in BinaryDecoder 2019-04-11 13:34:42 +03:00
AlinMoldovean f5a64e2e46 Fixes #666 - null pointer reference 2019-04-03 16:24:35 +03:00
AlinMoldovean c8ac8e6b5e Fixes #673 - Incorrect IssuedTokenType for JWT tokens 2019-04-02 16:49:40 +03:00
Alin Moldovean 50c9a67735 Merge pull request #681 from OctaviaStan/master
Add Extension property to NodeSet to enable usage of Extension proper…
2019-03-22 11:33:45 +02:00
Octavia Stan 7a30aa1d26 Add Extension property to NodeSet to enable usage of Extension property of an imported/exported UANode
Add correction to UserAccessLevel at import time if it was not specified
Add correction to UserWriteMask at import time if it was not specified
Use MethodDeclarationId from an UANode at import time
2019-03-21 12:35:59 +02:00
AlinMoldovean 65502ccd62 Update in CertificateValidator.Validate() to require the complete chain. 2019-03-19 16:31:31 +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
AlinMoldovean ec70f7d34f Fixes #639 - InvalidCastException when passing an enumeration 2019-02-13 18:26:40 +02:00
Thomas Zeugner 23551e7422 Use [Flags] on NodeStateChangeMasks (#642)
Tell the compiler that bitwise operators are allowed on NodeStateChangeMasks
2019-02-13 18:12:38 +02:00
Marc Schier def3126c5d Fix travis build and interop in binary decoder (#645)
* Fix interop where a server is responding with a 0 terminated string.  In particular xml document read with malformed string causes XML exception. 

* Do not check position before checking Stream.CanSeek when decoding to avoid exception.  This will use the memory allocation path to do random access read.

* Fix .travis build due to failing test on mono
2019-02-13 17:02:21 +01:00
Martin Regen a0c4631d28 enable Pss padding for Aes 256 profile on .Net4.x (#638) 2019-02-05 15:01:31 +01:00