コード例 #1
0
ファイル: CryptoController.php プロジェクト: humansky/qframe
 /**
  * Import action.  Imports a key and redirects back to the index action.
  */
 public function importAction()
 {
     $name = $this->_getParam('name');
     $key = $this->_getParam('key');
     CryptoModel::importRijndael256Key($name, $key);
     $this->flash('notice', 'New key successfully created');
     $this->_redirector->gotoRoute(array('action' => 'index'));
 }
コード例 #2
0
ファイル: CryptoModelTest.php プロジェクト: humansky/qframe
 public function testEncryptedZipArchiveExportCanBeImported()
 {
     $this->auth();
     $crypto = CryptoModel::importRijndael256Key('testdupe', 'BqPwhnSskTFzxPUlljXG1zgG8cfgTSaGj8UyRWsKanA=');
     $instance = new InstanceModel(array('instanceID' => 1));
     $zip = new ZipArchiveModel($instance, array('new' => '1'));
     $zip->addInstanceFullResponsesXMLDocument();
     $zip->close();
     $encrypted = $crypto->encrypt($zip->getZipFileContents());
     $zip->deleteZipFile();
     $decrypted = $crypto->decrypt($encrypted);
     $tempfile = tempnam(PROJECT_PATH . DIRECTORY_SEPARATOR . 'tmp', 'zip');
     unlink($tempfile);
     file_put_contents($tempfile, $decrypted);
     $zip = new ZipArchiveModel(null, array('filename' => $tempfile));
     InstanceModel::importXML($zip, 'test encryption import');
     $zip->deleteZipFile();
 }