Our Products:   CompleteFTP  edtFTPnet/Free  edtFTPnet/PRO  edtFTPj/Free  edtFTPj/PRO
0 votes
8.3k views
in .NET FTP by (300 points)
I'm unable to load a certificate with a private key using the ProFTPCertificate.CreateFromCER_PVK. I keep getting

Unhandled Exception: ak: The specified file is not a valid PVK file.
at ac.b(String A_0, String A_1, Boolean A_2)
at EnterpriseDT.Net.Ftp.Pro.ProFTPCertificate.CreateFromCER_PVK(String cerFil
eName, String pvkFileName, String pvkPassword)

I am already using these files to successfully connect to the server using WS_FTP and CuteFTP, but I need to automate the process.

I've even tried generating a new certificate using CuteFTP, but get the same error.

Ideas?

Thanks.[/i]

4 Answers

0 votes
by (51.6k points)
This error occurs because the PVK file does not start with the bytes
B0 B5 F1 1E
which is the magic number of (at least some) PVK files.

I tried generating a private key with CuteFTP and it did not generate a PVK file. Instead it generated a KEY file. Did you convert this file to a PVK file somehow or did you get CuteFTP to generate the PVK file itself?

As an alternative you might like to try using OpenSSL to generate a key/certificate pair in the PEM format. You can then convert the key file to a PVK file using this utility. You can find a Windows version of OpenSSL here and details instructions on creating keys with OpenSSL here. In short you generate the key with the command:
openssl genrsa -des3 -out privkey.pem 2048

and the certificate with the command:
openssl req -new -x509 -key privkey.pem -out cacert.pem -days 1095


- Hans (EDT Support)
0 votes
by (300 points)
So the .KEY file is a different beast from a .PVK file?

We already have a .CSR file, a .KEY file and a pass pharse assigned by an external entity to access their FTP site. Is there any way to use these files and your library to attach to the website?

Currently, we're using WS_FTP to transfer files, but we need to automate the process. Unforutunately, Tidal Scheduler doesn't currently play nice with WS_FTP scripting. We're looking for an alternate solution and I'm hoping your product can do this.

Thanks.
0 votes
by (162k points)
Yes, the PVK format is a Microsoft-specific key format.

Using the utility mentioned above,you may be able to convert your key file to a PVK file (I say may because I'm not sure what format your key file is in).

Unfortunately there are a number of certificate and key formats which make things confusing.

Let us know how you go, we'll try to assist in any way possible.

So the .KEY file is a different beast from a .PVK file?

We already have a .CSR file, a .KEY file and a pass pharse assigned by an external entity to access their FTP site. Is there any way to use these files and your library to attach to the website?

Currently, we're using WS_FTP to transfer files, but we need to automate the process. Unforutunately, Tidal Scheduler doesn't currently play nice with WS_FTP scripting. We're looking for an alternate solution and I'm hoping your product can do this.

Thanks.
0 votes
by (300 points)
Thanks. That all worked, though I'm not sure I understand it all. As long as it works, I'm fine.

Categories

...