Our Products:   CompleteFTP  edtFTPnet/Free  edtFTPnet/PRO  edtFTPj/Free  edtFTPj/PRO
0 votes
4.2k views
in .NET FTP by
Hey i'm trying to load a certfication using the following code

        _FTPS.ClientCertificate = ProFTPCertificate.CreateFromCER_PVK(certificatePath, PrivateKeyPath, password)
        


But i'm always getting this error 'If a certificate is specified, it must have a private key.'

it used to work with me before but really I don't know what happaned!

thanks in advance

5 Answers

0 votes
by (51.6k points)
Hey i'm trying to load a certfication using the following code

        _FTPS.ClientCertificate = ProFTPCertificate.CreateFromCER_PVK(certificatePath, PrivateKeyPath, password)
        


But i'm always getting this error 'If a certificate is specified, it must have a private key.'


Could you please post the stacktrace?

- Hans (EDT Support)
0 votes
by
here is the stack trace
[ArgumentException: If a certificate is specified, it must have a private key.]
   cv.a(k A_0)
   av.c()
   av.a(BaseSocket A_0, IPAddress A_1, Int32 A_2)
   EnterpriseDT.Net.Ftp.FTPControlSocket.a(BaseSocket A_0, IPAddress A_1, Int32 A_2, Int32 A_3)
   av..ctor(Boolean isTrial, Boolean isImplicitFTPS, SocksContext socksContext, k securityOptions, IPAddress remoteHost, Int32 controlPort, Int32 timeout, CompatibilityFlags compatFlags)
   EnterpriseDT.Net.Ftp.Pro.ProFTPClient.Connect()
   DLEngine.Utilities.ClientFTPS.EstablishConnection() in C:\Inetpub\wwwroot\DLEngine\Utilities\ClientFTPS.vb:121
   DLEngine.Utilities.ClientFTPS.GetFile(String SourceFilePath, String DestinationFilePath) in C:\Inetpub\wwwroot\DLEngine\Utilities\ClientFTPS.vb:64
   FTP.WebForm1.Page_Load(Object sender, EventArgs e) in C:\Inetpub\wwwroot\FTP\WebForm1.aspx.vb:51
   System.Web.UI.Control.OnLoad(EventArgs e)
   System.Web.UI.Control.LoadRecursive()
   System.Web.UI.Page.ProcessRequestMain()

 
0 votes
by (51.6k points)
here is the stack trace
ArgumentException: If a certificate is specified, it must have a private key.]
   cv.a(k A_0)
   av.c()
   av.a(BaseSocket A_0, IPAddress A_1, Int32 A_2)
   EnterpriseDT.Net.Ftp.FTPControlSocket.a(BaseSocket A_0, IPAddress A_1, Int32 A_2, Int32 A_3)
   av..ctor(Boolean isTrial, Boolean isImplicitFTPS, SocksContext socksContext, k securityOptions, IPAddress remoteHost, Int32 controlPort, Int32 timeout, CompatibilityFlags compatFlags)
   EnterpriseDT.Net.Ftp.Pro.ProFTPClient.Connect()


OK, I was just wondering how this exception could have been thrown from the CreateFromCER_PVK method, which is what I thought you said, but I see that it's thrown from the Connect method which makes a lot more sense. Unfortunately, this is not enough to allow me to solve the problem.

If it used to work, try to remember what could have changed since then:
    * Has the certificate changed?* Has the code changed?* Have you got an old version of the code or certificate that you could try?* Did it work on the same machine?* Have you changed any Windows security settings?
Also, try to generate a new private key and certificate. If you still can't work it out, it'd be very useful if you could e-mail us the code segment causing the problem along with a private key and certificate that don't work (not your real ones of course). This page has instructions on e-mailing support.

- Hans (EDT Support)[/list]
0 votes
by
i have send you the code by email. thank you
0 votes
by
I generate my certificated using MakeCert like following

MakeCert -sv final.pvk -ss MyStore final.cer

Categories

...