Ejemplo n.º 1
0
 function setUp()
 {
     // set content for encrypting / decrypting in tests
     $this->dataLong = file_get_contents(__DIR__ . '/../lib/crypt.php');
     $this->dataShort = 'hats';
     $this->dataUrl = __DIR__ . '/../lib/crypt.php';
     $this->legacyData = __DIR__ . '/legacy-text.txt';
     $this->legacyEncryptedData = __DIR__ . '/legacy-encrypted-text.txt';
     $this->randomKey = Encryption\Crypt::generateKey();
     $keypair = Encryption\Crypt::createKeypair();
     $this->genPublicKey = $keypair['publicKey'];
     $this->genPrivateKey = $keypair['privateKey'];
     $this->view = new \OC\Files\View('/');
     \Test_Encryption_Util::loginHelper(Test_Encryption_Keymanager::TEST_USER);
     $this->userId = \Test_Encryption_Keymanager::TEST_USER;
     $this->pass = \Test_Encryption_Keymanager::TEST_USER;
     $userHome = \OC_User::getHome($this->userId);
     $this->dataDir = str_replace('/' . $this->userId, '', $userHome);
 }
Ejemplo n.º 2
0
 function setUp()
 {
     // set content for encrypting / decrypting in tests
     $this->dataLong = file_get_contents(__DIR__ . '/../lib/crypt.php');
     $this->dataShort = 'hats';
     $this->dataUrl = __DIR__ . '/../lib/crypt.php';
     $this->legacyData = __DIR__ . '/legacy-text.txt';
     $this->legacyEncryptedData = __DIR__ . '/legacy-encrypted-text.txt';
     $this->randomKey = Encryption\Crypt::generateKey();
     $keypair = Encryption\Crypt::createKeypair();
     $this->genPublicKey = $keypair['publicKey'];
     $this->genPrivateKey = $keypair['privateKey'];
     $this->view = new \OC_FilesystemView('/');
     \OC_User::setUserId(\Test_Encryption_Keymanager::TEST_USER);
     $this->userId = \Test_Encryption_Keymanager::TEST_USER;
     $this->pass = \Test_Encryption_Keymanager::TEST_USER;
     $userHome = \OC_User::getHome($this->userId);
     $this->dataDir = str_replace('/' . $this->userId, '', $userHome);
     // remember files_trashbin state
     $this->stateFilesTrashbin = OC_App::isEnabled('files_trashbin');
     // we don't want to tests with app files_trashbin enabled
     \OC_App::disable('files_trashbin');
 }
Ejemplo n.º 3
0
 /**
  * @medium
  */
 function testGenerateKey()
 {
     # TODO: use more accurate (larger) string length for test confirmation
     $key = Encryption\Crypt::generateKey();
     $this->assertTrue(strlen($key) > 16);
 }