Skip to content

Latest commit

 

History

History
123 lines (99 loc) · 4.44 KB

nf-certenroll-icertproperties-initializefromcertificate.md

File metadata and controls

123 lines (99 loc) · 4.44 KB
UID title description helpviewer_keywords old-location tech.root ms.assetid ms.date ms.keywords req.header req.include-header req.target-type req.target-min-winverclnt req.target-min-winversvr req.kmdf-ver req.umdf-ver req.ddi-compliance req.unicode-ansi req.idl req.max-support req.namespace req.assembly req.type-library req.lib req.dll req.irql targetos req.typenames req.redist ms.custom f1_keywords dev_langs topic_type api_type api_location api_name
NF:certenroll.ICertProperties.InitializeFromCertificate
ICertProperties::InitializeFromCertificate (certenroll.h)
Initializes the collection from the properties contained in a certificate.
ICertProperties interface [Security]
InitializeFromCertificate method
ICertProperties.InitializeFromCertificate
ICertProperties::InitializeFromCertificate
InitializeFromCertificate
InitializeFromCertificate method [Security]
InitializeFromCertificate method [Security]
ICertProperties interface
certenroll/ICertProperties::InitializeFromCertificate
security.icertproperties_initializefromcertificate_method
security\icertproperties_initializefromcertificate_method.htm
security
74de47cb-44fd-45d7-ba32-03824fc0995d
12/05/2018
ICertProperties interface [Security],InitializeFromCertificate method, ICertProperties.InitializeFromCertificate, ICertProperties::InitializeFromCertificate, InitializeFromCertificate, InitializeFromCertificate method [Security], InitializeFromCertificate method [Security],ICertProperties interface, certenroll/ICertProperties::InitializeFromCertificate, security.icertproperties_initializefromcertificate_method
certenroll.h
Windows
Windows Vista [desktop apps only]
Windows Server 2008 [desktop apps only]
CertEnroll.dll
Windows
19H1
ICertProperties::InitializeFromCertificate
certenroll/ICertProperties::InitializeFromCertificate
c++
APIRef
kbSyntax
COM
CertEnroll.dll
ICertProperties.InitializeFromCertificate

ICertProperties::InitializeFromCertificate

-description

The InitializeFromCertificate method initializes the collection from the properties contained in a certificate.

-parameters

-param MachineContext [in]

A VARIANT_BOOL variable that identifies the certificate store context. Specify VARIANT_TRUE for the computer and VARIANT_FALSE for the user.

-param Encoding [in]

An EncodingType enumeration value that specifies the type of Unicode encoding applied to the certificate contained in the strCertificate parameter.

-param strCertificate [in]

A BSTR variable that contains the DER-encoded certificate.

Beginning with Windows 7 and Windows Server 2008 R2, you can specify a certificate thumb print or serial number rather than an encoded certificate. Doing so causes the function to search the appropriate local stores for the matching certificate. Keep in mind the following points:

  • The BSTR must be an even number of hexadecimal digits.
  • Whitespace between hexadecimal pairs is ignored.
  • The Encoding parameter must be set to XCN_CRYPT_STRING_HEXRAW.
  • The MachineContext parameter determines whether the user or computer stores or both are searched.
  • If a private key is needed, only the personal and request stores are searched.
  • If a private key is not needed, the root and intermediate CA stores are also searched.

-returns

If the function succeeds, the function returns S_OK.

If the function fails, it returns an HRESULT value that indicates the error. Possible values include, but are not limited to, those in the following table. For a list of common error codes, see Common HRESULT Values.

Return code/value Description
CRYPT_E_NOT_FOUND
The certificate could not be found.
CRYPT_E_UNEXPECTED_MSG_TYPE
The certificate was found but the private key could not be loaded.

-see-also

ICertProperties

ICertProperty