diff --git a/end-device.py b/end-device.py
index fb97a23..a77dc47 100644
--- a/end-device.py
+++ b/end-device.py
@@ -22,6 +22,7 @@
 from pyndn import Name, Face, Interest, Data, ThreadsafeFace
 from pyndn import KeyLocator, KeyLocatorType
 from base_node import BaseNode
+from hmac_helper import HmacHelper 
 from pyndn.security.security_exception import SecurityException
 from pyndn.util import Blob
 try:
@@ -44,6 +45,7 @@
         self._symKey = "symmetricKeyForBootstrapping"
         self._category = "sensors"
         self._id = "T9273659"
+        self._hmacHelper = HmacHelper(self._symKey)
 
 
     def expressBootstrapInterest(self):
@@ -53,59 +55,73 @@
 
         deviceParameters = {}
         deviceParameters["category"] = self._category
-        deviceParameters["id"] = self._deviceSerial
+        deviceParameters["id"] = self._id
         bootstrapName.append(json.dumps(deviceParameters))
 
         bootstrapInterest = Interest(bootstrapName)
         bootstrapInterest.setInterestLifetimeMilliseconds(5000)
-        bootstrapKeyLocator = KeyLocator()
-        bootstrapKeyLocator.setType(KeyLocatorType.KEY_LOCATOR_DIGEST)
-        bootstrapKeyLocator.setKeyData(self._symKey)
-        bootstrapInterest.setKeyLocator(bootstrapKeyLocator)
+        #bootstrapKeyLocator = KeyLocator()
+        #bootstrapKeyLocator.setType(KeyLocatorType.KEY_LOCATOR_DIGEST)
+        #bootstrapKeyLocator.setKeyData(self._symKey)
+        #bootstrapInterest.setKeyLocator(bootstrapKeyLocator)
+        self._hmacHelper.signInterest(bootstrapInterest)
 
         dump("Express bootstrap interest : ",bootstrapInterest.toUri())
         self.face.expressInterest(bootstrapInterest, self.onBootstrapData, self.onTimeout)
+    def onInterest():
+        pass
+    def onRegisterFailed():
+	pass
     
     def onBootstrapData(self, interest, data):
         dump("Bootstrap data received.")
-        content = json.loads(data.getContent().toRawStr(), encoding="latin-1")
-        deviceNewIdentity = Name(content["deviceNewIdentity"])
-        controllerIdentity = Name(content["controllerIdentity"])
-        controllerPublicKeyInfo = content["controllerPublicKey"]
 
-        #set new identity as default and generate default key-pair with KSK Certificate
-        self._identityStorage.addIdentity(deviceNewIdentity)
-        self._identityManager.setDefaultIdentity(deviceNewIdentity)
-        try:
-            self._identityManager.getDefaultKeyNameForIdentity(deviceNewIdentity)
-        except SecurityException:
-            #generate new key-pair and certificate for new identity
-            dump("Install new identity as default\nGenerate new key-pair and self signed certificate")
-            newKey = self._identityManager.generateRSAKeyPairAsDefault(Name(deviceNewIdentity), isKsk=True)
-            newCert = self._identityManager.selfSign(newKey)
-            self._identityManager.addCertificateAsIdentityDefault(newCert)
+        if (self._hmacHelper.verifyData(data)):
+            self.log.info("Bootstrap data is verified")
+            content = json.loads(data.getContent().toRawStr(), encoding="latin-1")
+            deviceNewIdentity = Name(content["deviceNewIdentity"])
+            controllerIdentity = Name(content["controllerIdentity"])
+            controllerPublicKeyInfo = content["controllerPublicKey"]
+
+            self.face.registerPrefix(content["deviceNewIdentity"],self.onInterest,self.onRegisterFailed)
+            #set new identity as default and generate default key-pair with KSK Certificate
+            self._identityStorage.addIdentity(deviceNewIdentity)
+            self._identityManager.setDefaultIdentity(deviceNewIdentity)
+            try:
+                self._identityManager.getDefaultKeyNameForIdentity(deviceNewIdentity)
+            except SecurityException:
+                #generate new key-pair and certificate for new identity
+                dump("Install new identity as default\nGenerate new key-pair and self signed certificate")
+                newKey = self._identityManager.generateRSAKeyPairAsDefault(Name(deviceNewIdentity), isKsk=True)
+                newCert = self._identityManager.selfSign(newKey)
+                self._identityManager.addCertificateAsIdentityDefault(newCert)
+            
+            #add controller's identity and public key
+            keyType = controllerPublicKeyInfo["keyType"]
+            keyName = Name(controllerPublicKeyInfo["keyName"])
+            keyDer = Blob().fromRawStr(controllerPublicKeyInfo["publicKeyDer"])
+            dump("Controller's KeyType: ",keyType)
+            dump("Controller's keyName: ",keyName)
+            dump("Controller public key der : ",keyDer)
+
+            self._identityStorage.addIdentity(controllerIdentity)
+            try:
+                self._identityStorage.addKey(keyName, keyType, keyDer)
+                dump("Controller's identity, key and certificate installled.")
+            except SecurityException:
+                dump("Controller's identity, key, certificate already exists.")
+
+            #express an certificate request interest
+            defaultKeyName = self._identityManager.getDefaultKeyNameForIdentity(self._keyChain.getDefaultIdentity() )
+            self.requestCertificate(defaultKeyName)
+        else:
+            self.log.info("Bootstrap data is not verified")
         
-        #add controller's identity and public key
-        keyType = controllerPublicKeyInfo["keyType"]
-        keyName = Name(controllerPublicKeyInfo["keyName"])
-        keyDer = Blob().fromRawStr(controllerPublicKeyInfo["publicKeyDer"])
-        dump("Controller's KeyType: ",keyType)
-        dump("Controller's keyName: ",keyName)
-        dump("Controller public key der : ",keyDer)
-
-        self._identityStorage.addIdentity(controllerIdentity)
-        try:
-            self._identityStorage.addKey(keyName, keyType, keyDer)
-            dump("Controller's identity, key and certificate installled.")
-        except SecurityException:
-            dump("Controller's identity, key, certificate already exists.")
-
-        #express an certificate request interest
-        defaultKeyName = self._identityManager.getDefaultKeyNameForIdentity(self._keyChain.getDefaultIdentity() )
-        self.requestCertificate(defaultKeyName)
+        
 
 
     def beforeLoopStart(self):
+        #self.face.registerPrefix('/', self.onInterest, self.onRegisterFailed)
         self.expressBootstrapInterest()
         
     def onTimeout(self, interest):
@@ -135,10 +151,14 @@
         certificateRequestName.append(json.dumps(keyInfo, encoding="latin-1"))
 
         certificateRequestName.append("ID-CERT")
+
+        certificateRequest = Interest(certificateRequestName)
+        certificateRequest.setInterestLifetimeMilliseconds(5000)
+        self._hmacHelper.signInterest(certificateRequest)
         
         dump("Sending certificate request : ",certificateRequestName)
 
-        self.face.expressInterest(Interest(certificateRequestName), self.onCertificateData, self.onTimeout)
+        self.face.expressInterest(certificateRequest, self.onCertificateData, self.onTimeout)
         #TODO use symmetric key to sign
         
     def onCertificateData(self, interest, data):
@@ -147,7 +167,7 @@
 
 if __name__ == '__main__':
 
-    device = Device("default.conf")
+    device = Device("tmp.conf")
     device.start()
     
     
