Add bsk to correct command

This commit is contained in:
Jeremy Lakeman 2013-01-04 10:44:07 +10:30
parent 28a05baa54
commit fd96c5bd76
3 changed files with 22 additions and 3 deletions

View File

@ -1969,9 +1969,9 @@ struct command_line_option command_line_options[]={
"Import a payload/manifest pair into Rhizome"},
{app_rhizome_list,{"rhizome","list","<pin,pin...>","[<service>]","[<sender_sid>]","[<recipient_sid>]","[<offset>]","[<limit>]",NULL},CLIFLAG_STANDALONE,
"List all manifests and files in Rhizome"},
{app_rhizome_extract_manifest,{"rhizome","extract","manifest","<manifestid>","[<manifestpath>]","[<pin,pin...>]","[<bsk>]",NULL},CLIFLAG_STANDALONE,
{app_rhizome_extract_manifest,{"rhizome","extract","manifest","<manifestid>","[<manifestpath>]","[<pin,pin...>]",NULL},CLIFLAG_STANDALONE,
"Extract a manifest from Rhizome and write it to the given path"},
{app_rhizome_extract_file,{"rhizome","extract","file","<manifestid>","[<filepath>]","[<pin,pin...>]",NULL},CLIFLAG_STANDALONE,
{app_rhizome_extract_file,{"rhizome","extract","file","<manifestid>","[<filepath>]","[<pin,pin...>]","[<bsk>]",NULL},CLIFLAG_STANDALONE,
"Extract a file from Rhizome and write it to the given path"},
{app_rhizome_extract_file,{"rhizome","dump","file","<fileid>","[<filepath>]",NULL},CLIFLAG_STANDALONE,
"Extract a file from Rhizome and write it to the given path without attempting decryption"},

View File

@ -245,7 +245,8 @@ int rhizome_extract_privatekey(rhizome_manifest *m, rhizome_bk_t *bsk)
RETURN(result);
}else if(bsk && !rhizome_is_bk_none(bsk)){
memcpy(m->cryptoSignSecret, bsk, RHIZOME_BUNDLE_KEY_BYTES);
bcopy(m->cryptoSignPublic, &m->cryptoSignSecret[RHIZOME_BUNDLE_KEY_BYTES], sizeof(m->cryptoSignPublic));
bcopy(bsk, m->cryptoSignSecret, RHIZOME_BUNDLE_KEY_BYTES);
RETURN(rhizome_verify_bundle_privatekey(m,m->cryptoSignSecret,
m->cryptoSignPublic));
}else{

View File

@ -85,6 +85,24 @@ test_AddNoAuthor() {
assertGrep --matches=0 file1.manifest '^BK='
}
doc_AddNoAuthor="Add encrypted payload with no author"
setup_AddNoAuthor() {
setup_servald
setup_rhizome
echo "A test file" >file1
echo "crypt=1" >file1.manifest
}
test_AddNoAuthor() {
executeOk_servald rhizome add file '' '' file1 file1.manifest
tfw_cat --stdout --stderr
assert_stdout_add_file file1
extract_stdout_secret file1_secret
assertGrep --matches=0 file1.manifest '^BK='
executeOk_servald rhizome extract file $re_manifestid file1x '' $file1_secret
tfw_cat --stdout --stderr
assert diff file1 file1x
}
doc_AddNonExistManifest="Add with non-existent manifest file"
setup_AddNonExistManifest() {
setup_servald