Merge branch 'connect_race' into gds_work_certs

This commit is contained in:
Martin Regen
2017-11-21 16:26:17 +01:00
3 changed files with 17 additions and 14 deletions
+3 -3
View File
@@ -1,7 +1,7 @@
# OPC UA .Net Standard Library Stack and Samples
# OPC UA .Net Standard Stack and Samples
## Overview
This OPC UA reference implementation is targeting the [.NET Standard Library](https://docs.microsoft.com/en-us/dotnet/articles/standard/library). .Net Standard allows developing apps that run on all common platforms available today, including Linux, iOS, Android (via Xamarin) and Windows 7/8/8.1/10 (including embedded/IoT editions) without requiring platform-specific modifications. Furthermore, cloud applications and services (such as ASP.Net, DNX, Azure Websites, Azure Webjobs, Azure Nano Server and Azure Service Fabric) are also supported. For more information and license terms, see [here](http://opcfoundation.github.io/UA-.NETStandardLibrary).
This OPC UA reference implementation is targeting the [.NET Standard](https://docs.microsoft.com/en-us/dotnet/articles/standard/library). .Net Standard allows developing apps that run on all common platforms available today, including Linux, iOS, Android (via Xamarin) and Windows 7/8/8.1/10 (including embedded/IoT editions) without requiring platform-specific modifications. Furthermore, cloud applications and services (such as ASP.Net, DNX, Azure Websites, Azure Webjobs, Azure Nano Server and Azure Service Fabric) are also supported. For more information and license terms, see [here](http://opcfoundation.github.io/UA-.NETStandardLibrary).
## Features included
1. Fully ported Core UA stack and SDK (Client, Server, Configuration & Sample assemblies)
@@ -30,7 +30,7 @@ All required application certificates for OPC UA are created at the first start
### Windows .Net applications
By default the self signed certificates are stored in a **X509Store** called **CurrentUser\\UA_MachineDefault**. The certificates can be viewed or deleted with the Windows Certificate Management Console (certmgr.msc). The *trusted*, *issuer* and *rejected* stores remain in a folder called **OPC Foundation\CertificateStores** with a root folder which is specified by the environment variable **ProgramData**. On Windows 7/8/8.1/10 this is usually the invisible folder **C:\ProgramData**.
Note: Since the sample applications in the UA-.Net repository use the same storage and application names as UA-.NetStandardLibrary, but create only certificates with hostname `localhost`, it is recommended to delete all existing certificates in **MachineDefault** to recreate proper certificates for all sample applications when moving to the UA-.NetStandardLibrary repository.
Note: Since the sample applications in the UA-.Net repository use the same storage and application names as UA-.NetStandard, but create only certificates with hostname `localhost`, it is recommended to delete all existing certificates in **MachineDefault** to recreate proper certificates for all sample applications when moving to the UA-.NetStandard repository.
### Windows UWP applications
By default the self signed certificates are stored in a **X509Store** called **CurrentUser\\UA_MachineDefault**. The certificates can be viewed or deleted with the Windows Certificate Management Console (certmgr.msc). The *trusted*, *issuer* and *rejected* stores remain in a folder called **OPC Foundation\CertificateStores** in the **LocalState** folder of the installed universal windows package. Deleting the application state also deletes the certificate stores.
@@ -267,7 +267,7 @@ namespace Opc.Ua.Configuration
await LoadApplicationConfiguration(false);
}
if (m_applicationConfiguration.SecurityConfiguration != null && m_applicationConfiguration.SecurityConfiguration.AutoAcceptUntrustedCertificates)
if (m_applicationConfiguration.CertificateValidator != null)
{
m_applicationConfiguration.CertificateValidator.CertificateValidation += CertificateValidator_CertificateValidation;
}
@@ -328,9 +328,10 @@ namespace Opc.Ua.Configuration
try
{
if (configuration.SecurityConfiguration != null && configuration.SecurityConfiguration.AutoAcceptUntrustedCertificates)
if (configuration.CertificateValidator != null)
{
configuration.CertificateValidator.CertificateValidation += CertificateValidator_CertificateValidation;
ApplicationInstance applicationInstance = new ApplicationInstance(configuration);
configuration.CertificateValidator.CertificateValidation += applicationInstance.CertificateValidator_CertificateValidation;
}
m_server.Start(configuration);
@@ -341,7 +342,6 @@ namespace Opc.Ua.Configuration
Utils.Trace((int)Utils.TraceMasks.Error, error.ToLongString());
}
}
#endregion
#region Private Fields
@@ -877,7 +877,7 @@ namespace Opc.Ua.Configuration
throw ServiceResultException.Create(StatusCodes.BadConfigurationError, "Could not load configuration file.");
}
m_applicationConfiguration = configuration;
m_applicationConfiguration = FixupAppConfig(configuration);
return configuration;
}
@@ -1013,11 +1013,13 @@ namespace Opc.Ua.Configuration
/// <summary>
/// Handles a certificate validation error.
/// </summary>
private static void CertificateValidator_CertificateValidation(CertificateValidator validator, CertificateValidationEventArgs e)
private void CertificateValidator_CertificateValidation(CertificateValidator validator, CertificateValidationEventArgs e)
{
try
{
if (e.Error != null && e.Error.Code == StatusCodes.BadCertificateUntrusted)
if (m_applicationConfiguration.SecurityConfiguration != null
&& m_applicationConfiguration.SecurityConfiguration.AutoAcceptUntrustedCertificates
&& e.Error != null && e.Error.Code == StatusCodes.BadCertificateUntrusted)
{
e.Accept = true;
Utils.Trace((int)Utils.TraceMasks.Security, "Automatically accepted certificate: {0}", e.Certificate.Subject);
+5 -4
View File
@@ -324,16 +324,17 @@ namespace Opc.Ua.Bindings
m_serverCertificate,
m_descriptions);
if (m_callback != null)
{
channel.SetRequestReceivedCallback(new TcpChannelRequestEventHandler(OnRequestReceived));
}
// start accepting messages on the channel.
channel.Attach(++m_lastChannelId, e.AcceptSocket);
// save the channel for shutdown and reconnects.
m_channels.Add(m_lastChannelId, channel);
if (m_callback != null)
{
channel.SetRequestReceivedCallback(new TcpChannelRequestEventHandler(OnRequestReceived));
}
}
catch (Exception ex)
{