diff options
author | Lukas Reschke <lukas@owncloud.com> | 2014-08-26 19:02:40 +0200 |
---|---|---|
committer | Lukas Reschke <lukas@owncloud.com> | 2014-08-27 00:18:04 +0200 |
commit | d26a9c3c5819be48b76586c2fa60da9a7a9829dd (patch) | |
tree | fe50b3b1b7e785d644dd76e26c06dde375539b53 /lib/private/server.php | |
parent | 3115053bbb3a1ba5d0bb3562bea6b7ef94a09cd0 (diff) | |
download | nextcloud-server-d26a9c3c5819be48b76586c2fa60da9a7a9829dd.tar.gz nextcloud-server-d26a9c3c5819be48b76586c2fa60da9a7a9829dd.zip |
Add some security utilities
This adds some security utilities to core including:
- A library for basic crypto operations (e.g. to encrypt passwords)
- A better library for cryptographic actions which allows you to specify the charset
- A library for secure string comparisions
Remove .htaccess
Remove .htaccess
Fix typo
Add public API
Use timing constant comparision
Remove CBC constant
Adjust code
Remove confusing $this
Diffstat (limited to 'lib/private/server.php')
-rw-r--r-- | lib/private/server.php | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/lib/private/server.php b/lib/private/server.php index aab3c82bfeb..86fead1daf1 100644 --- a/lib/private/server.php +++ b/lib/private/server.php @@ -9,6 +9,8 @@ use OC\Cache\UserCache; use OC\DB\ConnectionWrapper; use OC\Files\Node\Root; use OC\Files\View; +use OC\Security\Crypto; +use OC\Security\SecureRandom; use OCP\IServerContainer; /** @@ -199,6 +201,12 @@ class Server extends SimpleContainer implements IServerContainer { $this->registerService('Search', function ($c) { return new Search(); }); + $this->registerService('SecureRandom', function($c) { + return new SecureRandom(); + }); + $this->registerService('Crypto', function($c) { + return new Crypto(); + }); $this->registerService('Db', function ($c) { return new Db(); }); @@ -456,6 +464,24 @@ class Server extends SimpleContainer implements IServerContainer { } /** + * Returns a SecureRandom instance + * + * @return \OCP\Security\ISecureRandom + */ + function getSecureRandom() { + return $this->query('SecureRandom'); + } + + /** + * Returns a Crypto instance + * + * @return \OCP\Security\ICrypto + */ + function getCrypto() { + return $this->query('Crypto'); + } + + /** * Returns an instance of the db facade * * @return \OCP\IDb |