flipperzero-firmware/lib/subghz/subghz_keystore.h
Sergey Gavrilov 4bf29827f8
M*LIB: non-inlined strings, FuriString primitive (#1795)
* Quicksave 1
* Header stage complete
* Source stage complete
* Lint & merge fixes
* Includes
* Documentation step 1
* FBT: output free size considering BT STACK
* Documentation step 2
* py lint
* Fix music player plugin
* unit test stage 1: string allocator, mem, getters, setters, appends, compare, search.
* unit test: string equality
* unit test: string replace
* unit test: string start_with, end_with
* unit test: string trim
* unit test: utf-8
* Rename
* Revert fw_size changes
* Simplify CLI backspace handling
* Simplify CLI character insert
* Merge fixes
* Furi: correct filenaming and spelling
* Bt: remove furi string include

Co-authored-by: Aleksandr Kutuzov <alleteam@gmail.com>
2022-10-06 00:15:23 +09:00

81 lines
2.0 KiB
C

#pragma once
#include <furi.h>
#include <m-array.h>
#include <stdint.h>
#ifdef __cplusplus
extern "C" {
#endif
typedef struct {
FuriString* name;
uint64_t key;
uint16_t type;
} SubGhzKey;
ARRAY_DEF(SubGhzKeyArray, SubGhzKey, M_POD_OPLIST)
#define M_OPL_SubGhzKeyArray_t() ARRAY_OPLIST(SubGhzKeyArray, M_POD_OPLIST)
typedef struct SubGhzKeystore SubGhzKeystore;
/**
* Allocate SubGhzKeystore.
* @return SubGhzKeystore* pointer to a SubGhzKeystore instance
*/
SubGhzKeystore* subghz_keystore_alloc();
/**
* Free SubGhzKeystore.
* @param instance Pointer to a SubGhzKeystore instance
*/
void subghz_keystore_free(SubGhzKeystore* instance);
/**
* Loading manufacture key from file
* @param instance Pointer to a SubGhzKeystore instance
* @param filename Full path to the file
*/
bool subghz_keystore_load(SubGhzKeystore* instance, const char* filename);
/**
* Save manufacture key to file
* @param instance Pointer to a SubGhzKeystore instance
* @param filename Full path to the file
* @return true On success
*/
bool subghz_keystore_save(SubGhzKeystore* instance, const char* filename, uint8_t* iv);
/**
* Get array of keys and names manufacture
* @param instance Pointer to a SubGhzKeystore instance
* @return SubGhzKeyArray_t*
*/
SubGhzKeyArray_t* subghz_keystore_get_data(SubGhzKeystore* instance);
/**
* Save RAW encrypted to file
* @param input_file_name Full path to the input file
* @param output_file_name Full path to the output file
* @param iv IV, 16 bytes in hex
*/
bool subghz_keystore_raw_encrypted_save(
const char* input_file_name,
const char* output_file_name,
uint8_t* iv);
/**
* Get decrypt RAW data to file
* @param file_name Full path to the input file
* @param offset Offset from the start of the RAW data
* @param data Returned array
* @param len Required data length
* @return true On success
*/
bool subghz_keystore_raw_get_data(const char* file_name, size_t offset, uint8_t* data, size_t len);
#ifdef __cplusplus
}
#endif