/** * check if user has a key pair, if not we create one * * @param string $uid userid * @param string $password user password * @return bool */ public function setupServerSide($uid, $password) { $this->keyManager->validateShareKey(); $this->keyManager->validateMasterKey(); // Check if user already has keys if (!$this->keyManager->userHasKeys($uid)) { return $this->keyManager->storeKeyPair($uid, $password, $this->crypt->createKeyPair()); } return true; }
/** * start to encrypt all files * * @param InputInterface $input * @param OutputInterface $output */ public function encryptAll(InputInterface $input, OutputInterface $output) { $this->input = $input; $this->output = $output; $headline = 'Encrypt all files with the ' . Encryption::DISPLAY_NAME; $this->output->writeln("\n"); $this->output->writeln($headline); $this->output->writeln(str_pad('', strlen($headline), '=')); $this->output->writeln("\n"); if ($this->util->isMasterKeyEnabled()) { $this->output->writeln('Use master key to encrypt all files.'); $this->keyManager->validateMasterKey(); } else { //create private/public keys for each user and store the private key password $this->output->writeln('Create key-pair for every user'); $this->output->writeln('------------------------------'); $this->output->writeln(''); $this->output->writeln('This module will encrypt all files in the users files folder initially.'); $this->output->writeln('Already existing versions and files in the trash bin will not be encrypted.'); $this->output->writeln(''); $this->createKeyPairs(); } //setup users file system and encrypt all files one by one (take should encrypt setting of storage into account) $this->output->writeln("\n"); $this->output->writeln('Start to encrypt users files'); $this->output->writeln('----------------------------'); $this->output->writeln(''); $this->encryptAllUsersFiles(); if ($this->util->isMasterKeyEnabled() === false) { //send-out or display password list and write it to a file $this->output->writeln("\n"); $this->output->writeln('Generated encryption key passwords'); $this->output->writeln('----------------------------------'); $this->output->writeln(''); $this->outputPasswords(); } $this->output->writeln("\n"); }
/** * make sure that all system keys exists */ public function setupSystem() { $this->keyManager->validateShareKey(); $this->keyManager->validateMasterKey(); }