Example #1
0
 /**
  * This method create new public and private key and encrypt the private key with a encryption technique with another key know only by the user.
  * @param UserInterface The user for who we want create the new key.
  * @param string The key use to encrypt the private key.
  */
 public function encryptKey(UserInterface $user, $keyClear)
 {
     $generateKey = new $this->generateKeyClassName();
     $user->setPublicKey($generateKey->getPublicKey());
     $user->setPrivateKey($this->encryptionSystemForPrivateKey->encrypt($generateKey->getPrivateKey(), $keyClear));
     $user->setHashKeyForPrivateKey($this->hashKey($keyClear));
 }