| # MFi-SAP
Includes: | "APSCommonServices.h" "APSDebugServices.h"
## Introduction APIs and platform interfaces for the Made for iPod (MFi) Security Association Protocol (SAP). This header contains function prototypes that must be implemented by the platform. These functions are called when the Apple software stack needs to interact with the MFi Authentication Coprocessor. Please refer to the relevant version of the "Auth IC" document to obtain more details on how to interact with the Authentication Coprocessor. This document can be found on the MFi Portal. ## Groups ### MFi-SAP APIs for performing the Made for iPod (MFi) Security Association Protocol (SAP). #### Group members: `APSMFiPlatform_CopyCertificate` Copy the certificate from the MFi authentication coprocessor. `APSMFiPlatform_CreateSignature` Create an RSA signature from the specified SHA-1 digest using the MFi authentication coprocessor. `APSMFiPlatform_Finalize` Performs any platform-specific cleanup needed. `APSMFiPlatform_Initialize` Performs any platform-specific initialization needed. ## Functions `APSMFiPlatform_CopyCertificate` Copy the certificate from the MFi authentication coprocessor. `APSMFiPlatform_CreateSignature` Create an RSA signature from the specified SHA-1 digest using the MFi authentication coprocessor. `APSMFiPlatform_Finalize` Performs any platform-specific cleanup needed. `APSMFiPlatform_Initialize` Performs any platform-specific initialization needed. ### APSMFiPlatform_CopyCertificate Copy the certificate from the MFi authentication coprocessor.
    OSStatus APSMFiPlatform_CopyCertificate(
        uint8_t **outCertificatePtr,
        size_t *outCertificateLen );
##### Parameters `outCertificatePtr` Receives malloc()'d ptr to a DER-encoded PKCS#7 message containing the certificate. Caller must free() on success. `outCertificateLen` Number of bytes in the DER-encoded certificate. ##### Return Value kNoErr if successful or an error code indicating failure. ##### Discussion MFi accessory implementors must provide this function. ### APSMFiPlatform_CreateSignature Create an RSA signature from the specified SHA-1 digest using the MFi authentication coprocessor.
    OSStatus APSMFiPlatform_CreateSignature(
        const void *inDigestPtr,
        size_t inDigestLen,
        uint8_t **outSignaturePtr,
        size_t *outSignatureLen );
##### Parameters `inDigestPtr` Ptr to 20-byte SHA-1 digest. `inDigestLen` Number of bytes in the digest. Must be 20. `outSignaturePtr` Receives malloc()'d ptr to RSA signature. Caller must free() on success. `outSignatureLen` Receives number of bytes in RSA signature. ##### Discussion MFi accessory implementors must provide this function. ### APSMFiPlatform_Finalize Performs any platform-specific cleanup needed.
    void APSMFiPlatform_Finalize(
        void );
##### Discussion MFi accessory implementors must provide this function. ### APSMFiPlatform_Initialize Performs any platform-specific initialization needed.
    OSStatus APSMFiPlatform_Initialize(
        void );
##### Return Value kNoErr if successful or an error code indicating failure. ##### Discussion MFi accessory implementors must provide this function. © Apple, Inc. Last Updated: Friday, August 29, 2014