diff --git a/websocket-sharp/WebSocket.cs b/websocket-sharp/WebSocket.cs index 808a96f7..a5ddc9ce 100644 --- a/websocket-sharp/WebSocket.cs +++ b/websocket-sharp/WebSocket.cs @@ -36,6 +36,7 @@ /* * Contributors: * - Frank Razenberg + * - David Wood */ #endregion @@ -68,10 +69,10 @@ namespace WebSocketSharp private AuthenticationChallenge _authChallenge; private string _base64Key; + private LocalCertificateSelectionCallback + _certSelectionCallback; private RemoteCertificateValidationCallback _certValidationCallback; - private LocalCertificateSelectionCallback - _certSelectionCallback; private bool _client; private Action _closeContext; private CompressionMethod _compression; @@ -232,6 +233,40 @@ namespace WebSocketSharp #region Public Properties + /// + /// Gets or sets the callback used to select a client certificate to supply to the server. + /// + /// + /// If the value of this property is , no client certificate will be + /// supplied. + /// + /// + /// A delegate that references the method + /// used to select the client certificate. The default value is . + /// + public LocalCertificateSelectionCallback ClientCertificateSelectionCallback + { + get { + return _certSelectionCallback; + } + + set { + lock (_forConn) { + var msg = checkIfAvailable (false, false); + if (msg != null) { + _logger.Error (msg); + error ( + "An error has occurred in setting the client certificate selection callback.", + null); + + return; + } + + _certSelectionCallback = value; + } + } + } + /// /// Gets or sets the compression method used to compress the message on the WebSocket /// connection. @@ -434,7 +469,7 @@ namespace WebSocketSharp /// the server certificate, and always returns valid. /// /// - /// A delegate that references the method(s) + /// A delegate that references the method /// used to validate the server certificate. The default value is . /// public RemoteCertificateValidationCallback ServerCertificateValidationCallback { @@ -459,40 +494,6 @@ namespace WebSocketSharp } } - /// - /// Gets or sets the callback used to select a client certificate to supply to the server. - /// - /// - /// If the value of this property is null, no client certificate will be supplied. - /// - /// - /// A delegate that references the method - /// used to select the client certificate. The default value is . - /// - public LocalCertificateSelectionCallback ClientCertificateSelectionCallback - { - get { - return _certSelectionCallback; - } - - set { - lock (_forConn) { - var msg = checkIfAvailable (false, false); - if (msg != null) { - _logger.Error (msg); - error ( - "An error has occurred in setting the client certificate selection callback.", - null); - - return; - } - - _certSelectionCallback = value; - } - } - } - - /// /// Gets the WebSocket URL to connect. /// @@ -1338,7 +1339,9 @@ namespace WebSocketSharp _stream, false, _certValidationCallback ?? ((sender, certificate, chain, sslPolicyErrors) => true), - _certSelectionCallback ?? ((sender, targetHost, localCertificates, remoteCertificate, acceptableIssuers) => null)); + _certSelectionCallback ?? + ((sender, targetHost, localCertificates, remoteCertificate, acceptableIssuers) => + null)); sslStream.AuthenticateAsClient (_uri.DnsSafeHost); _stream = sslStream;