FTPS with certificate not working

0
Following will be my code for connecting to FTPS, there is no password on p12 certificate. client.SecureDataTransfers = True AddHandler client.CertificateRequired, AddressOf client_File_CertificateRequired client.Connect(FtpObject.HostName, Integer.Parse(FtpObject.PortNumber), SslSecurityMode.Explicit) client.Authenticate(FtpObject.UserName, FtpObject.Password) Private Sub client_File_CertificateRequired(ByVal sender As Object, ByVal e As ComponentPro.Security.CertificateRequiredEventArgs) e.Certificates = New X509Certificate2Collection(New X509Certificate2(FtpObject.SshPrivateKeyPath, "")) End Sub **Certificate Information**
Encryption algorithm = TLSv1.2: AES256-SHA256, 2048 bit RSA, AES256-SHA256 TLSv1.2 Kx=RSA Au=RSA Enc=AES(256) Mac=SHA256 Cryptographic protocol = TLS/SSL Explicit encryption, TLSv1.2 **Following is the error received:**
ComponentPro.Net.TlsException: Certificate does not have a private key. ---> ComponentPro.Net.TlsException: Certificate does not have a private key. ---> System.Security.Cryptography.CryptographicException: Certificate does not have a private key. at c_ls.c_726be0b4(c_wz , Boolean , Boolean ) at c_fd.c_7007f8d7(c_wz , Boolean , Boolean ) at c_fd.c_3bd7b77c(c_wz , Boolean , Boolean ) at c_wz.c_58d2c182(Boolean ) at c_wz.c_6449b9db(Byte[] , SignatureHashAlgorithm , Boolean ) at c_ua.c_2bc3047b(Byte[] , Int32 , Int32 , c_ss ) at c_ua.c_8d3f7a18(Byte[] , Int32 , Int32 ) at c_jt.c_1042b92c(Byte[] , Int32 , Int32 ) at c_jt.c_2fb37a89() --- End of inner exception stack trace --- at c_jt.c_2fb37a89() at c_jt.c_d7acd670() at c_yq.c_d7acd670() at c_d.c_7f3b5988(SslConfigBase ) at ComponentPro.Net.Ftp.c_b06d9818(SslConfigBase , FtpSslExplicitAuthType , AsyncOperation ) at ComponentPro.Net.Ftp.c_d8db87dc(String , Int32 , SslConfigBase , SslSecurityMode , FtpSslExplicitAuthType , AsyncOperation ) --- End of inner exception stack trace --- at ComponentPro.Net.Ftp.c_d8db87dc(String , Int32 , SslConfigBase , SslSecurityMode , FtpSslExplicitAuthType , AsyncOperation ) at ComponentPro.Net.Ftp.Connect(String serverName, Int32 serverPort, SslSecurityMode security)
ftp
 
asked 11/22/2021 3:15:54 AM
add a comment

2 Answers

0
hi Melody, Please check the private key you are providing is being read with the help of debugging e.Certificates = New X509Certificate2Collection(New X509Certificate2(FtpObject.SshPrivateKeyPath, "")) The file should be in the PKCX#12 .PFX format.
 
answered 11/22/2021 5:31:27 PM
add a comment
0
Hi Martin, It is in .p12 extension format, can componentPro support .p12 certificate?
 
answered 11/25/2021 7:24:58 AM
add a comment

Your Answer

Not the answer you're looking for? Browse other questions tagged ftp or ask your own question.