Certificate-Authentication-in-FTPS-protocol - WeOnlyDo Software example code



All

wodCrypt (12)
wodSSH (10)
wodSFTP (23)
wodSSHServer (1)
wodSSHTunnel (11)
wodSSHpackage
wodSFTPdll

wodSSH.NET (10)
wodSFTP.NET (24)
wodFtpDLX.NET (22)
wodWebServer.NET (10)

wodAppUpdate (13)
wodHttpDLX (8)
wodFtpDLX (22)
wodTelnetDLX
wodFTPServer (3)
wodWebServer (10)
wodVPN
wodXMPP (13)
All ** [Visual Basic] ** [C#] ** [VB.NET] **

Certificate Authentication in FTPS protocol
Set Authentication to Certificate in order to use Certificate Authentication. No Password is used in that case.
VB code
Dim WithEvents wodFtpDLX As wodFtpDLXCom

' wodCertificate component is used in this sample. wodCertificate is shipped along with component
' installer and is used for certificate management.
Dim Cert As WODCERTMNGLib.Certificate

Private Sub Form_Load()
    Set wodFtpDLX = New wodFtpDLXCom
    Set Cert = New Certificate
    
    FtpDLX1.HostName = "xx"
    FtpDLX1.Login = "xx"
    FtpDLX1.Protocol = FTPSnodata
    
    FtpDLX1.Authentication = authCertificate
    
    ' Load certificate and belonging key
    Cert.LoadKey "c:\certificate.pfx", "certificate_password"
    Cert.Load "c:\certificate.pfx", "certificate_password"
    
    ' Associate Certificate to the component
    Set FtpDLX1.Certificate = Cert
    FtpDLX1.Connect
    
    
End Sub
C# code
private WeOnlyDo.Client.FtpDLX wodFtpDLX;
private System.Security.Cryptography.X509Certificates.X509Certificate2 Cert;

private void Form1_Load(object sender, EventArgs e)
{
    wodFtpDLX = new WeOnlyDo.Client.FtpDLX();
    Cert = new System.Security.Cryptography.X509Certificates.X509Certificate2();
    
    // Load the actual certificate
    Cert.Import("c:\\certificate.pfx", "certificate_password", Security.Cryptography.X509Certificates.X509KeyStorageFlags.Exportable);

    wodFtpDLX.Hostname = "xx";
    wodFtpDLX.Login = "xx";
    wodFtpDLX.Authentication = WeOnlyDo.Client.Authentications.Certificate;
    wodFtpDLX.Protocol = WeOnlyDo.Client.Protocols.FTPS;
    
    // Associate Certificate to the component
    wodFtpDLX.Certificate = Cert;

    wodFtpDLX.Connect();
}
VB.NET code
Dim WithEvents wodFtpDLX As WeOnlyDo.Client.FtpDLX
Dim Cert As System.Security.Cryptography.X509Certificates.X509Certificate2

Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
    wodFtpDLX = New WeOnlyDo.Client.FtpDLX
    Cert = New System.Security.Cryptography.X509Certificates.X509Certificate2
    
    ' Load the actual certificate
    Cert.Import("c:\\certificate.pfx", "certificate_password", Security.Cryptography.X509Certificates.X509KeyStorageFlags.Exportable)

    wodFtpDLX.Hostname = "xx"
    wodFtpDLX.Login = "xx"
    wodFtpDLX.Authentication = WeOnlyDo.Client.Authentications.Certificate
    wodFtpDLX.Protocol = WeOnlyDo.Client.Protocols.FTPS

    ' Associate Certificate to the component
    wodFtpDLX.Certificate = Cert

    wodFtpDLX.Connect()

End Sub