Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
The Encode method initializes the object from a string that contains a distinguished name. This method is web enabled.
Syntax
HRESULT Encode(
[in] BSTR strName,
[in] X500NameFlags NameFlags
);
Parameters
[in] strName
A BSTR variable that contains the string to encode.
[in] NameFlags
An X500NameFlags enumeration value that specifies the format of the encoded value.
- The default value specified in Certenroll.h is XCN_CERT_NAME_STR_NONE.
- If you do not specify XCN_CERT_NAME_STR_FORWARD_FLAG, then XCN_CERT_NAME_STR_REVERSE_FLAG is automatically applied.
- If you do not specify XCN_CERT_NAME_STR_DISABLE_UTF8_DIR_STR_FLAG, then XCN_CERT_NAME_STR_FORCE_UTF8_DIR_STR_FLAG is automatically applied.
- XCN_CERT_NAME_STR_ENABLE_PUNYCODE_FLAG is automatically set regardless of any other flag you specify.
Return value
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 |
---|---|
|
Memory could not be allocated for the encoded value. |
|
The strName parameter cannot be NULL. |
|
The length, in characters of the strName parameter cannot exceed 64 * 1024. |
Remarks
This method internally calls the CryptoAPI CertStrToName function. Call the Name property to retrieve the name as a null-terminated character string. Call the EncodedName property to retrieve a string containing an encoded name.
Requirements
Requirement | Value |
---|---|
Minimum supported client | Windows Vista [desktop apps only] |
Minimum supported server | Windows Server 2008 [desktop apps only] |
Target Platform | Windows |
Header | certenroll.h |
DLL | CertEnroll.dll |