summaryrefslogtreecommitdiffstats
path: root/lib/public
diff options
context:
space:
mode:
authorMorris Jobke <hey@morrisjobke.de>2018-01-17 09:29:32 +0100
committerGitHub <noreply@github.com>2018-01-17 09:29:32 +0100
commitcb0dbfa987b0fab9ef34a164c7715d93915ebf95 (patch)
tree648dbe9c060fcf692413a85248538c995abadd99 /lib/public
parentd1420ef4812fc3f3822adf1b1ba91b9a6fb8fa80 (diff)
parent0e0db3765887930682aadc6bc8ec7df5ffd187f6 (diff)
downloadnextcloud-server-cb0dbfa987b0fab9ef34a164c7715d93915ebf95.tar.gz
nextcloud-server-cb0dbfa987b0fab9ef34a164c7715d93915ebf95.zip
Merge pull request #7900 from nextcloud/strict_security
Make OCP\Security stricter
Diffstat (limited to 'lib/public')
-rw-r--r--lib/public/Security/ICrypto.php5
-rw-r--r--lib/public/Security/IHasher.php5
-rw-r--r--lib/public/Security/StringUtils.php3
3 files changed, 8 insertions, 5 deletions
diff --git a/lib/public/Security/ICrypto.php b/lib/public/Security/ICrypto.php
index aa2b9eed2c0..ef5bd2bf7c9 100644
--- a/lib/public/Security/ICrypto.php
+++ b/lib/public/Security/ICrypto.php
@@ -1,4 +1,5 @@
<?php
+declare(strict_types=1);
/**
* @copyright Copyright (c) 2016, ownCloud, Inc.
*
@@ -42,7 +43,7 @@ interface ICrypto {
* @return string Calculated HMAC
* @since 8.0.0
*/
- public function calculateHMAC($message, $password = '');
+ public function calculateHMAC(string $message, string $password = ''): string;
/**
* Encrypts a value and adds an HMAC (Encrypt-Then-MAC)
@@ -51,7 +52,7 @@ interface ICrypto {
* @return string Authenticated ciphertext
* @since 8.0.0
*/
- public function encrypt($plaintext, $password = '');
+ public function encrypt(string $plaintext, string $password = ''): string;
/**
* Decrypts a value and verifies the HMAC (Encrypt-Then-Mac)
diff --git a/lib/public/Security/IHasher.php b/lib/public/Security/IHasher.php
index 11159cbc010..5942814802a 100644
--- a/lib/public/Security/IHasher.php
+++ b/lib/public/Security/IHasher.php
@@ -1,4 +1,5 @@
<?php
+declare(strict_types=1);
/**
* @copyright Copyright (c) 2016, ownCloud, Inc.
*
@@ -53,7 +54,7 @@ interface IHasher {
* @return string Hash of the message with appended version parameter
* @since 8.0.0
*/
- public function hash($message);
+ public function hash(string $message): string;
/**
* @param string $message Message to verify
@@ -62,5 +63,5 @@ interface IHasher {
* @return bool Whether $hash is a valid hash of $message
* @since 8.0.0
*/
- public function verify($message, $hash, &$newHash = null);
+ public function verify(string $message, string $hash, &$newHash = null): bool ;
}
diff --git a/lib/public/Security/StringUtils.php b/lib/public/Security/StringUtils.php
index 04b5028cbd2..4ee1f47e836 100644
--- a/lib/public/Security/StringUtils.php
+++ b/lib/public/Security/StringUtils.php
@@ -1,4 +1,5 @@
<?php
+declare(strict_types=1);
/**
* @copyright Copyright (c) 2016, ownCloud, Inc.
*
@@ -42,7 +43,7 @@ class StringUtils {
* @since 8.0.0
* @deprecated 9.0.0 Use hash_equals
*/
- public static function equals($expected, $input) {
+ public static function equals(string $expected, string $input): bool {
return hash_equals($expected, $input);
}
}