Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/server.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBjörn Schießle <schiessle@owncloud.com>2013-06-03 19:34:43 +0400
committerBjörn Schießle <schiessle@owncloud.com>2013-06-03 19:34:43 +0400
commit35c91ff9010f84aa204030f4bb60f36dca1cb664 (patch)
tree5fad4a915db1205325c65186531529f0dba11fef /apps/files_encryption/tests/crypt.php
parentb5820af3cc713bc8c373d28bb6b6ff69a70545b8 (diff)
added test for decryptPrivateKey()
Diffstat (limited to 'apps/files_encryption/tests/crypt.php')
-rwxr-xr-xapps/files_encryption/tests/crypt.php18
1 files changed, 18 insertions, 0 deletions
diff --git a/apps/files_encryption/tests/crypt.php b/apps/files_encryption/tests/crypt.php
index 32156eea272..74f91e9b037 100755
--- a/apps/files_encryption/tests/crypt.php
+++ b/apps/files_encryption/tests/crypt.php
@@ -226,6 +226,24 @@ class Test_Encryption_Crypt extends \PHPUnit_Framework_TestCase {
}
+ function testDecryptPrivateKey() {
+
+ $keypair = Encryption\Crypt::createKeypair();
+
+ // test successful decrypt
+ $crypted = Encryption\Crypt::symmetricEncryptFileContent($keypair['privateKey'], 'hat');
+
+ $decrypted = Encryption\Crypt::decryptPrivateKey($crypted, 'hat');
+
+ $this->assertEquals($keypair['privateKey'], $decrypted);
+
+ //test private key decrypt with wrong password
+ $wrongPasswd = Encryption\Crypt::decryptPrivateKey($crypted, 'hat2');
+
+ $this->assertEquals(false, $wrongPasswd);
+
+ }
+
function testSymmetricEncryptFileContent() {
# TODO: search in keyfile for actual content as IV will ensure this test always passes