Mercurial > trustbridge
diff cinst/listutil.h @ 18:f4f957c58e0a
Move listuitol and add cert pinning with a test certificate
author | Andre Heinecke <aheinecke@intevation.de> |
---|---|
date | Wed, 19 Feb 2014 15:41:14 +0000 |
parents | ui/listutil.h@58d51a91d448 |
children |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/cinst/listutil.h Wed Feb 19 15:41:14 2014 +0000 @@ -0,0 +1,48 @@ +#ifndef LISTUTIL_H +#define LISTUTIL_H + +#ifdef __cplusplus +extern "C" { +#endif + +#include <stddef.h> + +/** + * @file listutil.h + * @brief Functions to work with the certificate list. + */ + +/** + * @brief Status of the List Operations + */ +typedef enum { + UnknownValidity = 0, // Not yet parsed + UnknownError = 1, // The expected unexpected + TooLarge = 2, // Failed because the file exeeds the limit + InvalidFormat = 3, // File does not appear to be in list format + InvalidSignature = 4, // Signature was invalid + StatFailed = 5, // Could not stat the file + ReadFailed = 6, // Could not read the file + IncompatibleVersion = 7, // The Format Version does not match + Valid = 8 // List is valid +} list_status_t; + +/** + * @brief Obtain the complete and verified Certificate list. + * + * This checks if the file fileName is a valid certificate + * list signed by the key specified in pubkey.h + * + * The caller has to free data. + * + * @param[in] fileName Name of the file (UTF-8 encoded). + * @param[out] data Newly allocated pointer to the file content. + * @param[out] size Size in Bytes of the file content. + * + * @return status of the operation. + */ +list_status_t readAndVerifyList(const char *fileName, char **data, size_t *size); +#ifdef __cplusplus +} +#endif +#endif