login about faq

I’m trying to connect to a secured FTP using a crt certificate but I can’t, I receive this error message:

Certificate does not have an associated private key available.
A private key is required for client-side SSL/TLS certificates.
Here is a snippet of my code:
Chilkat.Cert cert = new Chilkat.Cert();
success = cert.LoadFromFile(@"C:/myCerts/cert.crt");
if (!success)
    MessageBox.Show("LoadFromFile: " + cert.LastErrorText);
success = ftp.SetSslClientCert(cert);
if (!success)
    MessageBox.Show("SetSslClientCert: " + ftp.LastErrorText);

asked Oct 18 '12 at 11:37

chilkat's gravatar image

chilkat ♦♦

There are several comments and answers for this question:

1) Check to make sure your FTP server really does require a client-side certificate for the SSL/TLS connection. Usually, if it does, then you should be aware of exactly what certificate you should be using. (Just because the connection is SSL/TLS does not mean you need a client-side certificate. The use of client-side SSL/TLS certs is usually reserved for higher-security systems.)

2) A .crt file only contains a certificate. It does not contain a cert's associated private key. Certs and private keys are typically contained in .p12 or .pfx files, both of which are the same format but simply with different file extensions. (They are PKCS12 format files.) If you have a .p12 or .pfx file, then this is what you should use instead of the .crt.

3) The cert.SetPrivateKeyPem method expects to be provided with the contents of a PEM formatted file that is the private key. A password is not the correct thing to pass to this method. SetPrivateKeyPem would only be used if your cert + private key was contained in separate files (perhaps the cert in a .crt, and the private key in a .pem).

4) You certainly do need the cert's associated private key when using a client-side SSL/TLS certificate. Without the private key, the SSL/TLS server would not be able to verify that you are who you say you are..


answered Oct 18 '12 at 11:44

chilkat's gravatar image

chilkat ♦♦

Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here



Answers and Comments

Markdown Basics

  • *italic* or __italic__
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported



Asked: Oct 18 '12 at 11:37

Seen: 5,827 times

Last updated: Oct 18 '12 at 11:44

powered by OSQA