Opc.Ua.Security.Audit.SecureChannelCreated C# (CSharp) Method

SecureChannelCreated() public static method

Called when a secure channel is created by the client.
public static SecureChannelCreated ( string implementationInfo, string endpointUrl, string secureChannelId, EndpointDescription endpoint, X509Certificate2 clientCertificate, X509Certificate2 serverCertificate, BinaryEncodingSupport encodingSupport ) : void
implementationInfo string Information about the secure channel implementation.
endpointUrl string The identifier assigned to the secure channel
secureChannelId string The identifier assigned to the secure channel
endpoint EndpointDescription The endpoint.
clientCertificate System.Security.Cryptography.X509Certificates.X509Certificate2 The client certificate.
serverCertificate System.Security.Cryptography.X509Certificates.X509Certificate2 The server certificate.
encodingSupport BinaryEncodingSupport The type of encoding supported by the channel.
return void
        public static void SecureChannelCreated(
            string implementationInfo,
            string endpointUrl,
            string secureChannelId,
            EndpointDescription endpoint,
            X509Certificate2 clientCertificate,
            X509Certificate2 serverCertificate,
            BinaryEncodingSupport encodingSupport)        
        {
            // do nothing if security turned off.
            if ((Utils.TraceMask & Utils.TraceMasks.Security) == 0)
            {
                return;
            }

            StringBuilder buffer = new StringBuilder();

            buffer.Append("SECURE CHANNEL CREATED");
            buffer.Append(" [");
            buffer.Append(implementationInfo);
            buffer.Append("]");
            buffer.Append(" [ID=");
            buffer.Append(secureChannelId);
            buffer.Append("]");
            buffer.Append(" Connected To: ");
            buffer.Append(endpointUrl);

            if (endpoint != null)
            {
                buffer.Append(" [");
                buffer.AppendFormat(CultureInfo.InvariantCulture, "{0}", endpoint.SecurityMode);
                buffer.Append("/");
                buffer.Append(SecurityPolicies.GetDisplayName(endpoint.SecurityPolicyUri));
                buffer.Append("/");

                if (encodingSupport == BinaryEncodingSupport.Required)
                {
                    buffer.Append("Binary");
                }
                else if (encodingSupport == BinaryEncodingSupport.None)
                {
                    buffer.Append("Xml");
                }
                else
                {
                    buffer.Append("BinaryOrXml");
                }

                buffer.Append("]");

                if (endpoint.SecurityMode != MessageSecurityMode.None)
                {
                    if (clientCertificate != null)
                    {
                        buffer.Append(" Client Certificate: [");
                        buffer.Append(clientCertificate.Subject);
                        buffer.Append("] [");
                        buffer.Append(clientCertificate.Thumbprint);
                        buffer.Append("]");
                    }

                    if (serverCertificate != null)
                    {
                        buffer.Append(" Server Certificate: [");
                        buffer.Append(serverCertificate.Subject);
                        buffer.Append("] [");
                        buffer.Append(serverCertificate.Thumbprint);
                        buffer.Append("]");
                    }
                }
            }

            Utils.Trace(Utils.TraceMasks.Security, buffer.ToString());
        }