public Task AuthenticateAsServerAsync(X509Certificate serverCertificate, bool clientCertificateRequired, SslProtocols enabledSslProtocols, bool checkCertificateRevocation) { var options = new MonoSslServerAuthenticationOptions { ServerCertificate = serverCertificate, ClientCertificateRequired = clientCertificateRequired, EnabledSslProtocols = enabledSslProtocols, CertificateRevocationCheckMode = checkCertificateRevocation ? X509RevocationMode.Online : X509RevocationMode.NoCheck, EncryptionPolicy = EncryptionPolicy.RequireEncryption }; return(ProcessAuthentication(false, options, CancellationToken.None)); }
public IAsyncResult BeginAuthenticateAsServer(X509Certificate serverCertificate, bool clientCertificateRequired, SslProtocols enabledSslProtocols, bool checkCertificateRevocation, AsyncCallback asyncCallback, object asyncState) { var options = new MonoSslServerAuthenticationOptions { ServerCertificate = serverCertificate, ClientCertificateRequired = clientCertificateRequired, EnabledSslProtocols = enabledSslProtocols, CertificateRevocationCheckMode = checkCertificateRevocation ? X509RevocationMode.Online : X509RevocationMode.NoCheck, EncryptionPolicy = EncryptionPolicy.RequireEncryption }; var task = ProcessAuthentication(false, options, CancellationToken.None); return(TaskToApm.Begin(task, asyncCallback, asyncState)); }
public void AuthenticateAsServer(X509Certificate serverCertificate, bool clientCertificateRequired, SslProtocols enabledSslProtocols, bool checkCertificateRevocation) { var options = new MonoSslServerAuthenticationOptions { ServerCertificate = serverCertificate, ClientCertificateRequired = clientCertificateRequired, EnabledSslProtocols = enabledSslProtocols, CertificateRevocationCheckMode = checkCertificateRevocation ? X509RevocationMode.Online : X509RevocationMode.NoCheck, EncryptionPolicy = EncryptionPolicy.RequireEncryption }; var task = ProcessAuthentication(true, options, CancellationToken.None); task.Wait(); }
MNS.MonoSslServerAuthenticationOptions CreateAuthenticationOptions(SslServerAuthenticationOptions sslServerAuthenticationOptions) { if (sslServerAuthenticationOptions.ServerCertificate == null && sslServerAuthenticationOptions.ServerCertificateSelectionCallback == null && selectionCallback == null) { throw new ArgumentNullException(nameof(sslServerAuthenticationOptions.ServerCertificate)); } if ((sslServerAuthenticationOptions.ServerCertificate != null || selectionCallback != null) && sslServerAuthenticationOptions.ServerCertificateSelectionCallback != null) { throw new InvalidOperationException(SR.Format(SR.net_conflicting_options, nameof(ServerCertificateSelectionCallback))); } var options = new MNS.MonoSslServerAuthenticationOptions(sslServerAuthenticationOptions); var serverSelectionCallback = sslServerAuthenticationOptions.ServerCertificateSelectionCallback; if (serverSelectionCallback != null) { options.ServerCertSelectionDelegate = (x) => serverSelectionCallback(this, x); } return(options); }