From 876b279b914db4fbb8ae35c4736bea0b025b43e7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christian=20H=C3=BCbner?= Date: Mon, 24 Apr 2023 23:22:25 +0200 Subject: [PATCH] Prevent exception with missing RemoteCertificate --- UaClient/ServiceModel/Ua/Channels/ClientSessionChannel.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/UaClient/ServiceModel/Ua/Channels/ClientSessionChannel.cs b/UaClient/ServiceModel/Ua/Channels/ClientSessionChannel.cs index ccc54ce..397b56c 100644 --- a/UaClient/ServiceModel/Ua/Channels/ClientSessionChannel.cs +++ b/UaClient/ServiceModel/Ua/Channels/ClientSessionChannel.cs @@ -343,7 +343,7 @@ protected override async Task OnOpenAsync(CancellationToken token = default) LocalPrivateKey = tuple.Key; } - var cert = _certificateParser.ReadCertificate(RemoteCertificate); + var cert = RemoteCertificate != null ? _certificateParser.ReadCertificate(RemoteCertificate) : null; RemotePublicKey = cert?.GetPublicKey() as RsaKeyParameters; var createSessionRequest = new CreateSessionRequest