Re: Loading pfx file to certificate store - WeOnlyDo Discussion board

Re: Loading pfx file to certificate store (General questions)

by wodDamir, Saturday, November 11, 2006, 17:55 (6587 days ago) @ Chris

Chris,

Where exatly do you get this error? This is probably an error with object initialization.

I don't think this is the error in this code. Perhaps you have tried to use the certificate, but didn't set server's Certificate Property to the Certificate object before you call Start Method. You can do it like this:
--------------------------
Set FtpD.Certificate = cer
--------------------------

I.e, you can try this code:
--------------------------
Dim WithEvents FtpD As wodFTPDCom
Dim location As CertLocation

Private Sub Form_Load()
Set FtpD = New wodFTPDCom
Set location = New CertLocation

Dim cer As Certificate
Set cer = location(CurrentUser).Item( My ).Item( localhost )
MsgBox cer.CommonName
If cer Is Nothing Then
Beep
Else
Set FtpD.Certificate = cer
FtpD.Protocol = FTPS
FtpD.Start
End If
End Sub
--------------------------
I get a message box saying Certificate's CommonName, and after that everything works like a charm.

The If statement in this case is just to check if certificate is actually loaded, and if it is, then we load it into the FTPD Object.

If this sample code still doesn't work, can you please contact me on techsupport@weonlydo.com ?

Regards,
Damba


Complete thread: