API Reference | developer.brewmp.com API Reference | developer.brewmp.com

Developer

API Reference

ICERTPARSE_GETSTRUCT()

Brew Release
Brew MP 1.0.2
See Also
Error Codes ICertParse ICertParse_GetBasic() ICertParse_GetBasic_Efficiently ICertParse_GetField()
Description
Get a structure or data blob from a parsed certificate.
Params
pif
[]:
The interface pointer
nStructID
[]:
Identifies which structure to fetch (see below)
pStruct
[]:
Pointer to memory into which struct is copied
nStructSize
[]:
Size of the block of memory pointed to by pStruct
Interface
Prototype
  •    int ICertParse_GetStruct
       (
          const ICertParse *pif,
          int nStructID,
          void *pStruct,
          int nStructSize
       );
    
Return
  • AEE_SUCCESS: Fetched basic details about the certificate. AEE_EFAILED: No certificate set. AEESEC_X509_BAD_CERT: The certificate was NULL or can't be parsed. AEESEC_X509_BAD_VALIDITY: The validity dates were bad. AEE_ENOMEMORY: Out of memory. AEE_EBADPARM: nStructID refers to structure that is not known, nStructSize is too small, or possibly the hash requested is not supported.
    This returns only the first error encountered for the certificate; there may be multiple problems with any given certificate. This api can also return other implementation specific error codes.
Side Effect
  • None
Comments
Returns data about a certificate by copying it into the buffer or structure provided by the caller. The parameter nStructID identifies what is copied. This contrasts to ICertParse_GetField which returns a pointer to the certificate stored internally and thereby has a more complicated and limited lifetime. The following can be fetched: CERTPARSE_STRUCT_BASIC: Same as ICertParse_GetBasic(). CERTPARSE_STRUCT_BASIC_NO_TRUSTOVERRIDEID: Same as ICertParse_GetBasic_Efficiently(). CERTPARSE_STRUCT_MD5HASH: The MD5 hash over the entire cert. CERTPARSE_STRUCT_SHA1HASH: The SHA 1 hash over the entire cert. CERTPARSE_STRUCT_SHA256HASH: The SHA 256 hash over the entire cert. CERTPARSE_STRUCT_SHA384HASH: The SHA 384 hash over the entire cert. CERTPARSE_STRUCT_SHA512HASH: The SHA 512 hash over the entire cert. CERTPARSE_STRUCT_PUBKEY_MD5HASH: The MD5 hash over the subjectPublicKeyInfo. CERTPARSE_STRUCT_PUBKEY_SHA1HASH: The SHA 1 hash over the subjectPublicKeyInfo. CERTPARSE_STRUCT_PUBKEY_SHA256HASH: The SHA 256 hash over the subjectPublicKeyInfo. CERTPARSE_STRUCT_PUBKEY_SHA384HASH: The SHA 384 hash over the subjectPublicKeyInfo. CERTPARSE_STRUCT_PUBKEY_SHA512HASH: The SHA 512 hash over the subjectPublicKeyInfo. This differs from ICertParse_GetField in that it copies data into a buffer rather than returning a pointer to data. It also differs in the data items returned are different. For the data CERTPARSE_STRUCT_BASIC / CERTPARSE_STRUCT_BASIC_NO_TRUSTOVERRIDEID, the size passed in for nStructSize should be sizeof(CertDataBasic). For the hashes, it is the standard output size for the particular hash.