Pheox - Forums
  [Search] Search   [Recent Topics] Recent Topics   [Hottest Topics] Hottest Topics   [Top Downloads] Top Downloads   [Groups] Back to home page 
[Register] Register /  [Login] Login 

Open the local machine store RSS feed
Forum Index » General Issues
Author Message
Anonymous


Hello,

Thanks to the exemple provided (ListAllCerts.java), i have succeeded in listing certificates from the personnal store, but for the current user.

I would like to do the same (open the personnal store) but for the local machine.

Does anyone ever tried to do this ?

Thanks for your help.
tommy

Visitor

Joined: May 30, 2005
Messages: 148
Offline
Hi,

The bad news is that JCAPI is hardcoded to use CERT_SYSTEM_STORE_CURRENT_USER as the high word of the input flags to the MS CAPI function 'CertOpenStore()', which shortly means that you can only get the certificates for the current user.
The good news is that the high word is already defined in a global variable that is OR:ed with the flags for each invocation of the CertOpenStore() function, which means that it's simple to solve your issue. We can just add a new Java method (and some constants for the different system store registry locations) which will give the user the opportunity to change the global variable via JNI.

We can add this new functionality into the next JCAPI maintenance release (which is currently under development) and supply you with a release candidate at the end of this week.

Regards,
Tommy

tommy

Visitor

Joined: May 30, 2005
Messages: 148
Offline
Hi,

We have now added your needed functionality into JCAPI. This is a very early release candidate of the next version (v1.2), so we have decided to not publish it on our public download page. Instead you can download it from the link below.
Note: make sure that you delete the old JCAPI DLL file before you use the new JCAPI JAR file:
C:\Documents and Settings\your user\Local Settings\Temp\JCAPI.dll

The following new methods have been added into the JCAPIProperties class:
  • void setSystemStoreRegistryLocation(JCAPISystemStoreRegistryLocation location) - Set JCAPI to use a new registry location.
  • JCAPISystemStoreRegistryLocation getSystemStoreRegistryLocation() - Get current location used by JCAPI.
  • void resetSystemStoreRegistryLocation() - Tell JCAPI to use the default registry location which is the current user i.e JCAPISystemStoreRegistryLocation.CERT_SYSTEM_STORE_CURRENT_USER

The new class JCAPISystemStoreRegistryLocation defines the following static registry locations for your convenience:
  • CERT_SYSTEM_STORE_CURRENT_SERVICE
  • CERT_SYSTEM_STORE_CURRENT_USER
  • CERT_SYSTEM_STORE_CURRENT_USER_GROUP_POLICY
  • CERT_SYSTEM_STORE_LOCAL_MACHINE
  • CERT_SYSTEM_STORE_LOCAL_MACHINE_ENTERPRISE
  • CERT_SYSTEM_STORE_LOCAL_MACHINE_GROUP_POLICY
  • CERT_SYSTEM_STORE_SERVICES
  • CERT_SYSTEM_STORE_USERS

In your specific case when using the local machine, you could use the following code:

JCAPISystemStoreRegistryLocation location =
new JCAPISystemStoreRegistryLocation(JCAPISystemStoreRegistryLocation.CERT_SYSTEM_STORE_LOCAL_MACHINE);
JCAPIProperties.getInstance().setSystemStoreRegistryLocation(location);


Please let us know if you encounter any problems.

Regards,
Tommy
 Filename JCAPI.jar [Disk] Download
 Description JCAPI v1.2 RC-1
 Filesize 103 Kbytes
 Downloaded:  44 time(s)

 
Forum Index » General Issues
Go to:   
Mobile view
Powered by JForum 2.8.3 © 2023 JForum Team • Maintained by Andowson Chang and Ulf Dittmer