Commit 72134e20 authored by yids's avatar yids

now there is pl_load_keypair that loads a keypair, and...

now there is pl_load_keypair that loads a keypair, and pl_load_keypair_from_file that loads a keypair from file
parent d7500ff4
......@@ -69,7 +69,7 @@ int quit()
int main()
{
ctx = pl_init();
pl_load_keypair(ctx, "tx");
pl_load_keypair_from_file(ctx, "tx");
pl_load_public_keys_from_folder(ctx, "pubkeys");
......
......@@ -16,7 +16,7 @@ int main ()
rx_ctx = pl_init();
/*load keypair */
pl_load_keypair(rx_ctx, "disa");
pl_load_keypair_from_file(rx_ctx, "rx");
pl_load_key_in_list(rx_ctx, rx_ctx->kp);
pl_print_keylist(rx_ctx);
......
......@@ -28,7 +28,7 @@ int main()
tx_ctx = pl_init();
/* load keypair */
pl_load_keypair(tx_ctx, "tx");
pl_load_keypair_from_file(tx_ctx, "tx");
/*load public key of receiver*/
char *pubkey;
......@@ -57,7 +57,7 @@ int main()
printf("SEND: unknown error \n");
break;
}
// write(STDOUT_FILENO,tx_ctx->msg, sizeof(struct pl_pagermessage)); // dump to stdout
write(STDOUT_FILENO,tx_ctx->msg, sizeof(struct pl_pagermessage)); // dump to stdout
// pl_cleanup(tx_ctx);
// free(pubkey);
////// RRRRXXXX /////////
......
......@@ -277,7 +277,7 @@ int pl_save_key(struct pl_keypair *key, char *filename)
#endif
}
int pl_load_keypair(struct pl_ctx *ctx, char *filename)
int pl_load_keypair_from_file(struct pl_ctx *ctx, char *filename)
{
struct pl_keypair *keypair;
#ifdef ARDUINO
......@@ -294,6 +294,12 @@ int pl_load_keypair(struct pl_ctx *ctx, char *filename)
#endif
}
int pl_load_keypair(struct pl_ctx *ctx, struct pl_keypair *kp)
{
memcpy(ctx->kp, kp, sizeof(struct pl_keypair));
return 0;
}
int pl_save_public_key(char *pubkey, char *filename)
{
#ifdef ARDUINO
......
......@@ -109,7 +109,8 @@ int pl_send_message_fifo(struct pl_ctx *ctx, char *fifo);
int pl_receive_message(struct pl_ctx*);
int pl_save_key(struct pl_keypair *key, char * filename);
int pl_load_keypair(struct pl_ctx *ctx, char *filename);
int pl_load_keypair_from_file(struct pl_ctx *ctx, char *filename);
int pl_load_keypair(struct pl_ctx *ctx, struct pl_keypair *kp);
int pl_save_public_key(char pubkey[crypto_box_PUBLICKEYBYTES], char *filename);
char *pl_load_public_key(char *filename);
int pl_print_keylist(struct pl_ctx *ctx);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment