TrustCore SDK NanoCert API reference  version 7.0
PKCS#12 Callback Functions

Typedefs

typedef MSTATUS(* PKCS12_contentHandler) (const void *context, contentTypes type, ubyte4 extraInfo, const ubyte *content, ubyte4 contentLen)
 Process and return the information extracted from a PFX PDU. More...
 

Detailed Description

Typedef Documentation

◆ PKCS12_contentHandler

typedef MSTATUS(* PKCS12_contentHandler) (const void *context, contentTypes type, ubyte4 extraInfo, const ubyte *content, ubyte4 contentLen)

This callback function processes the information extracted from a PFX PDU by a call to PKCS12_ExtractInfo(), and return the content and content type.

pkcs12.h

Parameters
typeContent type; any of the ContentTypes enum values from pkcs12.h:
  • KEYINFO — For content containig a DER-encoded PKCS #8 PrivateKeyInfo object or content containing a private key that is shrouded in accordance with PKCS #8 (see Section 4.2.2, "The PKCS-8ShroundedKeyBag type," in ftp://ftp.rsasecurity.com/pub/pkcs/pkcs-12/pkcs-12v1.pdf). To obtain the contents for KEYINFO types, your callback can decrypt the content by calling the PKCS8_decodePrivateKeyDER() function.
  • CERT — Typically your callback will write the decrypted/extracted information to a file.
  • CRL — Typically your callback will write the decrypted/extracted information to a file.

(clarify how to decrypt info for CERT and CRL)

Parameters
extraInfoAdditional information, depending on the value of the type parameter; any of the certTypes enum values defined in pkcs12.h, given the following restrictions:
  • type = CERT:
    • X509 — For DER-encoded X.509 certificate content.
    • SDSI — BASE64-encoded SDSI certificate content.
  • type = CRL:
    • X509 — DER-encoded X.509 CRL content.
contentPointer to buffer containing data extracted from the PFX PDU. Use the values of the type and extraInfo parameters to determine the type of content in this buffer.
contentLenLenght of content, content.
Returns
OK (0) under all circumstances.

pkcs12.h