modified:   base_node.py
	modified:   controller.py
	modified:   default.conf
	modified:   end-device.py
diff --git a/end-device.py b/end-device.py
index a78e3da..4754117 100644
--- a/end-device.py
+++ b/end-device.py
@@ -18,10 +18,14 @@
 # A copy of the GNU Lesser General Public License is in the file COPYING.
 
 import time
+import json
 from pyndn import Name
 from pyndn import Face
+from pyndn import Interest
+from pyndn import KeyLocator, KeyLocatorType
 from base_node import BaseNode
-from commands import CertificateRequestMessage
+from pyndn.security.security_exception import SecurityException
+
 
 def dump(*list):
     result = ""
@@ -56,52 +60,6 @@
         """
 
         #TODO: GENERATE A NEW PUBLIC/PRIVATE PAIR INSTEAD OF COPYING
-        makeKey = False
-        try:
-            defaultKey = self._identityStorage.getDefaultKeyNameForIdentity(keyIdentity)
-            newKeyName = defaultKey
-        except SecurityException:
-            defaultIdentity = self._keyChain.getDefaultIdentity()
-            defaultKey = self._identityStorage.getDefaultKeyNameForIdentity(defaultIdentity)
-            newKeyName = self._identityStorage.getNewKeyName(keyIdentity, True)
-            makeKey = True
-             
-        self.log.debug("Found key: " + defaultKey.toUri()+ " renaming as: " + newKeyName.toUri())
-
-        keyType = self._identityStorage.getKeyType(defaultKey)
-        keyDer = self._identityStorage.getKey(defaultKey)
-
-        if makeKey:
-            try:
-                privateDer = self._identityManager.getPrivateKey(defaultKey)
-            except SecurityException:
-                # XXX: is recovery impossible?
-                pass
-            else:
-                try:
-                    self._identityStorage.addKey(newKeyName, keyType, keyDer)
-                    self._identityManager.addPrivateKey(newKeyName, privateDer)
-                except SecurityException:
-                    # TODO: key shouldn't exist...
-                    pass
-
-        message = CertificateRequestMessage()
-        message.command.keyType = keyType
-        message.command.keyBits = keyDer.toRawStr()
-
-        for component in range(newKeyName.size()):
-            message.command.keyName.components.append(newKeyName.get(component).toEscapedString())
-
-        paramComponent = ProtobufTlv.encode(message)
-
-        interestName = Name(self._policyManager.getTrustRootIdentity()).append("certificateRequest").append(paramComponent)
-        interest = Interest(interestName)
-        interest.setInterestLifetimeMilliseconds(10000) # takes a tick to verify and sign
-        self._hmacHandler.signInterest(interest, keyName=self.prefix)
-
-        self.log.info("Sending certificate request to controller")
-        self.log.debug("Certificate request: "+interest.getName().toUri())
-        self.face.expressInterest(interest, self._onCertificateReceived, self._onCertificateTimeout)
 
 if __name__ == '__main__':
     face = Face("")
@@ -109,13 +67,27 @@
     device = Device("default.conf")
     
     symKey = "symmetricKeyForBootStrapping"
-    bootStrapName = Name("/home/controller/bootstrap/light/id1/"+symKey)
-    dump("Express name ",bootStrapName.toUri())
-    
-    face.expressInterest(bootStrapName, device.onData, device.onTimeout)
+    bootStrapName = Name("/home/controller/bootstrap")
 
+    deviceParameters = {}
+    deviceParameters["category"] = "sensors"
+    deviceParameters["id"] = "T123456789"
+    bootStrapName.append(json.dumps(deviceParameters))
 
-    while device._callbackCount < 10:
+    bootStrapInterest = Interest(bootStrapName)
+
+    bootStrapInterest.setInterestLifetimeMilliseconds(5000)
+
+    bootStrapKeyLocator = KeyLocator()
+    bootStrapKeyLocator.setType(KeyLocatorType.KEY_LOCATOR_DIGEST)
+    bootStrapKeyLocator.setKeyData(symKey)
+    bootStrapInterest.setKeyLocator(bootStrapKeyLocator)
+
+    dump("Express interest ",bootStrapInterest.toUri())
+    face.expressInterest(bootStrapInterest, device.onData, device.onTimeout)
+     
+
+    while device._callbackCount < 100:
         face.processEvents()
         # We need to sleep for a few milliseconds so we don't use 100% of the CPU.
         time.sleep(0.01)