Historical Content Alert
This is a historical content for Windows NT 4.0 product and is presented for informative purposes only. All content in this directory is copyrighted and owned by Microsoft.


The GetCertificate method returns the certificate issued for the request, packaged in a PKCS#7 message, including the complete certificate chain for the certificate server.

[VB] BSTR GetCertificate(
  long Flags  
[JAVA] java.lang.String GetCertificate(
  int Flags  
[C++] HRESULT GetCertificate(
  LONG Flags,             // in
  BSTR * pstrCertificate  // out, return value


[VB][JAVA][C++] Flags
One of the following flags can be used to specify the format of the returned certificate.
Certificate Format Flag Description
CR_OUT_BASE64HEADER BASE64 format with begin/end.
CR_OUT_BASE64 BASE64 format without begin/end.
CR_OUT_BINARY Binary format.

The following flag can be used to specify that the complete certificate chain should be included with the requested certificate. Otherwise, just the requested certificate is returned.

Certificate Flag Description
CR_OUT_CHAIN Include complete certificate chain.

For example, to retrieve a binary certificate with complete certificate chain, in C++ you would write:

hResult = GetCertificate(CR_OUT_BINARY | CR_OUT_CHAIN, &pstrCert); 

[C++] pstrCertificate
Points to the return value. See Return Values.

Return Values

Returns the requested certificate.

Share this article: