Export (0) Print
Expand All
Expand Minimize

CertAddEncodedCertificateToSystemStore function

The CertAddEncodedCertificateToSystemStore function opens the specified system store and adds the encoded certificate to it.

Syntax


BOOL WINAPI CertAddEncodedCertificateToSystemStore(
  _In_  LPCSTR szCertStoreName,
  _In_  const BYTE *pbCertEncoded,
  _In_  DWORD cbCertEncoded
);

Parameters

szCertStoreName [in]

A null-terminated string that contains the name of the system store for the encoded certificate.

pbCertEncoded [in]

A pointer to a buffer that contains the encoded certificate to add.

cbCertEncoded [in]

The size, in bytes, of the pbCertEncoded buffer.

Return value

If the function succeeds, the return value is TRUE.

If the function fails, the return value is FALSE. CertAddEncodedCertificateToSystemStore depends on the functions listed in the following remarks for error handling. Refer to those function topics for their respective error handling behaviors. For extended error information, call GetLastError.

Remarks

Internally, CertAddEncodedCertificateToSystemStore calls CertOpenSystemStore and CertAddEncodedCertificateToStore with the following parameters.

CertOpenSystemStore ParameterValue
szSubsystemProtocolszCertStoreName

 

If CertAddEncodedCertificateToSystemStore obtains a handle to the specified system store, it calls CertCloseStore to close the handle before it returns.

CertAddEncodedCertificateToStore ParameterValue
dwCertEncodingTypeX509_ASN_ENCODING
dwAddDispositionCERT_STORE_ADD_USE_EXISTING
ppCertContextNULL

 

Requirements

Minimum supported client

Windows XP [desktop apps only]

Minimum supported server

Windows Server 2003 [desktop apps only]

Header

Wincrypt.h

Library

Crypt32.lib

DLL

Crypt32.dll

Unicode and ANSI names

CertAddEncodedCertificateToSystemStoreW (Unicode) and CertAddEncodedCertificateToSystemStoreA (ANSI)

 

 

Community Additions

ADD
Show:
© 2015 Microsoft