Search code examples
javassl-certificateftps

Invalid Keystore Format while transferring files through FTPS protocol using java(zehon)


I am new to ftps.I am using the zehon library to transfer files using FTPS protocol. I have a verisigned certificate. Here is my code snippet:

FTPsClient ftpClient = new FTPsClient(host, port,username ,password ,false,keyStorePath,keyStorePass); // should it be true or false?? i.e. the isImplicit method 
int status = ftpClient.sendFile(filename, ftpsFolder);

I have verified the username pwd , host and other details. The only thing i am not sure is the keystore file that is the certificate file. I have mentioned the keystore path as C:\keystorefile.crt. I am getting an Invalid Keystore Format while running this program. So what kind of format should my certificate be in?Is there a specific kind that zehon requires ?


Solution

  • I was providing a certificate file, wheareas the program needs a keystore and its password. Creating a keystore and providing its path solved the problem. Here is a link on how to create and put ur certificate into the keystore:

    http://www.sslshopper.com/article-most-common-java-keytool-keystore-commands.html