From d26a9c3c5819be48b76586c2fa60da9a7a9829dd Mon Sep 17 00:00:00 2001 From: Lukas Reschke Date: Tue, 26 Aug 2014 19:02:40 +0200 Subject: 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 --- tests/lib/security/stringutils.php | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 tests/lib/security/stringutils.php (limited to 'tests/lib/security/stringutils.php') diff --git a/tests/lib/security/stringutils.php b/tests/lib/security/stringutils.php new file mode 100644 index 00000000000..72293124eb9 --- /dev/null +++ b/tests/lib/security/stringutils.php @@ -0,0 +1,21 @@ + + * This file is licensed under the Affero General Public License version 3 or + * later. + * See the COPYING-README file. + */ + +use \OC\Security\StringUtils; + +class StringUtilsTest extends \PHPUnit_Framework_TestCase { + + function testEquals() { + $this->assertTrue(StringUtils::equals('GpKY9fSnWRaeFNJbES99zVGvA', 'GpKY9fSnWRaeFNJbES99zVGvA')); + $this->assertFalse(StringUtils::equals('GpKY9fSnWNJbES99zVGvA', 'GpKY9fSnWRaeFNJbES99zVGvA')); + $this->assertFalse(StringUtils::equals('', 'GpKY9fSnWRaeFNJbES99zVGvA')); + $this->assertFalse(StringUtils::equals('GpKY9fSnWRaeFNJbES99zVGvA', '')); + $this->assertTrue(StringUtils::equals('', '')); + } + +} -- cgit v1.2.3