Differential D16127 Diff 38809 src/applications/files/format/__tests__/PhabricatorFileStorageFormatTestCase.php
Changeset View
Changeset View
Standalone View
Standalone View
src/applications/files/format/__tests__/PhabricatorFileStorageFormatTestCase.php
Show All 33 Lines | public function testRot13Storage() { | ||||
$raw_data = $engine->readFile($file->getStorageHandle()); | $raw_data = $engine->readFile($file->getStorageHandle()); | ||||
$this->assertEqual($expect, $raw_data); | $this->assertEqual($expect, $raw_data); | ||||
} | } | ||||
public function testAES256Storage() { | public function testAES256Storage() { | ||||
$engine = new PhabricatorTestStorageEngine(); | $engine = new PhabricatorTestStorageEngine(); | ||||
$key_name = 'test.abcd'; | $key_name = 'test.abcd'; | ||||
$key_text = new PhutilOpaqueEnvelope('abcdefghijklmnopABCDEFGHIJKLMNOP'); | $key_text = 'abcdefghijklmnopABCDEFGHIJKLMNOP'; | ||||
PhabricatorFileAES256StorageFormat::addKeyToKeyRing($key_name, $key_text); | PhabricatorKeyring::addKey( | ||||
array( | |||||
'name' => $key_name, | |||||
'type' => 'aes-256-cbc', | |||||
'material.base64' => base64_encode($key_text), | |||||
)); | |||||
$format = id(new PhabricatorFileAES256StorageFormat()) | $format = id(new PhabricatorFileAES256StorageFormat()) | ||||
->selectKey($key_name); | ->selectMasterKey($key_name); | ||||
$data = 'The cow jumped over the full moon.'; | $data = 'The cow jumped over the full moon.'; | ||||
$params = array( | $params = array( | ||||
'name' => 'test.dat', | 'name' => 'test.dat', | ||||
'storageEngines' => array( | 'storageEngines' => array( | ||||
$engine, | $engine, | ||||
), | ), | ||||
Show All 17 Lines |