* @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');
* @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));
// 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)));