CertAddEncodedCertificateToSystemStoreA function (wincrypt.h)
The CertAddEncodedCertificateToSystemStore function opens the specified system store and adds the encoded certificate to it.
Syntax
BOOL CertAddEncodedCertificateToSystemStoreA(
[in] LPCSTR szCertStoreName,
[in] const BYTE *pbCertEncoded,
[in] DWORD cbCertEncoded
);
Parameters
[in] szCertStoreName
A null-terminated string that contains the name of the system store for the encoded certificate.
[in] pbCertEncoded
A pointer to a buffer that contains the encoded certificate to add.
[in] cbCertEncoded
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 Parameter | Value |
---|---|
szSubsystemProtocol | szCertStoreName |
If CertAddEncodedCertificateToSystemStore obtains a handle to the specified system store, it calls CertCloseStore to close the handle before it returns.
CertAddEncodedCertificateToStore Parameter | Value |
---|---|
dwCertEncodingType | X509_ASN_ENCODING |
dwAddDisposition | CERT_STORE_ADD_USE_EXISTING |
ppCertContext | NULL |
Note
The wincrypt.h header defines CertAddEncodedCertificateToSystemStore as an alias that automatically selects the ANSI or Unicode version of this function based on the definition of the UNICODE preprocessor constant. Mixing usage of the encoding-neutral alias with code that is not encoding-neutral can lead to mismatches that result in compilation or runtime errors. For more information, see Conventions for Function Prototypes.
Requirements
Requirement | Value |
---|---|
Minimum supported client | Windows XP [desktop apps only] |
Minimum supported server | Windows Server 2003 [desktop apps only] |
Target Platform | Windows |
Header | wincrypt.h |
Library | Crypt32.lib |
DLL | Crypt32.dll |