コード例 #1
0
ファイル: DecryptCommand.php プロジェクト: aoepeople/vault
 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}");
 }
コード例 #2
0
ファイル: PrivateKey.php プロジェクト: AOEpeople/AwsInspector
 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);
 }