The CertOpenSystemStore function opens a system certificate store based on a subsystem protocol. Several subsystem protocols are predefined by the Microsoft® CryptoAPI, as described under the szSubsystemProtocol parameter.
#include <wincrypt.h>
HCERTSTORE WINAPI CertOpenSystemStore(
HCRYPTPROV hProv, // in
LPCTSTR pszSubsystemProtocol // in
);
Predefined subsystem protocol string | Description |
---|---|
"MY" | A Certificate store holding "My" certificates with their associated private keys. |
"CA" | Certifying Authority certificates. |
"ROOT" | Root certificates. |
"SPC" | Software publisher certificates. |
If the store open fails, NULL is returned. Otherwise, a handle to the certificate store is returned.
Call GetLastError to see the reason for any failures. Note that errors from the called function CertOpenStore are propagated to this function.
After the system store is opened, all the standard certificate store APIs can be used to manipulate the certificates. For example, CertAddEncodedCertificateToStore can be used to add certificates to the system store.
When done, the certificate store should be closed by using CertCloseStore.
See Example Code for Fundamental Certificate Store Operations.
Windows NT: Requires version 4.0 SP3 or later. Available also in IE 3.02 and later.
Windows: Requires Windows 95 OSR2 or later.
Windows CE: Unsupported.
Header: Declared in wincrypt.h.
Import Library: Use crypt32.lib.
Unicode: Implemented as Unicode and ANSI versions on Windows NT.
CertOpenStore, CertSaveStore, CertCloseStore