Function

CertAddCertificateContextToStore

Directives

External
Name
Stdcall

Module

wcrypt2

Last Modified

7/15/2014 3:26:44 PM

Comments

+-------------------------------------------------------------------------
  Add the certificate context to the store according to the specified
  disposition action.
  In addition to the encoded certificate, the context's properties are
  also copied.  Note, the CERT_KEY_CONTEXT_PROP_ID property (and its
  CERT_KEY_PROV_HANDLE_PROP_ID or CERT_KEY_SPEC_PROP_ID) isn't copied.
  Makes a copy of the certificate context before adding to the store.
  dwAddDispostion specifies the action to take if the certificate
  already exists in the store. This parameter must be one of the following
  values:
    CERT_STORE_ADD_NEW
      Fails if the certificate already exists in the store. LastError
      is set to CRYPT_E_EXISTS.
    CERT_STORE_ADD_USE_EXISTING
      If the certifcate already exists, then, its used and if ppStoreContext
      is non-NULL, the existing context is duplicated. Iterates
      through pCertContext's properties and only copies the properties
      that don't already exist. The SHA1 and MD5 hash properties aren't
      copied.
    CERT_STORE_ADD_REPLACE_EXISTING
      If the certificate already exists, then, the existing certificate
      context is deleted before creating and adding a new context.
      Properties are copied before doing the add.
    CERT_STORE_ADD_ALWAYS
      No check is made to see if the certificate already exists. A
      new certificate context is always created and added. This may lead to
      duplicates in the store. Properties are
      copied before doing the add.
  CertGetSubjectCertificateFromStore is called to determine if the
  certificate already exists in the store.
  ppStoreContext can be NULL, indicating the caller isn't interested
  in getting the CERT_CONTEXT of the added or existing certificate.
--------------------------------------------------------------------------

Scope

Interfaced

Declaration

function CertAddCertificateContextToStore(hCertStore :HCERTSTORE;
                                          pCertContext :PCCERT_CONTEXT;
                                          dwAddDisposition :DWORD;
                                      var ppStoreContext :PCCERT_CONTEXT //OPTIONAL
                                          ):BOOL ; stdcall;


Source