Adding Verified Key to List and Check List First
diff --git a/nlsr_ndn.c b/nlsr_ndn.c
index 3a724d5..2fdf091 100644
--- a/nlsr_ndn.c
+++ b/nlsr_ndn.c
@@ -510,14 +510,34 @@
if ( contain_key_name(info->content_ccnb, info->pco) == 1){
+ int res_verify=-1;
+ int key_exists=0;
+ struct ccn_charbuf *key_name=get_key_name(info->content_ccnb, info->pco);
+ struct ccn_charbuf *key_uri = ccn_charbuf_create();
+ ccn_uri_append(key_uri, key_name->buf, key_name->length, 0);
+ key_exists=does_key_exist(ccn_charbuf_as_string(key_uri));
+ int key_type=get_key_type_from_key_name(key_name);
+
+ if ( res_verify == 1 && key_type == NLSR_KEY ){
+ res_verify=0;
+ }
+ else{
+ res_verify=verify_key(info->content_ccnb,info->pco,0);
+ }
- int res_verify=verify_key(info->content_ccnb,info->pco,0);
+ //int res_verify=verify_key(info->content_ccnb,info->pco,0);
if ( res_verify != 0 ){
if ( nlsr->debugging )
printf("Error in verfiying keys !! :( \n");
+ ccn_charbuf_destroy(&key_name);
+ ccn_charbuf_destroy(&key_uri);
}
else{
+ if ( key_exists == 0 )
+ add_key(ccn_charbuf_as_string(key_uri));
+ ccn_charbuf_destroy(&key_name);
+ ccn_charbuf_destroy(&key_uri);
if ( nlsr->debugging )
printf("Key verification is successful :)\n");
update_adjacent_timed_out_zero_to_adl(nbr);