From 9171faffa5f44a149660fb81a626e09a8b460672 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Roland=20H=C3=A4der?= Date: Fri, 22 Feb 2013 05:34:42 +0000 Subject: [PATCH] Now correct class :( --- application/hub/main/nodes/class_BaseHubNode.php | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/application/hub/main/nodes/class_BaseHubNode.php b/application/hub/main/nodes/class_BaseHubNode.php index 898f925d7..4156847bb 100644 --- a/application/hub/main/nodes/class_BaseHubNode.php +++ b/application/hub/main/nodes/class_BaseHubNode.php @@ -115,8 +115,8 @@ class BaseHubNode extends BaseHubSystem implements Updateable, AddableCriteria { * @todo Make this code more generic and move it to CryptoHelper or */ protected function generateRamdomString ($length) { - // Get an RNG instance - $rngInstance = ObjectFactory::createObjectByConfiguredName('rng_class'); +// Get an RNG instance +$rngInstance = ObjectFactory::createObjectByConfiguredName('rng_class'); // Generate a pseudo-random string $randomString = $rngInstance->randomString($length) . ':' . $this->getBootIpPort() . ':' . $this->getRequestInstance()->getRequestElement('mode'); @@ -135,8 +135,11 @@ class BaseHubNode extends BaseHubSystem implements Updateable, AddableCriteria { * @return void */ private function generatePrivateKeyAndHash (LocalSearchCriteria $searchInstance) { + // Get an RNG instance + $rngInstance = ObjectFactory::createObjectByConfiguredName('rng_class'); + // Generate a pseudo-random string - $randomString = $this->getCryptoInstance()->randomString(255); + $randomString = $rngInstance->randomString(255); // Hash and encrypt the string so we become a node id (also documented as "hub id") $this->setPrivateKey($this->getCryptoInstance()->encryptString($randomString)); @@ -285,8 +288,11 @@ class BaseHubNode extends BaseHubSystem implements Updateable, AddableCriteria { // Output message self::createDebugInstance(__CLASS__)->debugOutput('BOOTSTRAP: Re-using found node-id: ' . $this->getNodeId() . ''); } else { + // Get an RNG instance + $rngInstance = ObjectFactory::createObjectByConfiguredName('rng_class'); + // Generate a pseudo-random string - $randomString = $this->getCryptoInstance()->randomString(255); + $randomString = $rngInstance->randomString(255); // Hash and encrypt the string so we become a node id (also documented as "hub id") $this->setNodeId($this->getCryptoInstance()->hashString($this->getCryptoInstance()->encryptString($randomString))); -- 2.39.5