From ebe7e26a75cc926c5a5f4667c96d52fca91ae698 Mon Sep 17 00:00:00 2001 From: Martin Regen Date: Sat, 14 Nov 2020 11:10:10 +0100 Subject: [PATCH] Allow to suppress zero nonce error (#1184) - in addition to duplicate nonce this change allows to suppress zero nonce --- Libraries/Opc.Ua.Client/Session.cs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/Libraries/Opc.Ua.Client/Session.cs b/Libraries/Opc.Ua.Client/Session.cs index b1367a6028..0973fd1257 100644 --- a/Libraries/Opc.Ua.Client/Session.cs +++ b/Libraries/Opc.Ua.Client/Session.cs @@ -334,9 +334,10 @@ namespace Opc.Ua.Client // the server nonce should be validated if the token includes a secret. if (!Utils.Nonce.ValidateNonce(serverNonce, MessageSecurityMode.SignAndEncrypt, (uint)m_configuration.SecurityConfiguration.NonceLength)) { - if (channelSecurityMode == MessageSecurityMode.SignAndEncrypt) + if (channelSecurityMode == MessageSecurityMode.SignAndEncrypt || + m_configuration.SecurityConfiguration.SuppressNonceValidationErrors) { - Utils.Trace((int)TraceMasks.Security, "Warning: The server nonce has not the correct length or is not random enough. The error is suppressed because the channel is encrypted."); + Utils.Trace((int)TraceMasks.Security, "Warning: The server nonce has not the correct length or is not random enough. The error is suppressed by user setting or because the channel is encrypted."); } else {