CryptFormatObject function (wincrypt.h)
The CryptFormatObject function formats the encoded data and returns a Unicode string in the allocated buffer according to the certificate encoding type.
Syntax
BOOL CryptFormatObject(
[in] DWORD dwCertEncodingType,
[in] DWORD dwFormatType,
[in] DWORD dwFormatStrType,
[in] void *pFormatStruct,
[in] LPCSTR lpszStructType,
[in] const BYTE *pbEncoded,
[in] DWORD cbEncoded,
[out] void *pbFormat,
[in, out] DWORD *pcbFormat
);
Parameters
[in] dwCertEncodingType
Type of encoding used on the certificate. The currently defined certificate encoding type used is X509_ASN_ENCODING.
[in] dwFormatType
Format type values. Not used. Set to zero.
[in] dwFormatStrType
Structure format type values. This parameter can be zero, or you can specify one or more of the following flags by using the bitwise-OR operator to combine them.
[in] pFormatStruct
A pointer to the format of the structure. Not used. Set to NULL.
[in] lpszStructType
A pointer to an OID that defines the encoded data. If the high-order word of the lpszStructType parameter is zero, the low-order word specifies the integer identifier for the type of the given structure. Otherwise, this parameter is a long pointer to a null-terminated string.
The following table lists supported OIDs with their associated OID extension.
[in] pbEncoded
A pointer to the encoded data to be formatted. If lpszStructType is one of the OIDs listed above, the pbEncoded is the encoded extension.
[in] cbEncoded
The size, in bytes, of the pbEncoded structure.
[out] pbFormat
A pointer to a buffer that receives the formatted string. When the buffer that is specified is not large enough to receive the decoded structure, the function sets ERROR_MORE_DATA and stores the required buffer size, in bytes, into the variable pointed to by pcbFormat. This parameter can be NULL to set the size of this information for memory allocation purposes. For more information, see Retrieving Data of Unknown Length.
[in, out] pcbFormat
A pointer to a variable that specifies the size, in bytes, of the buffer pointed to by the pbFormat parameter. When the function returns, the variable pointed to by the pcbFormat parameter contains the number of bytes stored in the buffer. This parameter can be NULL, only if pbFormat is NULL.
Return value
If the function succeeds, the return value is TRUE. If it does not succeed, the return value is FALSE. To retrieve extended error information, use the GetLastError function.
Remarks
The default behavior of this function is to return a single-line display of the encoded data, that is, each subfield is concatenated with a comma (,) on one line. If you prefer to display the data in multiple lines, set the CRYPT_FORMAT_STR_MULTI_LINE flag. Each subfield will then be displayed on a separate line.
If there is no formatting routine installed or registered for the lpszStructType parameter, the hexadecimal dump of the encoded CRYPT_INTEGER_BLOB will be returned. A user can set the CRYPT_FORMAT_STR_NO_HEX flag to disable the hexadecimal dump.
Requirements
Requirement | Value |
---|---|
Minimum supported client | Windows XP [desktop apps | UWP apps] |
Minimum supported server | Windows Server 2003 [desktop apps | UWP apps] |
Target Platform | Windows |
Header | wincrypt.h |
Library | Crypt32.lib |
DLL | Crypt32.dll |