Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
67 changes: 1 addition & 66 deletions .drone.star
Original file line number Diff line number Diff line change
Expand Up @@ -47,14 +47,7 @@ config = {
],
"codestyle": True,
"phpstan": True,
"phan": {
"multipleVersions": {
"phpVersions": [
DEFAULT_PHP_VERSION,
"7.3",
],
},
},
"phan": True,
"javascript": False,
"phpunit": {
"withCoverage": {
Expand Down Expand Up @@ -88,7 +81,6 @@ config = {
"commands": [
"cd %s" % dir["server"],
"php occ encryption:enable",
"php occ encryption:select-encryption-type masterkey --yes",
"php occ config:list",
],
},
Expand All @@ -113,7 +105,6 @@ config = {
"commands": [
"cd %s" % dir["server"],
"php occ encryption:enable",
"php occ encryption:select-encryption-type masterkey --yes",
"php occ config:list",
],
},
Expand All @@ -138,57 +129,6 @@ config = {
"commands": [
"cd %s" % dir["server"],
"php occ encryption:enable",
"php occ encryption:select-encryption-type masterkey --yes",
"php occ config:list",
],
},
],
},
"api-userkeys": {
"suites": {
"apiEncryption": "apiUserKeys",
},
"databases": [
"mysql:8.0",
"postgres:9.4",
],
"servers": [
"daily-master-qa",
"latest",
],
"extraSetup": [
{
"name": "configure-app",
"image": OC_CI_PHP % DEFAULT_PHP_VERSION,
"commands": [
"cd %s" % dir["server"],
"php occ encryption:enable",
"php occ encryption:select-encryption-type user-keys --yes",
"php occ config:list",
],
},
],
},
"webUI-userkeys": {
"suites": {
"webUIUserKeysType": "webUIUserKeys",
},
"databases": [
"mysql:8.0",
],
"servers": [
"daily-master-qa",
"latest",
],
"emailNeeded": True,
"extraSetup": [
{
"name": "configure-app",
"image": OC_CI_PHP % DEFAULT_PHP_VERSION,
"commands": [
"cd %s" % dir["server"],
"php occ encryption:enable",
"php occ encryption:select-encryption-type user-keys --yes",
"php occ config:list",
],
},
Expand Down Expand Up @@ -222,7 +162,6 @@ config = {
"commands": [
"cd %s" % dir["server"],
"php occ encryption:enable",
"php occ encryption:select-encryption-type masterkey --yes",
"php occ config:list",
],
},
Expand Down Expand Up @@ -257,7 +196,6 @@ config = {
"commands": [
"cd %s" % dir["server"],
"php occ encryption:enable",
"php occ encryption:select-encryption-type masterkey --yes",
"php occ config:list",
],
},
Expand Down Expand Up @@ -292,7 +230,6 @@ config = {
"commands": [
"cd %s" % dir["server"],
"php occ encryption:enable",
"php occ encryption:select-encryption-type masterkey --yes",
"php occ config:list",
],
},
Expand Down Expand Up @@ -327,7 +264,6 @@ config = {
"commands": [
"cd %s" % dir["server"],
"php occ encryption:enable",
"php occ encryption:select-encryption-type masterkey --yes",
"php occ config:list",
],
},
Expand Down Expand Up @@ -363,7 +299,6 @@ config = {
"commands": [
"cd %s" % dir["server"],
"php occ encryption:enable",
"php occ encryption:select-encryption-type masterkey --yes",
"php occ config:list",
],
},
Expand Down
6 changes: 0 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,5 @@ Normal ownCloud encryption vs storing decryption-keys in a HSM

`config:app:set encryption recoveryAdminEnabled --value 1/0`

With user-key encryption where only the specific user (not even the admin) can decrypt his data with his password there is an additional option to provide a recovery-key to the admin so he can also decrypt the data if the user leaves the company for example.

`config:app:set encryption userSpecificKey --value 1/0`

Set to 1 if userKey encryption is enabled


> Note : You need openSSL version 1.1.x installed for encryption app to work. With the release change of openSSL v1.x to openSSL version 3.x in December 2021, some ciphers which were valid in version 1.x, have been retired with immediate effect. This impacts the ownCloud encryption app. Your encryption environment will break due to openSSL v3 retired (legacy) ciphers. As a result, encrypted files cant be accessed. As a temporary solution, you have to manually reenable in the openSSL v3 config the legacy ciphers. To do so, see the example in the OpenSSL 3.0 Wiki at section 6.2 Providers.
4 changes: 2 additions & 2 deletions appinfo/info.xml
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,10 @@
<use-migrations>true</use-migrations>
<dependencies>
<lib>openssl</lib>
<owncloud min-version="10.7" max-version="11.0" />
<owncloud min-version="10.12" max-version="10"/>
<php min-version="7.4" />
</dependencies>
<commands>
<command>OCA\Encryption\Command\SelectEncryptionType</command>
<command>OCA\Encryption\Command\RecreateMasterKey</command>
<command>OCA\Encryption\Command\MigrateKeys</command>
<command>OCA\Encryption\Command\HSMDaemon</command>
Expand Down
3 changes: 2 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,14 @@
"name": "owncloud/encryption",
"config" : {
"platform": {
"php": "7.3"
"php": "7.4"
},
"allow-plugins": {
"bamarni/composer-bin-plugin": true
}
},
"require": {
"php": ">=7.4"
},
"require-dev": {
"bamarni/composer-bin-plugin": "^1.8"
Expand Down
8 changes: 5 additions & 3 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 0 additions & 9 deletions js/settings-admin.js
Original file line number Diff line number Diff line change
Expand Up @@ -68,15 +68,6 @@ $(document).ready(function () {
$loadSpinner.toggleClass('hidden');
location.reload();
});
} else if($("#keyTypeId :selected").val() === "customkey") {
if($("#encryptionType").val().length === 0) {
$("#encryptionType").text("Encryption type: User Specific Key");
}
var userSpecificAjaxObj = OC.AppConfig.setValue("encryption", "userSpecificKey", '1');
$.when(userSpecificAjaxObj).done(function (userSpecificAjaxObj) {
$loadSpinner.toggleClass('hidden');
location.reload();
});
}
});

Expand Down
46 changes: 31 additions & 15 deletions lib/AppInfo/Application.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
*/
namespace OCA\Encryption\AppInfo;

use OC\Encryption\Exceptions\ModuleAlreadyExistsException;
use OC\Files\View;
use OC\Helper\EnvironmentHelper;
use OCA\Encryption\Controller\RecoveryController;
Expand All @@ -39,27 +40,37 @@
use OCA\Encryption\Users\Setup;
use OCA\Encryption\Util;
use OCA\Encryption\Crypto\CryptHSM;
use OCP\AppFramework\App;
use OCP\AppFramework\IAppContainer;
use OCP\AppFramework\QueryException;
use OCP\Encryption\IManager;
use OCP\IConfig;
use Symfony\Component\Console\Helper\QuestionHelper;

class Application extends \OCP\AppFramework\App {
class Application extends App {

/** @var IManager */
private $encryptionManager;
/** @var IConfig */
private $config;
private IConfig $config;

/**
* @param array $urlParams
* @param bool $encryptionSystemReady
* @throws QueryException
*/
public function __construct($urlParams = [], $encryptionSystemReady = true) {
parent::__construct('encryption', $urlParams);
$this->encryptionManager = \OC::$server->getEncryptionManager();
$this->config = \OC::$server->getConfig();
$this->registerServices();

# in case neither master key nor user based key is enabled -> setup master-key
if ($this->encryptionManager->isEnabled()) {
$masterKeyEnabled = $this->config->getAppValue('encryption', 'useMasterKey', '');
$userKeyEnabled = $this->config->getAppValue('encryption', 'userSpecificKey', '');
if (($masterKeyEnabled === '') && ($userKeyEnabled === '')) {
$this->config->setAppValue('encryption', 'useMasterKey', '1');
}
}

if ($encryptionSystemReady === false) {
/** @var Session $session */
$session = $this->getContainer()->query('Session');
Expand All @@ -74,9 +85,11 @@ public function __construct($urlParams = [], $encryptionSystemReady = true) {

/**
* register hooks
*
* @throws QueryException
*/

public function registerHooks() {
public function registerHooks(): void {
if (!$this->config->getSystemValue('maintenance', false)) {
$container = $this->getContainer();
$server = $container->getServer();
Expand Down Expand Up @@ -106,7 +119,10 @@ public function registerHooks() {
}
}

public function registerEncryptionModule() {
/**
* @throws ModuleAlreadyExistsException
*/
public function registerEncryptionModule(): void {
$container = $this->getContainer();

$this->encryptionManager->registerEncryptionModule(
Expand All @@ -127,7 +143,7 @@ function () use ($container) {
);
}

public function registerServices() {
public function registerServices(): void {
$container = $this->getContainer();

$container->registerService(
Expand All @@ -151,14 +167,14 @@ function (IAppContainer $c) {
/** @phan-suppress-next-line PhanUndeclaredMethod */
$server->getTimeFactory()
);
} else {
return new Crypt(
$server->getLogger(),
$server->getUserSession(),
$server->getConfig(),
$server->getL10N($c->getAppName())
);
}

return new Crypt(
$server->getLogger(),
$server->getUserSession(),
$server->getConfig(),
$server->getL10N($c->getAppName())
);
}
);

Expand Down
Loading