Skip to content

Commit c4f0f73

Browse files
authored
Merge pull request #2762 from OPCFoundation/master
Merge some fixes found during release testing
2 parents 30dd7a9 + cf2e788 commit c4f0f73

File tree

17 files changed

+79
-31
lines changed

17 files changed

+79
-31
lines changed

.azurepipelines/signlistDebug.txt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@ Stack\Opc.Ua.Core\bin\Debug\net472\Opc.Ua.Core.dll
44
Stack\Opc.Ua.Core\bin\Debug\net48\Opc.Ua.Core.dll
55
Stack\Opc.Ua.Core\bin\Debug\net6.0\Opc.Ua.Core.dll
66
Stack\Opc.Ua.Core\bin\Debug\net8.0\Opc.Ua.Core.dll
7-
Stack\Opc.Ua.Bindings.Https\bin\Debug\netcoreapp3.1\Opc.Ua.Bindings.Https.dll
7+
Stack\Opc.Ua.Bindings.Https\bin\Debug\netstandard2.0\Opc.Ua.Bindings.Https.dll
8+
Stack\Opc.Ua.Bindings.Https\bin\Debug\netstandard2.1\Opc.Ua.Bindings.Https.dll
89
Stack\Opc.Ua.Bindings.Https\bin\Debug\net472\Opc.Ua.Bindings.Https.dll
910
Stack\Opc.Ua.Bindings.Https\bin\Debug\net48\Opc.Ua.Bindings.Https.dll
1011
Stack\Opc.Ua.Bindings.Https\bin\Debug\net6.0\Opc.Ua.Bindings.Https.dll
@@ -22,6 +23,7 @@ Libraries\Opc.Ua.Client\bin\Debug\net48\Opc.Ua.Client.dll
2223
Libraries\Opc.Ua.Client\bin\Debug\net6.0\Opc.Ua.Client.dll
2324
Libraries\Opc.Ua.Client\bin\Debug\net8.0\Opc.Ua.Client.dll
2425
Libraries\Opc.Ua.Client.ComplexTypes\bin\Debug\netstandard2.1\Opc.Ua.Client.ComplexTypes.dll
26+
Libraries\Opc.Ua.Client.ComplexTypes\bin\Debug\net462\Opc.Ua.Client.ComplexTypes.dll
2527
Libraries\Opc.Ua.Client.ComplexTypes\bin\Debug\net472\Opc.Ua.Client.ComplexTypes.dll
2628
Libraries\Opc.Ua.Client.ComplexTypes\bin\Debug\net48\Opc.Ua.Client.ComplexTypes.dll
2729
Libraries\Opc.Ua.Client.ComplexTypes\bin\Debug\net6.0\Opc.Ua.Client.ComplexTypes.dll

.azurepipelines/signlistRelease.txt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@ Stack\Opc.Ua.Core\bin\Release\net472\Opc.Ua.Core.dll
44
Stack\Opc.Ua.Core\bin\Release\net48\Opc.Ua.Core.dll
55
Stack\Opc.Ua.Core\bin\Release\net6.0\Opc.Ua.Core.dll
66
Stack\Opc.Ua.Core\bin\Release\net8.0\Opc.Ua.Core.dll
7-
Stack\Opc.Ua.Bindings.Https\bin\Release\netcoreapp3.1\Opc.Ua.Bindings.Https.dll
7+
Stack\Opc.Ua.Bindings.Https\bin\Release\netstandard2.0\Opc.Ua.Bindings.Https.dll
8+
Stack\Opc.Ua.Bindings.Https\bin\Release\netstandard2.1\Opc.Ua.Bindings.Https.dll
89
Stack\Opc.Ua.Bindings.Https\bin\Release\net472\Opc.Ua.Bindings.Https.dll
910
Stack\Opc.Ua.Bindings.Https\bin\Release\net48\Opc.Ua.Bindings.Https.dll
1011
Stack\Opc.Ua.Bindings.Https\bin\Release\net6.0\Opc.Ua.Bindings.Https.dll
@@ -22,6 +23,7 @@ Libraries\Opc.Ua.Client\bin\Release\net48\Opc.Ua.Client.dll
2223
Libraries\Opc.Ua.Client\bin\Release\net6.0\Opc.Ua.Client.dll
2324
Libraries\Opc.Ua.Client\bin\Release\net8.0\Opc.Ua.Client.dll
2425
Libraries\Opc.Ua.Client.ComplexTypes\bin\Release\netstandard2.1\Opc.Ua.Client.ComplexTypes.dll
26+
Libraries\Opc.Ua.Client.ComplexTypes\bin\Release\net462\Opc.Ua.Client.ComplexTypes.dll
2527
Libraries\Opc.Ua.Client.ComplexTypes\bin\Release\net472\Opc.Ua.Client.ComplexTypes.dll
2628
Libraries\Opc.Ua.Client.ComplexTypes\bin\Release\net48\Opc.Ua.Client.ComplexTypes.dll
2729
Libraries\Opc.Ua.Client.ComplexTypes\bin\Release\net6.0\Opc.Ua.Client.ComplexTypes.dll

Fuzzing/Encoders/Fuzz.Tests/Opc.Ua.Encoders.Fuzz.Tests.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
</ItemGroup>
1919

2020
<ItemGroup>
21-
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.11.0" />
21+
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.11.1" />
2222
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
2323
<PackageReference Include="NUnit" Version="4.1.0" />
2424
<PackageReference Include="NUnit.Console" Version="3.18.1" />

Libraries/Opc.Ua.PubSub/Opc.Ua.PubSub.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636
</ItemGroup>
3737

3838
<ItemGroup>
39-
<PackageReference Include="MQTTnet" Version="4.3.6.1152" />
39+
<PackageReference Include="MQTTnet" Version="4.3.7.1207" />
4040
<PackageReference Include="System.Net.NetworkInformation" Version="4.3.0" />
4141
</ItemGroup>
4242

Stack/Opc.Ua.Bindings.Https/Stack/Https/HttpsTransportListener.cs

Lines changed: 20 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
1515
using System.IO;
1616
using System.Net;
1717
using System.Security.Authentication;
18+
using System.Security.Cryptography;
1819
using System.Security.Cryptography.X509Certificates;
1920
using System.Threading;
2021
using System.Threading.Tasks;
@@ -262,17 +263,29 @@ public void Start()
262263
{
263264
Startup.Listener = this;
264265
m_hostBuilder = new WebHostBuilder();
266+
267+
// prepare the server TLS certificate
268+
var serverCertificate = m_serverCertificate;
269+
#if NETCOREAPP3_1_OR_GREATER || NETSTANDARD2_1 || NET472_OR_GREATER || NET5_0_OR_GREATER
270+
try
271+
{
272+
// Create a copy of the certificate with the private key on platforms
273+
// which default to the ephemeral KeySet. Also a new certificate must be reloaded.
274+
// If the key fails to copy, its probably a non exportable key from the X509Store.
275+
// Then we can use the original certificate, the private key is already in the key store.
276+
serverCertificate = X509Utils.CreateCopyWithPrivateKey(m_serverCertificate, false);
277+
}
278+
catch (CryptographicException ce)
279+
{
280+
Utils.LogTrace("Copy of the private key for https was denied: {0}", ce.Message);
281+
}
282+
#endif
283+
265284
var httpsOptions = new HttpsConnectionAdapterOptions() {
266285
CheckCertificateRevocation = false,
267286
ClientCertificateMode = ClientCertificateMode.NoCertificate,
268287
// note: this is the TLS certificate!
269-
#if NETCOREAPP3_1_OR_GREATER || NETSTANDARD2_1 || NET472_OR_GREATER || NET5_0_OR_GREATER
270-
// Create a copy of the certificate with the private key on platforms
271-
// which default to the ephemeral KeySet.
272-
ServerCertificate = X509Utils.CreateCopyWithPrivateKey(m_serverCertificate, false)
273-
#else
274-
ServerCertificate = m_serverCertificate
275-
#endif
288+
ServerCertificate = serverCertificate,
276289
};
277290

278291
#if NET462

Stack/Opc.Ua.Core/Security/Certificates/CertificateIdentifier.cs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -170,13 +170,14 @@ public async Task<X509Certificate2> LoadPrivateKeyEx(ICertificatePasswordProvide
170170
var certificateStoreIdentifier = new CertificateStoreIdentifier(this.StorePath, this.StoreType, false);
171171
using (ICertificateStore store = certificateStoreIdentifier.OpenStore())
172172
{
173-
if (store.SupportsLoadPrivateKey)
173+
if (store?.SupportsLoadPrivateKey == true)
174174
{
175175
string password = passwordProvider?.GetPassword(this);
176176
m_certificate = await store.LoadPrivateKey(this.Thumbprint, this.SubjectName, password).ConfigureAwait(false);
177177
return m_certificate;
178178
}
179179
}
180+
return null;
180181
}
181182
return await Find(true).ConfigureAwait(false);
182183
}
@@ -202,6 +203,11 @@ public async Task<X509Certificate2> Find(bool needPrivateKey)
202203
var certificateStoreIdentifier = new CertificateStoreIdentifier(StorePath, false);
203204
using (ICertificateStore store = certificateStoreIdentifier.OpenStore())
204205
{
206+
if (store == null)
207+
{
208+
return null;
209+
}
210+
205211
X509Certificate2Collection collection = await store.Enumerate().ConfigureAwait(false);
206212

207213
certificate = Find(collection, m_thumbprint, m_subjectName, needPrivateKey);

Tests/Opc.Ua.Client.ComplexTypes.Tests/Opc.Ua.Client.ComplexTypes.Tests.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
</PropertyGroup>
88

99
<ItemGroup>
10-
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.11.0" />
10+
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.11.1" />
1111
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
1212
<PackageReference Include="NUnit" Version="4.1.0" />
1313
<PackageReference Include="NUnit.Console" Version="3.18.1" />

Tests/Opc.Ua.Client.Tests/Opc.Ua.Client.Tests.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
</PropertyGroup>
1010

1111
<ItemGroup>
12-
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.11.0" />
12+
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.11.1" />
1313
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
1414
<PackageReference Include="NUnit" Version="4.1.0" />
1515
<PackageReference Include="NUnit.Console" Version="3.18.1" />

Tests/Opc.Ua.Configuration.Tests/Opc.Ua.Configuration.Tests.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
</PropertyGroup>
99

1010
<ItemGroup>
11-
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.11.0" />
11+
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.11.1" />
1212
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
1313
<PackageReference Include="NUnit" Version="4.1.0" />
1414
<PackageReference Include="NUnit.Console" Version="3.18.1" />

Tests/Opc.Ua.Core.Tests/Opc.Ua.Core.Tests.csproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@
1010

1111
<ItemGroup>
1212
<PackageReference Include="Microsoft.IO.RecyclableMemoryStream" Version="3.0.1" />
13-
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.11.0" />
14-
<PackageReference Include="Moq" Version="4.20.70" />
13+
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.11.1" />
14+
<PackageReference Include="Moq" Version="4.20.72" />
1515
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
1616
<PackageReference Include="NUnit" Version="4.1.0" />
1717
<PackageReference Include="NUnit.Console" Version="3.18.1" />

Tests/Opc.Ua.Core.Tests/Security/Certificates/TemporaryCertValidator.cs

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -85,9 +85,21 @@ public void Dispose()
8585
m_trustedStore = null;
8686
m_rejectedStore = null;
8787
var path = Utils.ReplaceSpecialFolderNames(m_pkiRoot);
88-
if (Directory.Exists(path))
88+
int retries = 5;
89+
while (retries-- > 0)
8990
{
90-
Directory.Delete(path, true);
91+
try
92+
{
93+
if (Directory.Exists(path))
94+
{
95+
Directory.Delete(path, true);
96+
}
97+
retries = 0;
98+
}
99+
catch (IOException)
100+
{
101+
Thread.Sleep(1000);
102+
}
91103
}
92104
}
93105
}

Tests/Opc.Ua.Core.Tests/Stack/Client/ClientTests.cs

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,19 @@ public void DiscoveryEndPointUrls(string urlString)
9494

9595
Assert.AreEqual(uri.OriginalString, uriBuilder.Uri.OriginalString);
9696
}
97+
98+
[Test]
99+
public void ValidateAppConfigWithoutAppCert()
100+
{
101+
var appConfig = new ApplicationConfiguration() {
102+
ApplicationName = "Test",
103+
ClientConfiguration = new ClientConfiguration() {},
104+
SecurityConfiguration = new SecurityConfiguration() {
105+
ApplicationCertificate = new CertificateIdentifier()
106+
}
107+
};
108+
Assert.DoesNotThrow(() => appConfig.Validate(ApplicationType.Client).GetAwaiter().GetResult());
109+
}
97110
#endregion
98111
}
99112
}

Tests/Opc.Ua.Gds.Tests/Opc.Ua.Gds.Tests.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
</PropertyGroup>
1313

1414
<ItemGroup>
15-
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.11.0" />
15+
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.11.1" />
1616
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
1717
<PackageReference Include="NUnit" Version="4.1.0" />
1818
<PackageReference Include="NUnit.Console" Version="3.18.1" />

Tests/Opc.Ua.PubSub.Tests/Opc.Ua.PubSub.Tests.csproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,15 +8,15 @@
88
</PropertyGroup>
99

1010
<ItemGroup>
11-
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.11.0" />
11+
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.11.1" />
1212
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
1313
<PackageReference Include="NUnit" Version="4.1.0" />
1414
<PackageReference Include="NUnit.Console" Version="3.18.1" />
1515
<PackageReference Include="NUnit3TestAdapter" Version="4.6.0">
1616
<PrivateAssets>all</PrivateAssets>
1717
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
1818
</PackageReference>
19-
<PackageReference Include="Moq" Version="4.20.70" />
19+
<PackageReference Include="Moq" Version="4.20.72" />
2020
<PackageReference Include="coverlet.collector" Version="6.0.2">
2121
<PrivateAssets>all</PrivateAssets>
2222
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>

Tests/Opc.Ua.Security.Certificates.Tests/Opc.Ua.Security.Certificates.Tests.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
</Choose>
2424

2525
<ItemGroup>
26-
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.11.0" />
26+
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.11.1" />
2727
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
2828
<PackageReference Include="NUnit" Version="4.1.0" />
2929
<PackageReference Include="NUnit.Console" Version="3.18.1" />

Tests/Opc.Ua.Server.Tests/Opc.Ua.Server.Tests.csproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@
88
</PropertyGroup>
99

1010
<ItemGroup>
11-
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.11.0" />
12-
<PackageReference Include="Moq" Version="4.20.70" />
11+
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.11.1" />
12+
<PackageReference Include="Moq" Version="4.20.72" />
1313
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
1414
<PackageReference Include="NUnit" Version="4.1.0" />
1515
<PackageReference Include="NUnit.Console" Version="3.18.1" />

targets.props

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@
6969
<LibTargetFrameworks>netstandard2.1</LibTargetFrameworks>
7070
<LibCoreTargetFrameworks>netstandard2.1</LibCoreTargetFrameworks>
7171
<LibxTargetFrameworks>netstandard2.1</LibxTargetFrameworks>
72-
<HttpsTargetFrameworks>netcoreapp3.1</HttpsTargetFrameworks>
72+
<HttpsTargetFrameworks>netstandard2.1</HttpsTargetFrameworks>
7373
</PropertyGroup>
7474
</When>
7575
<When Condition="'$(CustomTestTarget)' == 'net48'">
@@ -108,9 +108,9 @@
108108
<HttpsTargetFrameworks>net8.0</HttpsTargetFrameworks>
109109
</PropertyGroup>
110110
</When>
111-
<!-- Note: .NET Core 2.x and 3.x is end of life, removed netcoreapp2.1/3.1 from any target except https. -->
112-
<!-- Note: .NET Framework 4.6.2 deprecated for 1.4.372, removed net462 from any target. -->
113-
<!-- Visual Studio 2022, supports .NET Framework 4.7.2/4.8, .NET Standard2.1, .NET 6 and .NET 8-->
111+
<!-- Note: .NET Core 2.x and 3.x is end of life, removed netcoreapp2.1/3.1 from any target. -->
112+
<!-- Note: .NET Framework 4.6.2 deprecated for 1.4.372, removed net462 from any target except complex types. -->
113+
<!-- Visual Studio 2022, supports .NET Framework 4.7.2/4.8, .NET Standard2.0/2.1, .NET 6 and .NET 8-->
114114
<When Condition="'$(VisualStudioVersion)' == '17.0'">
115115
<PropertyGroup>
116116
<AnalysisLevel>preview-all</AnalysisLevel>
@@ -119,8 +119,8 @@
119119
<TestsTargetFrameworks>net48;net8.0</TestsTargetFrameworks>
120120
<LibTargetFrameworks>net472;net48;netstandard2.0;netstandard2.1;net6.0;net8.0</LibTargetFrameworks>
121121
<LibCoreTargetFrameworks>net472;net48;netstandard2.0;netstandard2.1;net6.0;net8.0</LibCoreTargetFrameworks>
122-
<LibxTargetFrameworks>net472;net48;netstandard2.1;net6.0;net8.0</LibxTargetFrameworks>
123-
<HttpsTargetFrameworks>net472;net48;netcoreapp3.1;net6.0;net8.0</HttpsTargetFrameworks>
122+
<LibxTargetFrameworks>net462;net472;net48;netstandard2.1;net6.0;net8.0</LibxTargetFrameworks>
123+
<HttpsTargetFrameworks>net472;net48;netstandard2.0;netstandard2.1;net6.0;net8.0</HttpsTargetFrameworks>
124124
</PropertyGroup>
125125
</When>
126126
<!-- Visual Studio 2019, supports .NET Framework 4.8 and .NET Core 3.1 -->

0 commit comments

Comments
 (0)