Skip to content

Commit

Permalink
Merge branch 'OPCFoundation:master' into fixRequestWhenPrivateKeyIsNo…
Browse files Browse the repository at this point in the history
…tExportable
  • Loading branch information
romanett authored Oct 22, 2024
2 parents e64cfc5 + 35ccd63 commit c6da2b5
Show file tree
Hide file tree
Showing 68 changed files with 26,696 additions and 4,377 deletions.
1 change: 0 additions & 1 deletion ComIOP/Common/Client/Da/ComDaClientNodeManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -825,7 +825,6 @@ protected override ServiceResult CreateMonitoredItem(ServerSystemContext context
monitoredItem = datachangeItem;

// save the monitored item.
MonitoredItems.Add(monitoredItemId, datachangeItem);
monitoredNode.Add(datachangeItem);

// report change.
Expand Down
6 changes: 3 additions & 3 deletions ComIOP/Common/UA COM Interop Library.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -265,13 +265,13 @@
</ItemGroup>
<ItemGroup>
<PackageReference Include="OPCFoundation.NetStandard.Opc.Ua.Client">
<Version>1.5.374.78</Version>
<Version>1.5.374.126</Version>
</PackageReference>
<PackageReference Include="OPCFoundation.NetStandard.Opc.Ua.Core">
<Version>1.5.374.78</Version>
<Version>1.5.374.126</Version>
</PackageReference>
<PackageReference Include="OPCFoundation.NetStandard.Opc.Ua.Server">
<Version>1.5.374.78</Version>
<Version>1.5.374.126</Version>
</PackageReference>
</ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
Expand Down
2 changes: 1 addition & 1 deletion ComIOP/Wrapper/ServerWrapper/UA COM Server Wrapper.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@
</ItemGroup>
<ItemGroup>
<PackageReference Include="OPCFoundation.NetStandard.Opc.Ua.Core">
<Version>1.5.374.78</Version>
<Version>1.5.374.126</Version>
</PackageReference>
</ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
Expand Down
4 changes: 2 additions & 2 deletions Samples/Client.Net4/UA Sample Client.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -135,10 +135,10 @@
</ItemGroup>
<ItemGroup>
<PackageReference Include="Microsoft.Extensions.Logging.Abstractions">
<Version>8.0.0</Version>
<Version>8.0.2</Version>
</PackageReference>
<PackageReference Include="OPCFoundation.NetStandard.Opc.Ua.Bindings.Https">
<Version>1.5.374.78</Version>
<Version>1.5.374.126</Version>
</PackageReference>
<PackageReference Include="System.Net.Http">
<Version>4.3.4</Version>
Expand Down
2 changes: 1 addition & 1 deletion Samples/Client/Opc.Ua.SampleClient.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@
<Version>6.2.14</Version>
</PackageReference>
<PackageReference Include="OPCFoundation.NetStandard.Opc.Ua.Client">
<Version>1.5.373.121</Version>
<Version>1.5.374.118</Version>
</PackageReference>
<PackageReference Include="System.Xml.XmlDocument">
<Version>4.3.0</Version>
Expand Down
8 changes: 4 additions & 4 deletions Samples/ClientControls.Net4/UA Client Controls.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -1015,16 +1015,16 @@
</ItemGroup>
<ItemGroup>
<PackageReference Include="OPCFoundation.NetStandard.Opc.Ua.Core">
<Version>1.5.374.78</Version>
<Version>1.5.374.126</Version>
</PackageReference>
<PackageReference Include="OPCFoundation.NetStandard.Opc.Ua.Client">
<Version>1.5.374.78</Version>
<Version>1.5.374.126</Version>
</PackageReference>
<PackageReference Include="OPCFoundation.NetStandard.Opc.Ua.Client.ComplexTypes">
<Version>1.5.374.78</Version>
<Version>1.5.374.126</Version>
</PackageReference>
<PackageReference Include="OPCFoundation.NetStandard.Opc.Ua.Configuration">
<Version>1.5.374.78</Version>
<Version>1.5.374.126</Version>
</PackageReference>
</ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
Expand Down
2 changes: 1 addition & 1 deletion Samples/ClientControls/Opc.Ua.Client.Controls.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -267,7 +267,7 @@
<Version>6.2.14</Version>
</PackageReference>
<PackageReference Include="OPCFoundation.NetStandard.Opc.Ua.Client">
<Version>1.5.373.121</Version>
<Version>1.5.374.118</Version>
</PackageReference>
<PackageReference Include="System.Xml.XmlDocument">
<Version>4.3.0</Version>
Expand Down
2 changes: 1 addition & 1 deletion Samples/Controls.Net4/UA Sample Controls.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -708,7 +708,7 @@
</ItemGroup>
<ItemGroup>
<PackageReference Include="OPCFoundation.NetStandard.Opc.Ua.Server">
<Version>1.5.374.78</Version>
<Version>1.5.374.126</Version>
</PackageReference>
</ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
Expand Down
2 changes: 1 addition & 1 deletion Samples/Controls/Opc.Ua.Sample.Controls.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@
<Version>6.2.14</Version>
</PackageReference>
<PackageReference Include="OPCFoundation.NetStandard.Opc.Ua.Server">
<Version>1.5.373.121</Version>
<Version>1.5.374.118</Version>
</PackageReference>
<PackageReference Include="System.Xml.XmlDocument">
<Version>4.3.0</Version>
Expand Down
6 changes: 4 additions & 2 deletions Samples/GDS/Client/Controls/ApplicationCertificateControl.cs
Original file line number Diff line number Diff line change
Expand Up @@ -360,7 +360,8 @@ private async void CertificateRequestTimer_Tick(object sender, EventArgs e)
};

// update store
using (ICertificateStore store = CertificateStoreIdentifier.OpenStore(m_application.CertificateStorePath, false))
var certificateStoreIdentifier = new CertificateStoreIdentifier(m_application.CertificateStorePath, false);
using (ICertificateStore store = certificateStoreIdentifier.OpenStore())
{
// if we used a CSR, we already have a private key and therefore didn't request one from the GDS
// in this case, privateKey is null
Expand Down Expand Up @@ -460,7 +461,8 @@ private async void CertificateRequestTimer_Tick(object sender, EventArgs e)
// update trust list.
if (!String.IsNullOrEmpty(m_application.TrustListStorePath))
{
using (ICertificateStore store = CertificateStoreIdentifier.OpenStore(m_application.TrustListStorePath))
var certificateStoreIdentifier = new CertificateStoreIdentifier(m_application.TrustListStorePath);
using (ICertificateStore store = certificateStoreIdentifier.OpenStore())
{
foreach (byte[] issuerCertificate in issuerCertificates)
{
Expand Down
23 changes: 13 additions & 10 deletions Samples/GDS/Client/Controls/ApplicationTrustListControl.cs
Original file line number Diff line number Diff line change
Expand Up @@ -89,8 +89,8 @@ private void ReloadTrustListButton_Click(object sender, EventArgs e)
}
else
{
CertificateStoreControl.Initialize(m_trustListStorePath, m_issuerListStorePath, null);
}
CertificateStoreControl.Initialize(m_trustListStorePath, m_issuerListStorePath, null);
}
}
else
{
Expand Down Expand Up @@ -120,16 +120,12 @@ private async Task DeleteExistingFromStore(string storePath)
return;
}

using (DirectoryCertificateStore store = (DirectoryCertificateStore) CertificateStoreIdentifier.OpenStore(storePath))
var certificateStoreIdentifier = new CertificateStoreIdentifier(storePath);
using (var store = certificateStoreIdentifier.OpenStore())
{
X509Certificate2Collection certificates = await store.Enumerate();
foreach (var certificate in certificates)
{
if (store.GetPrivateKeyFilePath(certificate.Thumbprint) != null)
{
continue;
}

List<string> fields = X509Utils.ParseDistinguishedName(certificate.Subject);

if (fields.Contains("CN=UA Local Discovery Server"))
Expand All @@ -140,6 +136,11 @@ private async Task DeleteExistingFromStore(string storePath)

if (store is DirectoryCertificateStore ds)
{
if (ds.GetPrivateKeyFilePath(certificate.Thumbprint) != null)
{
continue;
}

string path = Utils.GetAbsoluteFilePath(m_application.CertificatePublicKeyPath, true, false, false);

if (path != null)
Expand Down Expand Up @@ -205,7 +206,8 @@ private void PullFromGds(bool deleteBeforeAdd)

if (!String.IsNullOrEmpty(m_trustListStorePath))
{
using (ICertificateStore store = CertificateStoreIdentifier.OpenStore(m_trustListStorePath))
var certificateStoreIdentifier = new CertificateStoreIdentifier(m_trustListStorePath);
using (ICertificateStore store = certificateStoreIdentifier.OpenStore())
{
if ((trustList.SpecifiedLists & (uint)Opc.Ua.TrustListMasks.TrustedCertificates) != 0)
{
Expand Down Expand Up @@ -233,7 +235,8 @@ private void PullFromGds(bool deleteBeforeAdd)

if (!String.IsNullOrEmpty(m_application.IssuerListStorePath))
{
using (ICertificateStore store = CertificateStoreIdentifier.OpenStore(m_application.IssuerListStorePath))
var certificateStoreIdentifier = new CertificateStoreIdentifier(m_application.IssuerListStorePath);
using (ICertificateStore store = certificateStoreIdentifier.OpenStore())
{
if ((trustList.SpecifiedLists & (uint)Opc.Ua.TrustListMasks.IssuerCertificates) != 0)
{
Expand Down
7 changes: 2 additions & 5 deletions Samples/GDS/Client/GlobalDiscoveryClient.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -139,13 +139,10 @@
</ItemGroup>
<ItemGroup>
<PackageReference Include="OPCFoundation.NetStandard.Opc.Ua.Configuration">
<Version>1.5.374.78</Version>
<Version>1.5.374.126</Version>
</PackageReference>
<PackageReference Include="OPCFoundation.NetStandard.Opc.Ua.Gds.Client.Common">
<Version>1.5.374.78</Version>
</PackageReference>
<PackageReference Include="System.Net.Http">
<Version>4.3.4</Version>
<Version>1.5.374.126</Version>
</PackageReference>
</ItemGroup>
<ItemGroup>
Expand Down
2 changes: 1 addition & 1 deletion Samples/GDS/Client/Opc.Ua.GdsClient.Config.xml
Original file line number Diff line number Diff line change
Expand Up @@ -86,4 +86,4 @@
<!-- <TraceMasks>519</TraceMasks> -->
</TraceConfiguration>

</ApplicationConfiguration>
</ApplicationConfiguration>
4 changes: 2 additions & 2 deletions Samples/GDS/ClientControls/Controls/TrustListControl.cs
Original file line number Diff line number Diff line change
Expand Up @@ -82,8 +82,8 @@ private enum Status

private ICertificateStore CreateStore(string storePath)
{
ICertificateStore store = CertificateStoreIdentifier.CreateStore(CertificateStoreIdentifier.DetermineStoreType(storePath));
store.Open(storePath);
CertificateStoreIdentifier certificateStoreIdentifier = new CertificateStoreIdentifier(storePath);
ICertificateStore store = certificateStoreIdentifier.OpenStore();
return store;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -217,10 +217,10 @@
</ItemGroup>
<ItemGroup>
<PackageReference Include="OPCFoundation.NetStandard.Opc.Ua.Client">
<Version>1.5.374.78</Version>
<Version>1.5.374.126</Version>
</PackageReference>
<PackageReference Include="OPCFoundation.NetStandard.Opc.Ua.Gds.Client.Common">
<Version>1.5.374.78</Version>
<Version>1.5.374.126</Version>
</PackageReference>
</ItemGroup>
<ItemGroup>
Expand Down
4 changes: 2 additions & 2 deletions Samples/GDS/ConsoleServer/NetCoreGlobalDiscoveryServer.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@
<ItemGroup>
<PackageReference Include="Microsoft.VisualStudio.Azure.Containers.Tools.Targets" Version="1.21.0" />
<PackageReference Include="Mono.Options" Version="6.12.0.148" />
<PackageReference Include="OPCFoundation.NetStandard.Opc.Ua.Gds.Server.Common" Version="1.5.374.78" />
<PackageReference Include="OPCFoundation.NetStandard.Opc.Ua.Configuration" Version="1.5.374.78" />
<PackageReference Include="OPCFoundation.NetStandard.Opc.Ua.Gds.Server.Common" Version="1.5.374.126" />
<PackageReference Include="OPCFoundation.NetStandard.Opc.Ua.Configuration" Version="1.5.374.126" />
</ItemGroup>

</Project>
34 changes: 18 additions & 16 deletions Samples/GDS/ConsoleServer/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -167,20 +167,22 @@ public void Run()
return;
}

ManualResetEvent quitEvent = new ManualResetEvent(false);
try
{
Console.CancelKeyPress += (sender, eArgs) => {
quitEvent.Set();
eArgs.Cancel = true;
};
}
catch
using (ManualResetEvent quitEvent = new ManualResetEvent(false))
{
}
try
{
Console.CancelKeyPress += (sender, eArgs) => {
quitEvent.Set();
eArgs.Cancel = true;
};
}
catch
{
}

// wait for timeout or Ctrl-C
quitEvent.WaitOne();
// wait for timeout or Ctrl-C
quitEvent.WaitOne();
}

if (server != null)
{
Expand Down Expand Up @@ -318,18 +320,18 @@ void PrintSessionStatus(Session session, string reason, bool lastContact = false
{
lock (session.DiagnosticsLock)
{
string item = String.Format("{0,9}:{1,20}:", reason, session.SessionDiagnostics.SessionName);
string item = Utils.Format("{0,9}:{1,20}:", reason, session.SessionDiagnostics.SessionName);
if (lastContact)
{
item += String.Format("Last Event:{0:HH:mm:ss}", session.SessionDiagnostics.ClientLastContactTime.ToLocalTime());
item += Utils.Format("Last Event:{0:HH:mm:ss}", session.SessionDiagnostics.ClientLastContactTime.ToLocalTime());
}
else
{
if (session.Identity != null)
{
item += String.Format(":{0,20}", session.Identity.DisplayName);
item += Utils.Format(":{0,20}", session.Identity.DisplayName);
}
item += String.Format(":{0}", session.Id);
item += Utils.Format(":{0}", session.Id);
}
Console.WriteLine(item);
}
Expand Down
8 changes: 6 additions & 2 deletions Samples/GDS/Server/DB/gdsdb.edmx
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,9 @@
</Association>
<Association Name="CertificateStoreApplication">
<End Role="CertificateStore" Type="gdsdbModel.Store.CertificateStores" Multiplicity="*" />
<End Role="Application" Type="gdsdbModel.Store.Applications" Multiplicity="1" />
<End Role="Application" Type="gdsdbModel.Store.Applications" Multiplicity="1">
<OnDelete Action="Cascade" />
</End>
<ReferentialConstraint>
<Principal Role="Application">
<PropertyRef Name="ID" />
Expand Down Expand Up @@ -276,7 +278,9 @@
</Association>
<Association Name="CertificateStoreApplication">
<End Type="gdsdbModel.CertificateStore" Role="CertificateStore" Multiplicity="*" />
<End Type="gdsdbModel.Application" Role="Application" Multiplicity="1" />
<End Type="gdsdbModel.Application" Role="Application" Multiplicity="1" >
<OnDelete Action="Cascade" />
</End>
</Association>
</Schema>
</edmx:ConceptualModels>
Expand Down
5 changes: 4 additions & 1 deletion Samples/GDS/Server/DB/gdsdb.edmx.sql
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,9 @@ GO
IF OBJECT_ID(N'[dbo].[FK_CertificateRequests_Applications]', 'F') IS NOT NULL
ALTER TABLE [dbo].[CertificateRequests] DROP CONSTRAINT [FK_CertificateRequests_Applications];
GO
IF OBJECT_ID(N'[dbo].[CertificateStoreApplication]', 'F') IS NOT NULL
ALTER TABLE [dbo].[CertificateStores] DROP CONSTRAINT [CertificateStoreApplication]
GO

-- --------------------------------------------------
-- Dropping existing tables
Expand Down Expand Up @@ -204,7 +207,7 @@ ADD CONSTRAINT [FK_CertificateStoreApplication]
FOREIGN KEY ([Application_ID])
REFERENCES [dbo].[Applications]
([ID])
ON DELETE NO ACTION ON UPDATE NO ACTION;
ON DELETE CASCADE ON UPDATE NO ACTION;
GO

-- Creating non-clustered index for FOREIGN KEY 'FK_CertificateStoreApplication'
Expand Down
4 changes: 2 additions & 2 deletions Samples/GDS/Server/GlobalDiscoveryServer.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -235,10 +235,10 @@
<Version>6.5.1</Version>
</PackageReference>
<PackageReference Include="OPCFoundation.NetStandard.Opc.Ua.Configuration">
<Version>1.5.374.78</Version>
<Version>1.5.374.126</Version>
</PackageReference>
<PackageReference Include="OPCFoundation.NetStandard.Opc.Ua.Gds.Server.Common">
<Version>1.5.374.78</Version>
<Version>1.5.374.126</Version>
</PackageReference>
</ItemGroup>
<PropertyGroup>
Expand Down
2 changes: 1 addition & 1 deletion Samples/GDS/Server/Opc.Ua.GlobalDiscoveryServer.Config.xml
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@
<CertificateGroupConfiguration>
<Id>Default</Id>
<CertificateType>RsaSha256ApplicationCertificateType</CertificateType>
<SubjectName>CN=IOP-2017 CA, O=OPC Foundation</SubjectName>
<SubjectName>CN=IOP-2024 CA, O=OPC Foundation</SubjectName>
<BaseStorePath>%CommonApplicationData%/OPC Foundation/GDS/PKI/CA/default</BaseStorePath>
<DefaultCertificateLifetime>12</DefaultCertificateLifetime>
<DefaultCertificateKeySize>2048</DefaultCertificateKeySize>
Expand Down
4 changes: 2 additions & 2 deletions Samples/Opc.Ua.Sample/Opc.Ua.Sample.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="OPCFoundation.NetStandard.Opc.Ua.Core" Version="1.5.374.78" />
<PackageReference Include="OPCFoundation.NetStandard.Opc.Ua.Server" Version="1.5.374.78" />
<PackageReference Include="OPCFoundation.NetStandard.Opc.Ua.Core" Version="1.5.374.118" />
<PackageReference Include="OPCFoundation.NetStandard.Opc.Ua.Server" Version="1.5.374.118" />
</ItemGroup>

</Project>
8 changes: 4 additions & 4 deletions Samples/ReferenceClient/Reference Client.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -127,16 +127,16 @@
</ItemGroup>
<ItemGroup>
<PackageReference Include="OPCFoundation.NetStandard.Opc.Ua.Bindings.Https">
<Version>1.5.374.78</Version>
<Version>1.5.374.126</Version>
</PackageReference>
<PackageReference Include="OPCFoundation.NetStandard.Opc.Ua.Client">
<Version>1.5.374.78</Version>
<Version>1.5.374.126</Version>
</PackageReference>
<PackageReference Include="OPCFoundation.NetStandard.Opc.Ua.Configuration">
<Version>1.5.374.78</Version>
<Version>1.5.374.126</Version>
</PackageReference>
<PackageReference Include="OPCFoundation.NetStandard.Opc.Ua.Core">
<Version>1.5.374.78</Version>
<Version>1.5.374.126</Version>
</PackageReference>
</ItemGroup>
<PropertyGroup>
Expand Down
Loading

0 comments on commit c6da2b5

Please sign in to comment.