aboutsummaryrefslogtreecommitdiffstats
path: root/apps/encryption/tests
diff options
context:
space:
mode:
authorBjoern Schiessle <schiessle@owncloud.com>2015-08-25 15:58:07 +0200
committerBjoern Schiessle <schiessle@owncloud.com>2015-08-30 15:31:19 +0200
commit166e57cf611b659892748fc7799e85a82553b042 (patch)
treea9f16c0f601bac4f95e2c9a96f0725daf43a6a12 /apps/encryption/tests
parentf893de413670877aa91af2559a1eee369b4590d6 (diff)
downloadnextcloud-server-166e57cf611b659892748fc7799e85a82553b042.tar.gz
nextcloud-server-166e57cf611b659892748fc7799e85a82553b042.zip
return false if private key is not valid
Diffstat (limited to 'apps/encryption/tests')
-rw-r--r--apps/encryption/tests/lib/crypto/cryptTest.php15
1 files changed, 15 insertions, 0 deletions
diff --git a/apps/encryption/tests/lib/crypto/cryptTest.php b/apps/encryption/tests/lib/crypto/cryptTest.php
index 3c7767a8908..c6f16e952d7 100644
--- a/apps/encryption/tests/lib/crypto/cryptTest.php
+++ b/apps/encryption/tests/lib/crypto/cryptTest.php
@@ -363,4 +363,19 @@ class cryptTest extends TestCase {
];
}
+ public function testIsValidPrivateKey() {
+ $res = openssl_pkey_new();
+ openssl_pkey_export($res, $privateKey);
+
+ // valid private key
+ $this->assertTrue(
+ $this->invokePrivate($this->crypt, 'isValidPrivateKey', [$privateKey])
+ );
+
+ // invalid private key
+ $this->assertFalse(
+ $this->invokePrivate($this->crypt, 'isValidPrivateKey', ['foo'])
+ );
+ }
+
}