using System;
using System.IO;
using System.Net.Sockets;
using System.Net.Security;
using System.Security.Authentication;
using System.Security.Cryptography.X509Certificates;
using System.Threading;
using System.Collections.Generic;
using System.Diagnostics;
using System.Net;
#if NET45
using System.Threading.Tasks;
#endif
namespace FluentFTP {
///
/// Event is fired when a SSL certificate needs to be validated
///
/// The control connection that triggered the event
/// Event args
public delegate void FtpSslValidation(FtpClient control, FtpSslValidationEventArgs e);
///
/// Event fired if a bad SSL certificate is encountered. This even is used internally; if you
/// don't have a specific reason for using it you are probably looking for FtpSslValidation.
///
///
///
public delegate void FtpSocketStreamSslValidation(FtpSocketStream stream, FtpSslValidationEventArgs e);
///
/// Event args for the FtpSslValidationError delegate
///
public class FtpSslValidationEventArgs : EventArgs {
X509Certificate m_certificate = null;
///
/// The certificate to be validated
///
public X509Certificate Certificate {
get {
return m_certificate;
}
set {
m_certificate = value;
}
}
X509Chain m_chain = null;
///
/// The certificate chain
///
public X509Chain Chain {
get {
return m_chain;
}
set {
m_chain = value;
}
}
SslPolicyErrors m_policyErrors = SslPolicyErrors.None;
///
/// Validation errors, if any.
///
public SslPolicyErrors PolicyErrors {
get {
return m_policyErrors;
}
set {
m_policyErrors = value;
}
}
bool m_accept = false;
///
/// Gets or sets a value indicating if this certificate should be accepted. The default
/// value is false. If the certificate is not accepted, an AuthenticationException will
/// be thrown.
///
public bool Accept {
get {
return m_accept;
}
set {
m_accept = value;
}
}
}
}