Go to the documentation of this file.
12 #undef SEFILE_SQL_SECTOR_SIZE
13 #define SEFILE_SQL_SECTOR_SIZE 4096
19 #define SEFILE_SQL_LOGIC_DATA (SEFILE_SQL_SECTOR_SIZE/2)
23 #define SEFILE_LEN_FIELD 2
31 #define SEFILE_SQL_PADDING_LEN 14
39 #define SEFILE_SQL_OVERHEAD_LEN (SEFILE_SQL_SECTOR_SIZE - SEFILE_SQL_LOGIC_DATA - B5_SHA256_DIGEST_SIZE - SEFILE_LEN_FIELD - SEFILE_SQL_PADDING_LEN)
44 #define SEFILE_SQL_SECTOR_DATA_SIZE (SEFILE_SQL_SECTOR_SIZE - B5_SHA256_DIGEST_SIZE - SEFILE_SQL_OVERHEAD_LEN)
47 #define SEFILE_SQL_SECTOR_OVERHEAD (SEFILE_SQL_SECTOR_SIZE - SEFILE_SQL_LOGIC_DATA)
74 uint16_t
securedb_ls(std::string& path, std::vector<std::pair<std::string, std::string>>& list, L1* SEcubeptr);
uint16_t securedb_decrypt_filename(std::string &path, char *filename, L1 *SEcubeptr)
Same as decrypt_filename() but for encrypted SQLite databases.
Definition: SEcureDB.cpp:823
L1 * l1
The pointer to the L1 object created by the main application (i.e. to login to the SEcube).
Definition: SEfile.h:124
uint8_t data[SEFILE_SQL_LOGIC_DATA]
Definition: SEcureDB.h:61
#define SEFILE_SQL_LOGIC_DATA
Definition: SEcureDB.h:20
L1 * SEcube
Definition: SEkey.cpp:22
uint16_t crypto_filename(char *path, char *enc_name, uint16_t *encoded_length)
This function computes the encrypted name of the file specified as path.
Definition: SEfile.cpp:1410
void get_filename(char *path, char *file_name)
Extract the name of a file from its path.
Definition: SEfile.cpp:1602
#define SEFILE_BEGIN
Definition: SEfile_C_interface.h:88
The SEFILE_HEADER struct This data struct is used to define a 31 bytes field inside a sector while ta...
Definition: SEfile.h:52
The SEFILE_SQL_SECTOR struct This data struct is the actual sector organization for encrypted SQLite ...
Definition: SEcureDB.h:58
std::shared_ptr< SEFILE_HANDLE > handleptr
Handle to the file on the underlying filesystem.
Definition: SEfile.h:125
uint16_t decrypt_sectors(void *buff_crypt, void *buff_decrypt, size_t datain_len, size_t current_offset, uint8_t *nonce_ctr, uint8_t *nonce_pbkdf2)
This function decrypts the buff_crypt data by exploiting the functions provided by L1....
Definition: SEfile.cpp:901
#define SEFILE_OPEN
Definition: SEfile_C_interface.h:69
uint16_t decrypt_dirname(std::string &path, char *decDirname, L1 *SEcubeptr)
This function is used to compute the plaintext of am encrypted directory name stored in dirname.
Definition: SEfile.cpp:1249
uint16_t len
Definition: SEcureDB.h:67
bool override_key_check
Global flag that is used to bypass the validity check of a key to read or write encrypted data....
Definition: SEfile.cpp:19
uint16_t EnvCrypto
The algorithm to be used with the key.
Definition: SEfile.h:120
The SEFILE_HANDLE struct This abstract data type is used to hide from higher level of abstraction its...
Definition: SEfile.h:27
This header contains prototypes, constants and structures that are needed to implement the encrypted ...
SEKEY_HEADER key_header
Definition: SEfile.h:54
uint16_t secure_close()
This function releases the resources related to the underlying SEfile object (i.e....
Definition: SEfile.cpp:809
uint8_t nonce_ctr[16]
Definition: SEfile.h:55
uint32_t key_id
Definition: SEfile.h:44
uint16_t secure_key_check(uint16_t direction)
This function is used to check if the key setup in the SEfile object can be used to encrypt or decryp...
Definition: SEfile.cpp:78
#define SEFILE_SQL_PADDING_LEN
Definition: SEcureDB.h:32
uint16_t securedb_get_secure_context(std::string &filename, std::string *keyid, uint16_t *algo)
Same as get_secure_context() but for encrypted SQLite databases.
Definition: SEcureDB.cpp:992
This is the SEfile header that contains most of the methods, constants and structures used by SEfile.
uint16_t valid_directory_name(std::string &name)
This function checks if the given name can be a valid SEfile directory name.
Definition: SEfile.cpp:1547
#define SEFILE_BLOCK_SIZE
Definition: SEfile_C_interface.h:158
uint8_t nonce_pbkdf2[SEFILE_NONCE_LEN]
Definition: SEfile.h:53
#define SEFILE_CURRENT
Definition: SEfile_C_interface.h:89
#define MAX_PATHNAME
Definition: SEfile_C_interface.h:165
std::vector< std::unique_ptr< SEfile > > databases
Definition: SEcureDB.cpp:5
#define SEFILE_READ
Definition: SEfile_C_interface.h:48
#define SEFILE_NEWFILE
Definition: SEfile_C_interface.h:68
bool IsOpen
Flag that is TRUE if the file is open, FALSE otherwise.
Definition: SEfile.h:123
uint16_t crypt_sectors(void *buff_decrypt, void *buff_crypt, size_t datain_len, size_t current_offset, uint8_t *nonce_ctr, uint8_t *nonce_pbkdf2)
This function encrypts the buff_decrypt data by exploiting the functions provided by L1....
Definition: SEfile.cpp:862
#define SEFILE_WRITE
Definition: SEfile_C_interface.h:49
void get_path(char *full_path, char *path)
Extract the path of a file removing the file name.
Definition: SEfile.cpp:1582
uint32_t EnvKeyID
The key ID used by this SEfile instance. This key will be used for encryption and decryption.
Definition: SEfile.h:119
#define SEFILE_SQL_SECTOR_OVERHEAD
Definition: SEcureDB.h:48
size_t securedb_pos_to_cipher_block(size_t current_position)
Same as pos_to_cipher_block() but for encrypted SQLite databases.
Definition: SEcureDB.cpp:711
SEFILE_HEADER header
Definition: SEcureDB.h:60
uint16_t valid_file_name(std::string &name)
This function checks if the given name can be a valid SEfile file name.
Definition: SEfile.cpp:1563
#define SEFILE_SQL_SECTOR_SIZE
Definition: SEcureDB.h:13
This is a header file required by any application exploiting SEfile and/or SEkey.
uint16_t securedb_recrypt(std::string &path, uint32_t key, L1 *SEcubeptr)
Same as secure_recrypt() but for encrypted SQLite databases.
Definition: SEcureDB.cpp:928
A SEfile object is used to manage a file encrypted with SEfile.
Definition: SEfile.h:117
#define SEFILE_END
Definition: SEfile_C_interface.h:90
uint16_t crypt_header(void *buff1, void *buff2, size_t datain_len, uint16_t direction)
This function encrypts a header buffer by exploiting the functions provided by L1....
Definition: SEfile.cpp:826
uint8_t signature[32]
Definition: SEcureDB.h:68
#define SEFILE_SQL_SECTOR_DATA_SIZE
Definition: SEcureDB.h:45
#define SEFILE_SQL_OVERHEAD_LEN
Definition: SEcureDB.h:40
uint16_t securedb_ls(std::string &path, std::vector< std::pair< std::string, std::string >> &list, L1 *SEcubeptr)
Same as secure_ls() but for encrypted SQLite databases.
Definition: SEcureDB.cpp:714
uint16_t algorithm
Definition: SEfile.h:45
uint16_t securedb_secure_getfilesize(char *path, uint32_t *position)
Same as secure_getfilesize() but for encrypted SQLite databases.
Definition: SEcureDB.cpp:598