protected function execute(InputInterface $input, OutputInterface $output) { $encryptedFilePath = $input->getArgument('encryptedFilePath'); $plainTextFilePath = $input->getArgument('plainTextFilePath'); $vault = new Vault(); $vault->decryptFile($encryptedFilePath, $plainTextFilePath); $output->writeln("File written: {$plainTextFilePath}"); }
protected function __construct($privateKeyFile) { if (is_file($privateKeyFile)) { $this->privateKeyFile = $privateKeyFile; } else { $encryptedPrivateKeyFile = $privateKeyFile . '.encrypted'; $this->privateKeyFile = $privateKeyFile . '.unlocked'; if (is_file($encryptedPrivateKeyFile)) { if (class_exists('\\Vault\\Vault')) { $vault = new Vault(); $vault->decryptFile($encryptedPrivateKeyFile, $this->privateKeyFile); chmod($this->privateKeyFile, 0600); $this->unlocked = true; } else { throw new \Exception('Please install aoepeople/vault'); } } else { throw new \Exception('Could not find private key file ' . $privateKeyFile); } } $this->privateKeyFile = realpath($this->privateKeyFile); }