public Task ProcessWebSocketRequestAsync( WebSocket webSocket, Option <EndPoint> localEndPoint, EndPoint remoteEndPoint, string correlationId, X509Certificate2 clientCert, IList <X509Certificate2> clientCertChain) { var identityProvider = new DeviceIdentityProvider(this.authenticator, this.clientCredentialsFactory, this.clientCertAuthAllowed); identityProvider.RegisterConnectionCertificate(clientCert, clientCertChain); return(this.ProcessWebSocketRequestAsyncInternal(identityProvider, webSocket, localEndPoint, remoteEndPoint, correlationId)); }
bool RemoteCertificateValidationCallback(DeviceIdentityProvider identityProvider, X509Certificate certificate, X509Chain chain) { if (this.clientCertAuthAllowed && certificate != null) { IList <X509Certificate2> certChain = chain?.ChainElements? .Cast <X509ChainElement>() .Select(element => element.Certificate) .ToList() ?? new List <X509Certificate2>(); identityProvider.RegisterConnectionCertificate(new X509Certificate2(certificate), certChain); } return(true); }