OPCUAClient/Server 修改证书有效期为100年

This commit is contained in:
2248356998 qq.com
2023-05-09 14:37:18 +08:00
parent 07ebc16d59
commit 8882c0daea
3 changed files with 7 additions and 5 deletions

View File

@@ -93,6 +93,7 @@ public class OPCUAClient : DisposableObject
StorePath = "CurrentUser\\UA_ThingsGateway",
SubjectName = "CN=ThingsGateway OPCUAClient, C=CN, S=GUANGZHOU, O=ThingsGateway, DC=" + System.Net.Dns.GetHostName(),
},
TrustedIssuerCertificates = new CertificateTrustList
{
StoreType = CertificateStoreType.Directory,
@@ -123,7 +124,7 @@ public class OPCUAClient : DisposableObject
},
TransportQuotas = new TransportQuotas
TransportQuotas = new TransportQuotas
{
OperationTimeout = 6000000,
MaxStringLength = int.MaxValue,
@@ -1399,7 +1400,7 @@ public class OPCUAClient : DisposableObject
EndpointConfiguration endpointConfiguration = EndpointConfiguration.Create(m_configuration);
ConfiguredEndpoint endpoint = new ConfiguredEndpoint(null, endpointDescription, endpointConfiguration);
var d = await m_application.CheckApplicationInstanceCertificate(true, 0);
await m_application.CheckApplicationInstanceCertificate(true, 0,1200);
//var x509 = await m_configuration.SecurityConfiguration.ApplicationCertificate.Find(true);
m_session = await Opc.Ua.Client.Session.Create(
m_configuration,

View File

@@ -26,9 +26,10 @@ namespace ThingsGateway.Foundation.Tests
public async Task OpcSubscribeTest(string address, Type type)
{
_opc = new OPCUAClient();
//_opc.UserIdentity = new UserIdentity("Administrator", "111111");
_opc.UserIdentity = new UserIdentity(new AnonymousIdentityToken());
_opc.UserIdentity = new UserIdentity("Administrator", "111111");
//_opc.UserIdentity = new UserIdentity(new AnonymousIdentityToken());
_opc.OPCNode = new() { OPCUrl = "opc.tcp://127.0.0.1:49320" };
var MonitorNodeTags = new string[] { address };
_opc.SetTags(MonitorNodeTags.ToList());
_opc.OpcStatusChange += Info_OpcStatusChange;

View File

@@ -61,7 +61,7 @@ public partial class OPCUAServer : UpLoadBase
public override async Task BeforStartAsync()
{
// 启动服务器。
await m_application.CheckApplicationInstanceCertificate(true, 0);
await m_application.CheckApplicationInstanceCertificate(true, 0,1200);
await m_application.Start(m_server);
}