mirror of
https://github.com/servalproject/serval-dna.git
synced 2025-04-07 11:08:36 +00:00
more work on encrypting bundles. code passes all 23 rhizome tests.
This commit is contained in:
parent
58cc45043b
commit
94d17a9260
@ -1315,9 +1315,15 @@ int cli_fileid(const char *arg)
|
||||
int app_rhizome_extract_file(int argc, const char *const *argv, struct command_line_option *o)
|
||||
{
|
||||
const char *fileid, *filepath;
|
||||
char *keyhex=NULL;
|
||||
unsigned char *key[RHIZOME_CRYPT_KEY_BYTES];
|
||||
if (cli_arg(argc, argv, o, "fileid", &fileid, cli_fileid, NULL)
|
||||
|| cli_arg(argc, argv, o, "filepath", &filepath, NULL, "") == -1)
|
||||
return -1;
|
||||
|
||||
/* Read key if is available */
|
||||
cli_arg(argc, argv, 0, "key", &keykex,NULL,NULL);
|
||||
|
||||
/* Ensure the Rhizome database exists and is open */
|
||||
if (create_serval_instance_dir() == -1)
|
||||
return -1;
|
||||
|
@ -30,6 +30,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
#define RHIZOME_FILEHASH_STRLEN (RHIZOME_FILEHASH_BYTES * 2)
|
||||
|
||||
#define RHIZOME_CRYPT_PAGE_SIZE 4096
|
||||
#define RHIZOME_CRYPT_KEY_BYTES crypto_stream_xsalsa20_ref_KEYBYTES
|
||||
|
||||
#define RHIZOME_HTTP_PORT 4110
|
||||
|
||||
|
@ -31,6 +31,12 @@ int rhizome_strn_is_manifest_id(const char *id)
|
||||
return 1;
|
||||
}
|
||||
|
||||
int rhizome_str_is_bundle_crypt_key(const char *id)
|
||||
{
|
||||
size_t len = strlen(id);
|
||||
return len == RHIZOME_CRYPT_KEY_BYTES * 2 && rhizome_strn_is_manifest_id(id);
|
||||
}
|
||||
|
||||
int rhizome_str_is_manifest_id(const char *id)
|
||||
{
|
||||
size_t len = strlen(id);
|
||||
|
Loading…
x
Reference in New Issue
Block a user