]> source.dussan.org Git - nextcloud-server.git/commitdiff
always throw a encryption exception
authorBjoern Schiessle <bjoern@schiessle.org>
Tue, 14 Mar 2017 10:31:46 +0000 (11:31 +0100)
committerBjoern Schiessle <bjoern@schiessle.org>
Tue, 14 Mar 2017 11:11:28 +0000 (12:11 +0100)
Signed-off-by: Bjoern Schiessle <bjoern@schiessle.org>
apps/encryption/lib/Crypto/Crypt.php
apps/encryption/tests/Crypto/CryptTest.php

index 7d6636d882e98137fc3f7eb635ae616b9f998348..4303cb9e940b7eb8e05e7859d93475d0693689ab 100644 (file)
@@ -29,7 +29,6 @@ namespace OCA\Encryption\Crypto;
 
 use OC\Encryption\Exceptions\DecryptionFailedException;
 use OC\Encryption\Exceptions\EncryptionFailedException;
-use OC\HintException;
 use OCA\Encryption\Exceptions\MultiKeyDecryptException;
 use OCA\Encryption\Exceptions\MultiKeyEncryptException;
 use OCP\Encryption\Exceptions\GenericEncryptionException;
@@ -476,12 +475,12 @@ class Crypt {
         * @param string $data
         * @param string $passPhrase
         * @param string $expectedSignature
-        * @throws HintException
+        * @throws GenericEncryptionException
         */
        private function checkSignature($data, $passPhrase, $expectedSignature) {
                $signature = $this->createSignature($data, $passPhrase);
                if (!hash_equals($expectedSignature, $signature)) {
-                       throw new HintException('Bad Signature', $this->l->t('Bad Signature'));
+                       throw new GenericEncryptionException('Bad Signature', $this->l->t('Bad Signature'));
                }
        }
 
@@ -552,7 +551,7 @@ class Crypt {
         * @param string $catFile
         * @param string $cipher
         * @return bool
-        * @throws HintException
+        * @throws GenericEncryptionException
         */
        private function hasSignature($catFile, $cipher) {
                $meta = substr($catFile, -93);
@@ -560,7 +559,7 @@ class Crypt {
 
                // enforce signature for the new 'CTR' ciphers
                if ($signaturePosition === false && strpos(strtolower($cipher), 'ctr') !== false) {
-                       throw new HintException('Missing Signature', $this->l->t('Missing Signature'));
+                       throw new GenericEncryptionException('Missing Signature', $this->l->t('Missing Signature'));
                }
 
                return ($signaturePosition !== false);
index b808acaf199abd11035331758b736db3fff6cb6e..3c226ed94ab744935629aa9257fa2f35d7de44bc 100644 (file)
@@ -247,7 +247,7 @@ class CryptTest extends TestCase {
 
        /**
         * @dataProvider dataTestHasSignatureFail
-        * @expectedException \OC\HintException
+        * @expectedException \OCP\Encryption\Exceptions\GenericEncryptionException
         */
        public function testHasSignatureFail($cipher) {
                $data = 'encryptedContent00iv001234567890123456xx';