diff options
author | Lukas Reschke <lukas@owncloud.com> | 2014-08-27 00:49:53 +0200 |
---|---|---|
committer | Lukas Reschke <lukas@owncloud.com> | 2014-08-27 00:49:53 +0200 |
commit | 3329e0f2b22207a24ddb4953bbf11964b23682d9 (patch) | |
tree | 54bfeb8fa17492d29633928c62c259312d0af5e4 /tests | |
parent | d26a9c3c5819be48b76586c2fa60da9a7a9829dd (diff) | |
download | nextcloud-server-3329e0f2b22207a24ddb4953bbf11964b23682d9.tar.gz nextcloud-server-3329e0f2b22207a24ddb4953bbf11964b23682d9.zip |
Use DI
Diffstat (limited to 'tests')
-rw-r--r-- | tests/lib/security/crypto.php | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/tests/lib/security/crypto.php b/tests/lib/security/crypto.php index e07a60267e8..6211e3e8227 100644 --- a/tests/lib/security/crypto.php +++ b/tests/lib/security/crypto.php @@ -12,7 +12,7 @@ class CryptoTest extends \PHPUnit_Framework_TestCase { function testDefaultEncrypt() { $stringToEncrypt = 'Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt.'; - $crypto = new Crypto(); + $crypto = new Crypto(\OC::$server->getConfig(), \OC::$server->getSecureRandom()); $ciphertext = $crypto->encrypt($stringToEncrypt); $this->assertEquals($stringToEncrypt, $crypto->decrypt($ciphertext)); @@ -27,17 +27,17 @@ class CryptoTest extends \PHPUnit_Framework_TestCase { */ function testWrongPassword() { $stringToEncrypt = 'Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt.'; - $encryptCrypto = new Crypto(); + $encryptCrypto = new Crypto(\OC::$server->getConfig(), \OC::$server->getSecureRandom()); $ciphertext = $encryptCrypto->encrypt($stringToEncrypt); - $decryptCrypto = new Crypto(); + $decryptCrypto = new Crypto(\OC::$server->getConfig(), \OC::$server->getSecureRandom()); $this->assertFalse($decryptCrypto->decrypt($ciphertext, 'A wrong password!')); } function testLaterDecryption() { $stringToEncrypt = 'Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt.'; $encryptedString = '560f5436ba864b9f12f7f7ca6d41c327554a6f2c0a160a03316b202af07c65163274993f3a46e7547c07ba89304f00594a2f3bd99f83859097c58049c39d0d4ade10e0de914ff0604961e7c849d0271ed6c0b23f984ba16e7d033e3305fb0910e7b6a2a65c988d17dbee71d8f953684d|d2kdFUspVjC0Y0sr|1a5feacf87eaa6869a6abdfba9a296e7bbad45b6ad89f7dce67cdc98e2da5dc4379cc672cc655e52bbf19599bf59482fbea13a73937697fa656bf10f3fc4f1aa'; - $crypto = new Crypto(); + $crypto = new Crypto(\OC::$server->getConfig(), \OC::$server->getSecureRandom()); $this->assertEquals($stringToEncrypt, $crypto->decrypt($encryptedString, 'ThisIsAVeryS3cur3P4ssw0rd')); } @@ -47,7 +47,7 @@ class CryptoTest extends \PHPUnit_Framework_TestCase { */ function testWrongIV() { $encryptedString = '560f5436ba864b9f12f7f7ca6d41c327554a6f2c0a160a03316b202af07c65163274993f3a46e7547c07ba89304f00594a2f3bd99f83859097c58049c39d0d4ade10e0de914ff0604961e7c849d0271ed6c0b23f984ba16e7d033e3305fb0910e7b6a2a65c988d17dbee71d8f953684d|d2kdFUspVjC0o0sr|1a5feacf87eaa6869a6abdfba9a296e7bbad45b6ad89f7dce67cdc98e2da5dc4379cc672cc655e52bbf19599bf59482fbea13a73937697fa656bf10f3fc4f1aa'; - $crypto = new Crypto(); + $crypto = new Crypto(\OC::$server->getConfig(), \OC::$server->getSecureRandom()); $crypto->decrypt($encryptedString, 'ThisIsAVeryS3cur3P4ssw0rd'); } @@ -57,7 +57,7 @@ class CryptoTest extends \PHPUnit_Framework_TestCase { */ function testWrongParameters() { $encryptedString = '1|2'; - $crypto = new Crypto(); + $crypto = new Crypto(\OC::$server->getConfig(), \OC::$server->getSecureRandom()); $crypto->decrypt($encryptedString, 'ThisIsAVeryS3cur3P4ssw0rd'); } } |