/**
 * @file       pa_provision.h
 * @brief      Provision PA certificates
 *
 * @author     Oleksandr Kanievskyi (o.kanievskyi@samsung.com)
 * @version    1.0
 * @date       Created Jan 26, 2017
 * @copyright  In Samsung Ukraine R&D Center (SURC) under a contract between
 * @copyright  LLC "Samsung Electronics Ukraine Company" (Kiev, Ukraine) and
 * @copyright  "Samsung Electronics Co", Ltd (Seoul, Republic of Korea)
 * @copyright   Copyright: (c) Samsung Electronics Co, Ltd 2016. All rights reserved.
**/

#ifndef __PA_PROVISION_H__
#define __PA_PROVISION_H__

#include <stddef.h>
#include <stdint.h>
#include "pa_api.h"

#ifdef __cplusplus
extern "C" {
#endif

/**
 * @brief Create new PA certificate for Android application file (APK or ODEX)
 * @details Issue new PA certificate for installed Android application.
 * The \a fd must be signed and verified by FIVE before invoking this command.
 * If file was not signed or verified the certificate will not create.
 * FIVE verification can not be called from this function because it can clear
 * integrity of whole process.
 * The certificate will be added to a file extended attributes.
 * @param [in] fd File descriptor of opened application file
 * @param [in] package_name Package name of APK (NULL-terminated)
 * @param [in] rsa, rsa_size Public key of APK file
 * @return ::PA_SUCCESS code in case of success and error code otherwise
 */
PaResult PaNewCertificate(int fd, const char *package_name, const uint8_t *rsa, size_t rsa_size);

#ifdef __cplusplus
}
#endif

#endif // __PA_PROVISION_H__
