Skip to content

Commit

Permalink
Use OPC UA SDK 1.5.374.118 (#391)
Browse files Browse the repository at this point in the history
* Use sdk 114

* Fix breaking changes

* Update version

* Use .118
  • Loading branch information
luiscantero authored Sep 13, 2024
1 parent bbe2002 commit 8fa2011
Show file tree
Hide file tree
Showing 5 changed files with 28 additions and 20 deletions.
18 changes: 9 additions & 9 deletions src/Configuration/OpcUaAppConfigFactory.cs
Original file line number Diff line number Diff line change
Expand Up @@ -576,7 +576,7 @@ private async Task<bool> RemoveCertificatesAsync(List<string> thumbprintsToRemov
try
{
_logger.LogInformation("Starting to remove certificate(s) from trusted peer and trusted issuer store");
using ICertificateStore trustedStore = CertificateStoreIdentifier.OpenStore(_config.OpcUa.ApplicationConfiguration.SecurityConfiguration.TrustedPeerCertificates.StorePath);
using ICertificateStore trustedStore = _config.OpcUa.ApplicationConfiguration.SecurityConfiguration.TrustedPeerCertificates.OpenStore();
foreach (var thumbprint in thumbprintsToRemove)
{
var certToRemove = await trustedStore.FindByThumbprint(thumbprint).ConfigureAwait(false);
Expand All @@ -602,7 +602,7 @@ private async Task<bool> RemoveCertificatesAsync(List<string> thumbprintsToRemov
// search the trusted issuer store and remove certificates with a specified thumbprint
try
{
using ICertificateStore issuerStore = CertificateStoreIdentifier.OpenStore(_config.OpcUa.ApplicationConfiguration.SecurityConfiguration.TrustedIssuerCertificates.StorePath);
using ICertificateStore issuerStore = _config.OpcUa.ApplicationConfiguration.SecurityConfiguration.TrustedPeerCertificates.OpenStore();
foreach (var thumbprint in thumbprintsToRemove)
{
var certToRemove = await issuerStore.FindByThumbprint(thumbprint).ConfigureAwait(false);
Expand Down Expand Up @@ -685,7 +685,7 @@ private async Task<bool> AddCertificatesAsync(
{
try
{
using ICertificateStore issuerStore = CertificateStoreIdentifier.OpenStore(_config.OpcUa.ApplicationConfiguration.SecurityConfiguration.TrustedIssuerCertificates.StorePath);
using ICertificateStore issuerStore = _config.OpcUa.ApplicationConfiguration.SecurityConfiguration.TrustedPeerCertificates.OpenStore();
foreach (var certificateToAdd in certificatesToAdd)
{
try
Expand All @@ -710,7 +710,7 @@ private async Task<bool> AddCertificatesAsync(
{
try
{
using ICertificateStore trustedStore = CertificateStoreIdentifier.OpenStore(_config.OpcUa.ApplicationConfiguration.SecurityConfiguration.TrustedPeerCertificates.StorePath);
using ICertificateStore trustedStore = _config.OpcUa.ApplicationConfiguration.SecurityConfiguration.TrustedPeerCertificates.OpenStore();
foreach (var certificateToAdd in certificatesToAdd)
{
try
Expand Down Expand Up @@ -777,7 +777,7 @@ private async Task<bool> UpdateCrlAsync(string newCrlBase64String, string newCrl
}

// check if CRL was signed by a trusted peer cert
using (ICertificateStore trustedStore = CertificateStoreIdentifier.OpenStore(_config.OpcUa.ApplicationConfiguration.SecurityConfiguration.TrustedPeerCertificates.StorePath))
using (ICertificateStore trustedStore = _config.OpcUa.ApplicationConfiguration.SecurityConfiguration.TrustedPeerCertificates.OpenStore())
{
bool trustedCrlIssuer = false;
var trustedCertificates = await trustedStore.Enumerate().ConfigureAwait(false);
Expand Down Expand Up @@ -834,7 +834,7 @@ private async Task<bool> UpdateCrlAsync(string newCrlBase64String, string newCrl
}

// check if CRL was signed by a trusted issuer cert
using (ICertificateStore issuerStore = CertificateStoreIdentifier.OpenStore(_config.OpcUa.ApplicationConfiguration.SecurityConfiguration.TrustedIssuerCertificates.StorePath))
using (ICertificateStore issuerStore = _config.OpcUa.ApplicationConfiguration.SecurityConfiguration.TrustedPeerCertificates.OpenStore())
{
bool trustedCrlIssuer = false;
var issuerCertificates = await issuerStore.Enumerate().ConfigureAwait(false);
Expand Down Expand Up @@ -993,15 +993,15 @@ private async Task<bool> UpdateApplicationCertificateAsync(
var certValidator = new CertificateValidator();
var verificationTrustList = new CertificateTrustList();
var verificationCollection = new CertificateIdentifierCollection();
using (ICertificateStore issuerStore = CertificateStoreIdentifier.OpenStore(_config.OpcUa.ApplicationConfiguration.SecurityConfiguration.TrustedIssuerCertificates.StorePath))
using (ICertificateStore issuerStore = _config.OpcUa.ApplicationConfiguration.SecurityConfiguration.TrustedPeerCertificates.OpenStore())
{
var certs = await issuerStore.Enumerate().ConfigureAwait(false);
foreach (var cert in certs)
{
verificationCollection.Add(new CertificateIdentifier(cert));
}
}
using (ICertificateStore trustedStore = CertificateStoreIdentifier.OpenStore(_config.OpcUa.ApplicationConfiguration.SecurityConfiguration.TrustedPeerCertificates.StorePath))
using (ICertificateStore trustedStore = _config.OpcUa.ApplicationConfiguration.SecurityConfiguration.TrustedPeerCertificates.OpenStore())
{
var certs = await trustedStore.Enumerate().ConfigureAwait(false);
foreach (var cert in certs)
Expand Down Expand Up @@ -1094,7 +1094,7 @@ private async Task<bool> UpdateApplicationCertificateAsync(
}

// remove the existing and add the new application cert
using (ICertificateStore appStore = CertificateStoreIdentifier.OpenStore(_config.OpcUa.ApplicationConfiguration.SecurityConfiguration.ApplicationCertificate.StorePath))
using (ICertificateStore appStore = _config.OpcUa.ApplicationConfiguration.SecurityConfiguration.TrustedPeerCertificates.OpenStore())
{
_logger.LogInformation("Remove the existing application certificate");
try
Expand Down
8 changes: 8 additions & 0 deletions src/FlatDirectoryCertificateStore.cs
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,8 @@ public FlatDirectoryCertificateStore()
/// <inheritdoc/>
public bool SupportsCRLs => _innerStore.SupportsCRLs;

public bool NoPrivateKeys => _innerStore.NoPrivateKeys;

/// <inheritdoc/>
public void Dispose()
{
Expand Down Expand Up @@ -81,6 +83,12 @@ public Task Add(X509Certificate2 certificate, string password = null)
return _innerStore.Add(certificate, password);
}

/// <inheritdoc/>
public Task AddRejected(X509Certificate2Collection certificates, int maxCertificates)
{
return _innerStore.AddRejected(certificates, maxCertificates);
}

/// <inheritdoc/>
public Task<bool> Delete(string thumbprint)
{
Expand Down
8 changes: 4 additions & 4 deletions src/opc-plc.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,8 @@
<Choose>
<When Condition="'$(Configuration)'=='Debug'">
<ItemGroup Condition="!$(DefineConstants.Contains(UseLocalOpcUaSdk))">
<PackageReference Include="OPCFoundation.NetStandard.Opc.Ua.Configuration.Debug" Version="1.5.374-preview.g1a7d9b8e51" NoWarn="NU5104" />
<PackageReference Include="OPCFoundation.NetStandard.Opc.Ua.Server.Debug" Version="1.5.374-preview.g1a7d9b8e51" NoWarn="NU5104" />
<PackageReference Include="OPCFoundation.NetStandard.Opc.Ua.Configuration.Debug" Version="1.5.374.118" NoWarn="NU5104" />
<PackageReference Include="OPCFoundation.NetStandard.Opc.Ua.Server.Debug" Version="1.5.374.118" NoWarn="NU5104" />
</ItemGroup>
<ItemGroup Condition="$(DefineConstants.Contains(UseLocalOpcUaSdk))">
<ProjectReference Include="..\..\UA-.NETStandard\Libraries\Opc.Ua.Configuration\Opc.Ua.Configuration.csproj" />
Expand All @@ -53,8 +53,8 @@
</When>
<When Condition="'$(Configuration)'=='Release'">
<ItemGroup Condition="!$(DefineConstants.Contains(UseLocalOpcUaSdk))">
<PackageReference Include="OPCFoundation.NetStandard.Opc.Ua.Configuration" Version="1.5.374-preview.g1a7d9b8e51" NoWarn="NU5104" />
<PackageReference Include="OPCFoundation.NetStandard.Opc.Ua.Server" Version="1.5.374-preview.g1a7d9b8e51" NoWarn="NU5104" />
<PackageReference Include="OPCFoundation.NetStandard.Opc.Ua.Configuration" Version="1.5.374.118" NoWarn="NU5104" />
<PackageReference Include="OPCFoundation.NetStandard.Opc.Ua.Server" Version="1.5.374.118" NoWarn="NU5104" />
</ItemGroup>
<ItemGroup Condition="$(DefineConstants.Contains(UseLocalOpcUaSdk))">
<ProjectReference Include="..\..\UA-.NETStandard\Libraries\Opc.Ua.Configuration\Opc.Ua.Configuration.csproj" />
Expand Down
12 changes: 6 additions & 6 deletions tests/opc-plc-tests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -19,16 +19,16 @@
<Choose>
<When Condition="'$(Configuration)'=='Release'">
<ItemGroup>
<PackageReference Include="OPCFoundation.NetStandard.Opc.Ua.Server" Version="1.5.374-preview.g1a7d9b8e51" NoWarn="NU5104" />
<PackageReference Include="OPCFoundation.NetStandard.Opc.Ua.Configuration" Version="1.5.374-preview.g1a7d9b8e51" NoWarn="NU5104" />
<PackageReference Include="OPCFoundation.NetStandard.Opc.Ua.Client.ComplexTypes" Version="1.5.374-preview.g1a7d9b8e51" NoWarn="NU5104" />
<PackageReference Include="OPCFoundation.NetStandard.Opc.Ua.Server" Version="1.5.374.118" NoWarn="NU5104" />
<PackageReference Include="OPCFoundation.NetStandard.Opc.Ua.Configuration" Version="1.5.374.118" NoWarn="NU5104" />
<PackageReference Include="OPCFoundation.NetStandard.Opc.Ua.Client.ComplexTypes" Version="1.5.374.118" NoWarn="NU5104" />
</ItemGroup>
</When>
<Otherwise>
<ItemGroup>
<PackageReference Include="OPCFoundation.NetStandard.Opc.Ua.Server.Debug" Version="1.5.374-preview.g1a7d9b8e51" NoWarn="NU5104" />
<PackageReference Include="OPCFoundation.NetStandard.Opc.Ua.Configuration.Debug" Version="1.5.374-preview.g1a7d9b8e51" NoWarn="NU5104" />
<PackageReference Include="OPCFoundation.NetStandard.Opc.Ua.Client.ComplexTypes.Debug" Version="1.5.374-preview.g1a7d9b8e51" NoWarn="NU5104" />
<PackageReference Include="OPCFoundation.NetStandard.Opc.Ua.Server.Debug" Version="1.5.374.118" NoWarn="NU5104" />
<PackageReference Include="OPCFoundation.NetStandard.Opc.Ua.Configuration.Debug" Version="1.5.374.118" NoWarn="NU5104" />
<PackageReference Include="OPCFoundation.NetStandard.Opc.Ua.Client.ComplexTypes.Debug" Version="1.5.374.118" NoWarn="NU5104" />
</ItemGroup>
</Otherwise>
</Choose>
Expand Down
2 changes: 1 addition & 1 deletion version.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"$schema": "https://raw.githubusercontent.com/AArnott/Nerdbank.GitVersioning/master/src/NerdBank.GitVersioning/version.schema.json",
"version": "2.12.23",
"version": "2.12.24",
"versionHeightOffset": -1,
"publicReleaseRefSpec": [
"^refs/heads/main$",
Expand Down

0 comments on commit 8fa2011

Please sign in to comment.