Merge pull request #15955 from owncloud/move-dummy-encryption

Moving encryption_dummy to the apps repo
This commit is contained in:
Thomas Müller 2015-04-30 18:14:01 +02:00
commit ca8b6f24cb
5 changed files with 0 additions and 218 deletions

View File

@ -1,8 +0,0 @@
<?php
$manager = \OC::$server->getEncryptionManager();
$module = new \OCA\Encryption_Dummy\DummyModule();
$manager->registerEncryptionModule('OC_DUMMY_MODULE', 'Dummy Encryption Module', function() use ($module) {
return $module;
});

View File

@ -1,20 +0,0 @@
<?xml version="1.0"?>
<info>
<id>encryption_dummy</id>
<name>dummy encryption module</name>
<description>
This module does nothing, it is used for testing purpose only
</description>
<licence>AGPL</licence>
<author>Bjoern Schiessle</author>
<requiremin>8</requiremin>
<shipped>true</shipped>
<rememberlogin>false</rememberlogin>
<types>
<filesystem/>
</types>
<ocsid>166047</ocsid>
<dependencies>
<lib>openssl</lib>
</dependencies>
</info>

View File

@ -1 +0,0 @@
0.0.1

View File

@ -1,51 +0,0 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
xml:space="preserve"
height="16px"
width="16px"
version="1.1"
y="0px"
x="0px"
viewBox="0 0 71 100"
id="svg2"
inkscape:version="0.48.5 r10040"
sodipodi:docname="app.svg"><metadata
id="metadata10"><rdf:RDF><cc:Work
rdf:about=""><dc:format>image/svg+xml</dc:format><dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" /></cc:Work></rdf:RDF></metadata><defs
id="defs8" /><sodipodi:namedview
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1"
objecttolerance="10"
gridtolerance="10"
guidetolerance="10"
inkscape:pageopacity="0"
inkscape:pageshadow="2"
inkscape:window-width="1920"
inkscape:window-height="1014"
id="namedview6"
showgrid="false"
inkscape:zoom="14.75"
inkscape:cx="-21.423729"
inkscape:cy="8"
inkscape:window-x="0"
inkscape:window-y="27"
inkscape:window-maximized="1"
inkscape:current-layer="svg2" /><path
d="m8 1c-2.2091 0-4 1.7909-4 4v2h-1v7h10v-7h-1v-2c0-2.2091-1.791-4-4-4zm0 2c1.1046 0 2 0.89543 2 2v2h-4v-2c0-1.1046 0.8954-2 2-2z"
transform="matrix(6.25,0,0,6.25,-14.5,0)"
id="path4"
style="fill:#ffffff;fill-opacity:1" /><path
style="fill:none"
d="m 3.0644068,10.508475 0,-3.4576275 0.4655371,0 0.465537,0 0.049537,-1.2033899 C 4.1094633,4.2818838 4.1578923,4.0112428 4.4962182,3.3259708 4.7075644,2.8978935 4.9002217,2.6327599 5.2605792,2.2740624 6.7855365,0.75613022 8.9920507,0.69157582 10.623172,2.1171729 c 0.384104,0.3357058 0.882069,1.0763131 1.054177,1.5678422 0.147302,0.4206856 0.262873,1.6086448 0.266436,2.7387137 l 0.002,0.6271187 0.508474,0 0.508475,0 0,3.4576275 0,3.457627 -4.9491527,0 -4.9491525,0 0,-3.457627 z M 10.065882,6.3559322 c -0.02012,-0.3822034 -0.04774,-0.7076271 -0.0614,-0.7231639 -0.013653,-0.015537 -0.024824,0.281921 -0.024824,0.661017 l 0,0.6892655 -1.9630041,0 -1.963004,0 -0.023717,-0.4576271 -0.023717,-0.4576271 -0.013279,0.4915254 -0.013279,0.4915255 2.0613978,0 2.0613972,0 -0.03657,-0.6949153 0,0 z M 6.5396275,3.7118644 C 6.648082,3.5720339 6.7197092,3.4576271 6.6987988,3.4576271 c -0.062956,0 -0.5835446,0.6841947 -0.5835446,0.7669359 0,0.042237 0.051116,0.00136 0.1135916,-0.090834 0.062475,-0.092195 0.2023271,-0.2820343 0.3107817,-0.4218648 z M 9.7498983,4.0169492 C 9.6961899,3.9144068 9.5352369,3.723769 9.392225,3.5933098 L 9.1322034,3.356111 9.3784249,3.6272081 c 0.1354218,0.1491033 0.2814105,0.3397411 0.3244192,0.4236394 0.043009,0.083898 0.093162,0.1525423 0.1114515,0.1525423 0.01829,0 -0.010689,-0.083898 -0.064397,-0.1864406 l 0,0 z M 7.3032896,3.1315382 C 7.2704731,3.0987216 6.877102,3.3089557 6.8306315,3.3841466 6.8091904,3.4188389 6.911918,3.3813452 7.0589148,3.300827 7.2059117,3.2203088 7.3158803,3.1441289 7.3032896,3.1315382 l 0,0 z"
id="path3007"
inkscape:connector-curvature="0"
transform="matrix(6.25,0,0,6.25,-14.5,0)" /></svg>

Before

Width:  |  Height:  |  Size: 3.3 KiB

View File

@ -1,138 +0,0 @@
<?php
/**
* ownCloud
*
* @copyright (C) 2015 ownCloud, Inc.
*
* @author Bjoern Schiessle <schiessle@owncloud.com>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE
* License as published by the Free Software Foundation; either
* version 3 of the License, or any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU AFFERO GENERAL PUBLIC LICENSE for more details.
*
* You should have received a copy of the GNU Affero General Public
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
*/
namespace OCA\Encryption_Dummy;
use OCP\Encryption\IEncryptionModule;
class DummyModule implements IEncryptionModule {
/** @var boolean */
protected $isWriteOperation;
/**
* @return string defining the technical unique id
*/
public function getId() {
return "OC_DUMMY_MODULE";
}
/**
* In comparison to getKey() this function returns a human readable (maybe translated) name
*
* @return string
*/
public function getDisplayName() {
return "Dummy Encryption Module";
}
/**
* start receiving chunks from a file. This is the place where you can
* perform some initial step before starting encrypting/decrypting the
* chunks
*
* @param string $path to the file
* @param string $user who read/write the file (null for public access)
* @param string $mode php stream open mode
* @param array $header contains the header data read from the file
* @param array $accessList who has access to the file contains the key 'users' and 'public'
*
* @return array $header contain data as key-value pairs which should be
* written to the header, in case of a write operation
* or if no additional data is needed return a empty array
*/
public function begin($path, $user, $mode, array $header, array $accessList) {
return array();
}
/**
* last chunk received. This is the place where you can perform some final
* operation and return some remaining data if something is left in your
* buffer.
*
* @param string $path to the file
* @return string remained data which should be written to the file in case
* of a write operation
*/
public function end($path) {
if ($this->isWriteOperation) {
$storage = \OC::$server->getEncryptionKeyStorage();
$storage->setFileKey($path, 'fileKey', 'foo', $this->getId());
}
return '';
}
/**
* encrypt data
*
* @param string $data you want to encrypt
* @return mixed encrypted data
*/
public function encrypt($data) {
$this->isWriteOperation = true;
return $data;
}
/**
* decrypt data
*
* @param string $data you want to decrypt
* @param string $user decrypt as user (null for public access)
* @return mixed decrypted data
*/
public function decrypt($data) {
$this->isWriteOperation=false;
return $data;
}
/**
* should the file be encrypted or not
*
* @param string $path
* @return boolean
*/
public function shouldEncrypt($path) {
if (strpos($path, '/'. \OCP\User::getUser() . '/files/') === 0) {
return true;
}
return false;
}
public function getUnencryptedBlockSize() {
return 6126;
}
/**
* update encrypted file, e.g. give additional users access to the file
*
* @param string $path path to the file which should be updated
* @param string $uid of the user who performs the operation
* @param array $accessList who has access to the file contains the key 'users' and 'public'
* @return boolean
*/
public function update($path, $uid, array $accessList) {
return true;
}
}