Login  
Search All Forums
Dart Home | PowerTCP Web Enterprise for ActiveX | Custom Development Reply | PowerTCP Web Enterprise for ActiveX Topics | Forums   
AuthorForum: PowerTCP Web Enterprise for ActiveX
Topic: Certificate Store Refresh Problem
pkoenig2001

From: New York, NY USA
Posts: 7
Member Since: 03/06/03
posted March 6, 2003 2:43 PM

I am currently using the trial software and plan to purchase the Web Enterprise Tool.

I am coding in a VBA environment.

I have two certificates in my Personal Store. When I refresh my CertificateStore object, it sometimes reports the correct answer 2, but sometimes reports only 1 - inevitably missing the certificate that I'm looking for.

This happens inconsistently. I have tried refreshing several times before using the CertificateStore, but it will still "lose" my certificate some of the time.

What can I do to fix this?

Here is a sample code snippet ...

Dim Store As New CertificateStore
Dim Cert As Certificate
Dim bFound as boolean
Store.Name = "MY"
Store.Location = locationCurrentUser
Store.Refresh
Debug.Print xj, Store.Certificates.Count
For Each Certificate In Store.Certificates
  If Certificate.IssuedTo = CERT_ISSUEDTO Then
   bFoundCert = True        
  Next
Next

Thanks,
Phil
pkoenig2001

From: New York, NY USA
Posts: 7
Member Since: 03/06/03
posted March 6, 2003 2:45 PM

In case I wasn't clear, the issue is that the CertificateStore.Certificates.Count property will sometimes report 2 and sometimes report 1 even though I have 2 certificates.

The one that it "loses" is always the one I'm looking for.

Thanks,
Phil
K M Drake



From: Utica, NY USA
Posts: 3406
Member Since: 07/14/00
posted March 6, 2003 3:13 PM

Hi,
I remember a problem like this from several months ago, but I believe it's since been fixed. Do you see the problem with the latest dll?
http://www.dart.com/downloads/update.exe

Also, I remember if you called Refresh twice in a row, the correct number of certs would be reported. If you do this, does the problem go away?
Thanks,
-ken
pkoenig2001

From: New York, NY USA
Posts: 7
Member Since: 03/06/03
posted March 6, 2003 3:51 PM

Hi,

I still am experiencing this problem.

I installed the dll update but still experience this problem - even when I refresh two or more times.

Any thoughts?

Thanks,
Phil
pkoenig2001

From: New York, NY USA
Posts: 7
Member Since: 03/06/03
posted March 7, 2003 9:19 AM

Hi Ken,

I think I've found a work around.

Instead of simply refreshing the store object when it fails to return the proper count, I instantiate a new certificatestore object before trying again. This is working better.

Dim Store As CertificateStore
Dim bFoundCert As Boolean
Dim iTry As Integer
bFoundCert = False
iTry = 1
While (Not bFoundCert) And (iTry <= 10)
  Set Store = New CertificateStore
  Store.Name = Range("certstorename").Value
  Store.Location = Range("certstoreloc").Value
  Store.Refresh
  For Each Certificate In Store.Certificates
   If Certificate.IssuedTo = CERT_ISSUEDTO Then
     bFoundCert = True
     Exit For
   End If
   DoEvents
  Next
  iTry = iTry + 1
  Set Store = Nothing
Wend

Thanks,
Phil
K M Drake



From: Utica, NY USA
Posts: 3406
Member Since: 07/14/00
posted March 7, 2003 1:26 PM

Hi Phil,
Does the Store.Find method find your certificate when the count is incorrect?
Can you export the certificate as a pfx file, and send it to support@dart.com, so I can try to reproduce this?
Thanks,
-ken
pkoenig2001

From: New York, NY USA
Posts: 7
Member Since: 03/06/03
posted March 8, 2003 2:15 PM

Hi Ken,

The Store.Find does not work when the count is incorrect.

My workaround is working, however, so I'm okay with it.

I'm afraid I'm not allowed to forward the certificate for security reasons.

I do have another issue, could you please see my post regarding Excel / Licensing?

Thanks,
Phil
novneet11
novneet_jain@etelic.com

From: Indore, USA
Posts: 8
Member Since: 06/01/04
posted June 1, 2004 2:50 AM

Hi,
I m using trial version of controls.

I m facing a strange problem with webasp control in VB. I have used the following code in VB DLL


Public Function FillCertVar() As Variant()
  Dim arrCerts() As Variant
  Dim lobjCertificate As Certificate
  Dim store As New CertificateStore
  Dim i As Integer
  
  
  '************************************
  Dim fs As New FileSystemObject
  Dim fl As TextStream
  fs.CreateTextFile App.Path & "\epki.log", True
  Set fl = fs.OpenTextFile(App.Path & "\epki.log", ForAppending, True)
  '************************************
  
  Set store = New CertificateStore
  store.Name = "MY"
  store.Location = 1 'locationCurrentUser
  fl.WriteLine ("Sleeping")
  Sleep 3000
  fl.WriteLine (store.Name)
  fl.WriteLine (store.Location)
  fl.WriteLine ("Awake")
  store.Refresh 'Must use Refreshed to populate Store.Certificates
  fl.WriteLine ("First refresh")
  fl.WriteLine (store.Name)
  fl.WriteLine (store.Location)
  fl.WriteLine (store.Certificates.Count)
  
  store.Refresh
  fl.WriteLine ("Second refresh")
  fl.WriteLine (store.Name)
  fl.WriteLine (store.Location)
  fl.WriteLine (store.Certificates.Count)
  If store.Certificates.Count = 0 Then
    ReDim arrCerts(1)
    arrCerts(0) = "NoCert"
    FillCertVar = arrCerts
    Exit Function
  End If
  ReDim arrCerts(store.Certificates.Count)
  i = 0
  For Each lobjCertificate In store.Certificates
    arrCerts(i) = lobjCertificate.FriendlyName
'    MsgBox arrCerts(i)
    i = i + 1
  Next
  FillCertVar = arrCerts
  Set lobjCertificate = Nothing
  Set store = Nothing
  fl.Close
  Set fl = Nothing
  Set fs = Nothing
End Function


I m using the above function in ASP to fetch the certificates. When I run the DLL in debug mode the code returns all the certificates. But when I make a DLL containg the above code and when I run the ASP code using the DLL(Not in debug mode) in that case the code dosenot return me any certificate.

What can be done to make it work. Its urgent please help me up.

Novneet Jain
novneet11
novneet_jain@etelic.com

From: Indore, USA
Posts: 8
Member Since: 06/01/04
posted June 1, 2004 5:51 AM

Hi,

One more thing that I have dowloaded the latest version of the file and updated it also then to its not working.

Novneet Jain
K M Drake



From: Utica, NY USA
Posts: 3406
Member Since: 07/14/00
posted June 1, 2004 12:31 PM

Hi,
It is because you are using a CurrentUser store, and the ASP user is different than the one you are logged in as.

You can try using a certificate in the LocalMachine store. We will also be releasing in the coming weeks a version where you can load a pfx file directly, instead of requiring the certificate be grabbed from a Microsoft Store.

-ken
Reply | PowerTCP Web Enterprise for ActiveX Topics | Forums   
This site is powered by PowerTCP WebServer Tool PowerTCP WebServer for ActiveX