diff --git a/nlsr_km.c b/nlsr_km.c
new file mode 100644
index 0000000..2bfa8fa
--- /dev/null
+++ b/nlsr_km.c
@@ -0,0 +1,219 @@
+#include<stdio.h>
+#include<string.h>
+#include<stdlib.h>
+#include <unistd.h>
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+
+#include <ccn/ccn.h>
+#include <ccn/uri.h>
+#include <ccn/keystore.h>
+#include <ccn/signing.h>
+#include <ccn/schedule.h>
+#include <ccn/hashtb.h>
+
+#include "nlsr.h"
+#include "nlsr_km.h"
+#include "nlsr_km_util.h"
+
+int
+sign_content_with_user_defined_keystore(struct ccn_charbuf *content_name,
+										struct ccn_charbuf *resultbuf,
+										const void *data,
+										size_t data_size,
+										char *keystore_path,
+										char *keystore_passphrase,
+										char *key_repo_name,
+										char *site_name,
+										char *router_name){
+	
+	printf("sign_content_with_user_defined_keystore called\n");
+
+	
+	int res;
+
+
+	struct ccn_charbuf * pubid_out=ccn_charbuf_create();
+	struct ccn_charbuf * keyname;
+
+	
+	struct ccn_keystore *keystore = NULL;
+	keystore=ccn_keystore_create();
+	res=ccn_keystore_init(keystore, keystore_path,keystore_passphrase );
+	if ( res < 0 ){
+		printf("Error in initiating keystore :(\n");
+		ccn_keystore_destroy(&keystore);
+		return -1;
+	}
+	
+
+	res=ccn_load_private_key	(nlsr->ccn,
+							keystore_path,
+							"Th1s1sn0t8g00dp8ssw0rd.",
+							pubid_out);
+
+	if(res < 0 ){
+		printf("Error in loading keystore :( \n");
+		ccn_charbuf_destroy(&pubid_out);
+		return -1;
+	}
+
+	char *baseuri=(char *)calloc(strlen(key_repo_name)+strlen(site_name)+
+				  strlen(router_name)+strlen("/%C1.R.N.Start")+5,sizeof(char));
+	memcpy(baseuri,key_repo_name,strlen(key_repo_name)+1);
+	memcpy(baseuri+strlen(baseuri),"/",1);
+	memcpy(baseuri+strlen(baseuri),site_name,strlen(site_name)+1);
+	memcpy(baseuri+strlen(baseuri),"/%C1.R.N.Start",strlen("/%C1.R.N.Start"));
+	memcpy(baseuri+strlen(baseuri),router_name,strlen(router_name)+1);
+	baseuri[strlen(baseuri)]='\0';
+	
+
+	keyname=ccn_charbuf_create();
+	if(keyname == NULL ){
+		ccn_charbuf_destroy(&pubid_out);
+		free(baseuri);
+		return -1;
+	}
+	ccn_name_from_uri(keyname,baseuri);
+	if ( res < 0 ){
+		printf("Bad URI format: %s\n",baseuri);
+		ccn_charbuf_destroy(&pubid_out);
+		ccn_charbuf_destroy(&keyname);
+		free(baseuri);
+		return -1;		
+	}
+		
+	ccn_name_append_str(keyname,"nlsr");
+	struct ccn_charbuf *keyid = ccn_charbuf_create();
+	ccn_charbuf_append_value(keyid, CCN_MARKER_CONTROL, 1);
+	ccn_charbuf_append_string(keyid, ".M.K");
+	ccn_charbuf_append_value(keyid, 0, 1);
+	ccn_charbuf_append_charbuf(keyid, pubid_out);
+	ccn_name_append(keyname, keyid->buf, keyid->length);
+	
+	
+
+	struct ccn_charbuf *uri = ccn_charbuf_create();
+	ccn_uri_append(uri, keyname->buf, keyname->length, 0);
+	printf("Key Name Included when processing content: %s\n", ccn_charbuf_as_string(uri));
+	ccn_charbuf_destroy(&uri);	
+
+	struct ccn_signing_params sp = CCN_SIGNING_PARAMS_INIT;
+	sp.type = CCN_CONTENT_DATA;
+ 	sp.template_ccnb = ccn_charbuf_create();
+  	ccn_charbuf_append_tt(sp.template_ccnb, CCN_DTAG_SignedInfo, CCN_DTAG);
+	ccn_charbuf_append_tt(sp.template_ccnb, CCN_DTAG_KeyLocator, CCN_DTAG);
+  	ccn_charbuf_append_tt(sp.template_ccnb, CCN_DTAG_KeyName, CCN_DTAG);
+  	ccn_charbuf_append(sp.template_ccnb, keyname->buf, keyname->length); 
+	ccn_charbuf_append_closer(sp.template_ccnb); // KeyName closer
+  	ccn_charbuf_append_closer(sp.template_ccnb); // KeyLocator closer
+  	ccn_charbuf_append_closer(sp.template_ccnb); // SignedInfo closer
+	
+	sp.sp_flags |= CCN_SP_TEMPL_KEY_LOCATOR;
+	sp.sp_flags |= CCN_SP_FINAL_BLOCK;
+	sp.freshness = 60;
+
+
+	if (pubid_out->length != sizeof(sp.pubid)){
+		printf("Size of pubid and sp.pubid is not equal");
+		ccn_charbuf_destroy(&keyname);
+		ccn_charbuf_destroy(&pubid_out);
+		free(baseuri);
+		return -1;
+	}
+	
+	memcpy(sp.pubid, pubid_out->buf, pubid_out->length);
+	
+
+
+	res=ccn_sign_content(nlsr->ccn,resultbuf,content_name,&sp,data,data_size);
+	if( res < 0 ){
+		printf("Content signing error \n");
+		ccn_charbuf_destroy(&sp.template_ccnb);
+		ccn_charbuf_destroy(&keyid);
+		ccn_charbuf_destroy(&keyname);
+		ccn_charbuf_destroy(&pubid_out);
+		free(baseuri);
+ 		return -1;
+	}
+
+	ccn_charbuf_destroy(&sp.template_ccnb);
+	ccn_charbuf_destroy(&keyid);
+	ccn_charbuf_destroy(&keyname);
+	ccn_charbuf_destroy(&pubid_out);
+	free(baseuri);
+ 	return 0;
+}
+
+
+/*
+int
+process_incoming_content(struct ccn_closure* selfp, 
+												struct ccn_upcall_info* info){
+
+	printf("process_incoming_content called\n");
+
+	int res=verify_key(info->content_ccnb,info->pco->offset[CCN_PCO_E],info->pco);
+
+	if ( res != 0 ){
+		printf("Error in verfiying keys !! :( \n");
+	}
+	else{
+		printf("Key verification is successful :)\n");
+	}
+	return 0;
+}
+*/
+
+int 
+verify_key(const unsigned char *ccnb,size_t size, 
+										struct ccn_parsed_ContentObject *pco){
+
+	printf("verify key called\n");
+	int ret=-1;
+
+	if ( contain_key_name(ccnb, pco) == 1){
+		
+		struct ccn_charbuf *key_name=get_key_name(ccnb, pco);
+		struct ccn_charbuf *key_uri = ccn_charbuf_create();
+		ccn_uri_append(key_uri, key_name->buf, key_name->length, 0);
+		printf("Key Name from Incoming Content: %s\n",ccn_charbuf_as_string(key_uri));
+		int res=get_key_type_from_key_name(key_name);		
+		printf("Key Type: %d \n",res);
+
+		struct ccn_charbuf *result = ccn_charbuf_create();
+		struct ccn_parsed_ContentObject temp_pco = {0};
+		int get_flags = 0;
+		get_flags |= CCN_GET_NOKEYWAIT;
+		int counter = 0;
+		while(ccn_get(nlsr->ccn, key_name, NULL, 500, result, &temp_pco, NULL, 
+										get_flags) < 0 && counter < 3) counter++;
+
+		int chk_verify=ccn_verify_content(nlsr->ccn,ccnb,pco);		
+
+		if ( chk_verify == 0 ){
+			printf("Verification Successful :)\n");
+
+			if ( counter == 3){
+				printf("Could not retrieve key by name !!!\n");
+			}
+			else{
+				if ( res == ROOT_KEY ){
+					ret=0;
+				}
+				else{
+					ret=verify_key(result->buf,temp_pco.offset[CCN_PCO_E],&temp_pco);
+				}
+			}
+		}
+		ccn_charbuf_destroy(&result);
+		ccn_charbuf_destroy(&key_uri);
+		ccn_charbuf_destroy(&key_name);
+		return ret;
+	}
+
+	return ret;
+}
+
diff --git a/nlsr_km.h b/nlsr_km.h
new file mode 100644
index 0000000..f509bc8
--- /dev/null
+++ b/nlsr_km.h
@@ -0,0 +1,35 @@
+#ifndef _NLSR_KM_H_
+#define _NLSR_KM_H_
+
+enum key_type{
+	ROOT_KEY, //0
+	SITE_KEY, //1
+	OPERATOR_KEY,//2
+	ROUTING_KEY,//3
+	NLSR_KEY,//4
+	UNKNOWN_KEY//5
+};
+
+
+
+
+int
+sign_content_with_user_defined_keystore(struct ccn_charbuf *content_name,
+										struct ccn_charbuf *resultbuf,
+										const void *data,
+										size_t data_size,
+										char *keystore_path,
+										char *keystore_passphrase,
+										char *key_repo_name,
+										char *site_name,
+										char *router_name);
+
+int	contain_key_name(const unsigned char *ccnb, 
+					struct ccn_parsed_ContentObject *pco);
+struct ccn_charbuf * get_key_name(const unsigned char *ccnb, 
+					struct ccn_parsed_ContentObject *pco);
+
+int verify_key(const unsigned char *ccnb, size_t size, 
+					struct ccn_parsed_ContentObject *pco);
+
+#endif
diff --git a/nlsr_km_util.c b/nlsr_km_util.c
new file mode 100644
index 0000000..ee55252
--- /dev/null
+++ b/nlsr_km_util.c
@@ -0,0 +1,169 @@
+#include<stdio.h>
+#include<string.h>
+#include<stdlib.h>
+#include <unistd.h>
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+
+#include <ccn/ccn.h>
+#include <ccn/uri.h>
+#include <ccn/keystore.h>
+#include <ccn/signing.h>
+#include <ccn/schedule.h>
+#include <ccn/hashtb.h>
+
+
+#include "nlsr.h"
+#include "nlsr_km_util.h"
+#include "nlsr_km.h"
+
+int
+appendLifetime(struct ccn_charbuf *cb, int lifetime) 
+{
+	unsigned char buf[sizeof(int32_t)];
+	int32_t dreck = lifetime << 12;
+	int pos = sizeof(int32_t);
+	int res = 0;
+	while (dreck > 0 && pos > 0) 
+	{
+		pos--;
+		buf[pos] = dreck & 255;
+		dreck = dreck >> 8;
+	}
+	res |= ccnb_append_tagged_blob(cb, CCN_DTAG_InterestLifetime, buf+pos, 
+															sizeof(buf)-pos);
+	return res;
+}
+
+int
+contain_key_name(const unsigned char *ccnb, struct ccn_parsed_ContentObject *pco) 
+{
+	if (pco->offset[CCN_PCO_B_KeyLocator] == pco->offset[CCN_PCO_E_KeyLocator])
+		return -1;
+
+	struct ccn_buf_decoder decoder;
+	struct ccn_buf_decoder *d;
+	d = ccn_buf_decoder_start(&decoder, ccnb + 
+		pco->offset[CCN_PCO_B_Key_Certificate_KeyName], 
+		pco->offset[CCN_PCO_E_Key_Certificate_KeyName] - 
+		pco->offset[CCN_PCO_B_Key_Certificate_KeyName]);
+	if (ccn_buf_match_dtag(d, CCN_DTAG_KeyName))
+		return 1;
+
+	return -1;
+}
+
+struct ccn_charbuf *
+get_key_name(const unsigned char *ccnb, struct ccn_parsed_ContentObject *pco) 
+{
+	struct ccn_charbuf *key_name = ccn_charbuf_create();
+	ccn_charbuf_append(key_name, ccnb + pco->offset[CCN_PCO_B_KeyName_Name], 
+	pco->offset[CCN_PCO_E_KeyName_Name] - pco->offset[CCN_PCO_B_KeyName_Name]);
+
+	return key_name;
+}
+
+int
+check_for_name_component_in_name(const struct ccn_charbuf *name, 
+								const struct ccn_indexbuf *indx,
+								const char *component){
+	
+	int res,i;
+	int result_position=0;
+	int name_comps=(int)indx->n;
+
+	for(i=0;i<name_comps;i++){
+		res=ccn_name_comp_strcmp(name->buf,indx,i,component);
+		if( res == 0){
+			
+				result_position=i;
+				break;
+		}	
+	}
+
+	return result_position;
+}
+
+
+int
+check_for_tag_component_in_name(const struct ccn_charbuf *name, 
+								const struct ccn_indexbuf *indx,
+								const char *component){
+	
+	int res,i;
+	int result_position=0;
+	int name_comps=(int)indx->n;
+
+	for(i=0;i<name_comps;i++){
+		const unsigned char *comp_ptr;
+		size_t comp_size;
+		res=ccn_name_comp_get(name->buf, indx,i,&comp_ptr, &comp_size);
+		if( res == 0){
+			if ( strstr((char *)comp_ptr,component) != NULL ){
+				result_position=i;
+				break;
+			}
+		}	
+	}
+
+	return result_position;
+}
+
+enum key_type
+get_key_type_from_key_name(struct ccn_charbuf *keyname)
+{
+	printf("get_key_type_from_key_name called\n");
+
+	int res;
+	int return_key=UNKNOWN_KEY;	
+
+	struct ccn_indexbuf *indx=ccn_indexbuf_create();
+	if ( indx == NULL ){
+		printf("Error in creating index for key name \n");
+		return UNKNOWN_KEY;
+	}
+
+	res=ccn_name_split(keyname,indx);
+	if ( res < 0 ){
+		printf("Error in parsing key name \n");
+		ccn_indexbuf_destroy(&indx);
+		return UNKNOWN_KEY;
+	}
+	else if ( res == 3){
+		int chk_ndn=check_for_name_component_in_name(keyname,indx,"ndn");
+		int chk_key=check_for_name_component_in_name(keyname,indx,"keys");
+		if ( chk_ndn == 0 && chk_key == 1)
+			return_key=ROOT_KEY;
+	}
+	else{
+		int check_op,check_rt;
+		check_op=check_for_tag_component_in_name(keyname,indx,
+													 "O.N.Start");
+		check_rt=check_for_tag_component_in_name(keyname,indx,
+													 "R.N.Start");
+		if ( check_op > 0){
+			return_key=OPERATOR_KEY;
+		}
+		else if(check_rt >0){
+			int check_nlsr;
+			check_nlsr=check_for_name_component_in_name(keyname,indx,
+													 "nlsr");
+			if ( check_rt > 0 ){
+				if ( check_nlsr > 0){
+					return_key=NLSR_KEY;
+				}
+				else{
+					return_key=ROUTING_KEY;
+				}
+			}
+		}
+		else if ( check_rt == 0 && check_op == 0 && res > 3){
+			return_key=SITE_KEY;
+		}
+	}
+
+	ccn_indexbuf_destroy(&indx);
+	return return_key;
+}
diff --git a/nlsr_km_util.h b/nlsr_km_util.h
new file mode 100644
index 0000000..8ad001f
--- /dev/null
+++ b/nlsr_km_util.h
@@ -0,0 +1,27 @@
+#ifndef _NLSR_KM_UTIL_H_
+#define _NLSR_KM_UTIL_H_
+
+int
+contain_key_name(const unsigned char *ccnb, 
+				struct ccn_parsed_ContentObject *pco);
+
+struct ccn_charbuf *
+get_key_name(const unsigned char *ccnb, 
+				struct ccn_parsed_ContentObject *pco);
+
+int
+check_for_name_component_in_name(const struct ccn_charbuf *name, 
+								const struct ccn_indexbuf *indx,
+								const char *component);
+int
+check_for_tag_component_in_name(const struct ccn_charbuf *name, 
+								const struct ccn_indexbuf *indx,
+								const char *component);
+enum key_type
+get_key_type_from_key_name(struct ccn_charbuf *keyname); 
+
+
+int
+appendLifetime(struct ccn_charbuf *cb, int lifetime);
+
+#endif
