summaryrefslogtreecommitdiffstats
path: root/lib/private/security/certificatemanager.php
diff options
context:
space:
mode:
Diffstat (limited to 'lib/private/security/certificatemanager.php')
-rw-r--r--lib/private/security/certificatemanager.php35
1 files changed, 30 insertions, 5 deletions
diff --git a/lib/private/security/certificatemanager.php b/lib/private/security/certificatemanager.php
index 7bc83766365..beeb87a8316 100644
--- a/lib/private/security/certificatemanager.php
+++ b/lib/private/security/certificatemanager.php
@@ -1,9 +1,26 @@
<?php
/**
- * Copyright (c) 2014 Robin Appelman <icewind@owncloud.com>
- * This file is licensed under the Affero General Public License version 3 or
- * later.
- * See the COPYING-README file.
+ * @author Björn Schießle <schiessle@owncloud.com>
+ * @author Joas Schilling <nickvergessen@owncloud.com>
+ * @author Lukas Reschke <lukas@owncloud.com>
+ * @author Morris Jobke <hey@morrisjobke.de>
+ * @author Robin Appelman <icewind@owncloud.com>
+ *
+ * @copyright Copyright (c) 2015, ownCloud, Inc.
+ * @license AGPL-3.0
+ *
+ * This code is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License, version 3,
+ * as published by the Free Software Foundation.
+ *
+ * This program 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, version 3,
+ * along with this program. If not, see <http://www.gnu.org/licenses/>
+ *
*/
namespace OC\Security;
@@ -63,11 +80,13 @@ class CertificateManager implements ICertificateManager {
/**
* create the certificate bundle of all trusted certificated
*/
- protected function createCertificateBundle() {
+ public function createCertificateBundle() {
$path = $this->getPathToCertificates();
$certs = $this->listCertificates();
$fh_certs = $this->view->fopen($path . '/rootcerts.crt', 'w');
+
+ // Write user certificates
foreach ($certs as $cert) {
$file = $path . '/uploads/' . $cert->getName();
$data = $this->view->file_get_contents($file);
@@ -77,6 +96,9 @@ class CertificateManager implements ICertificateManager {
}
}
+ // Append the default certificates
+ $defaultCertificates = file_get_contents(\OC::$SERVERROOT . '/config/ca-bundle.crt');
+ fwrite($fh_certs, $defaultCertificates);
fclose($fh_certs);
}
@@ -137,6 +159,9 @@ class CertificateManager implements ICertificateManager {
return $this->getPathToCertificates() . 'rootcerts.crt';
}
+ /**
+ * @return string
+ */
private function getPathToCertificates() {
$path = is_null($this->uid) ? '/files_external/' : '/' . $this->uid . '/files_external/';