Skip to content

Commit f3deac8

Browse files
Fail smime encryption for files bigger 1.5 GB
Since OpenSSL still has an issue encryption files bigger 1.5 GB bphbu now fails the backup to let the user know of the problem. Relates to issue #305 Further Information: openssl/openssl#1302
1 parent 7176169 commit f3deac8

File tree

1 file changed

+14
-11
lines changed

1 file changed

+14
-11
lines changed

src/Backup/Crypter/OpenSSL.php

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,9 @@ public function crypt(Target $target, Result $result)
100100

101101
$result->warn($name . ': The ' . $this->algorithm . ' algorithm is considered weak');
102102
}
103+
if ($target->getSize() > 1610612736) {
104+
throw new Exception('Backup to big to encrypt: OpenSSL SMIME can only encrypt files smaller 1.5GB.');
105+
}
103106
parent::crypt($target, $result);
104107
}
105108

@@ -121,7 +124,7 @@ public function simulate(Target $target, Result $result)
121124
* Is the configured cipher secure enough
122125
*
123126
* @return bool
124-
* @throws \phpbu\App\Backup\Crypter\Exception
127+
* @throws Exception
125128
*/
126129
public function isUsingWeakAlgorithm(): bool
127130
{
@@ -170,8 +173,8 @@ public function getSuffix() : string
170173
/**
171174
* Decrypt the backup
172175
*
173-
* @param \phpbu\App\Backup\Target $target
174-
* @param \phpbu\App\Backup\Restore\Plan $plan
176+
* @param Target $target
177+
* @param Plan $plan
175178
* @throws \phpbu\App\Exception
176179
*/
177180
public function restore(Target $target, Plan $plan)
@@ -183,8 +186,8 @@ public function restore(Target $target, Plan $plan)
183186
/**
184187
* Create the Executable to run the 'mcrypt' command
185188
*
186-
* @param \phpbu\App\Backup\Target $target
187-
* @return \phpbu\App\Cli\Executable
189+
* @param Target $target
190+
* @return Executable
188191
* @throws \phpbu\App\Exception
189192
*/
190193
protected function createExecutable(Target $target) : Executable
@@ -195,8 +198,8 @@ protected function createExecutable(Target $target) : Executable
195198
/**
196199
* Create encryption OpenSSL
197200
*
198-
* @param \phpbu\App\Backup\Target $target
199-
* @return \phpbu\App\Cli\Executable\OpenSSL
201+
* @param Target $target
202+
* @return Executable\OpenSSL
200203
* @throws \phpbu\App\Exception
201204
*/
202205
private function createEncryptionOpenSSL(Target $target): Executable\OpenSSL
@@ -211,8 +214,8 @@ private function createEncryptionOpenSSL(Target $target): Executable\OpenSSL
211214
/**
212215
* Create decryption OpenSSL
213216
*
214-
* @param \phpbu\App\Backup\Target $target
215-
* @return \phpbu\App\Cli\Executable\OpenSSL
217+
* @param Target $target
218+
* @return Executable\OpenSSL
216219
* @throws \phpbu\App\Exception
217220
*/
218221
private function createDecryptionOpenSSL(Target $target): Executable\OpenSSL
@@ -227,8 +230,8 @@ private function createDecryptionOpenSSL(Target $target): Executable\OpenSSL
227230
/**
228231
* Setup an OpenSSL executable only thing missing is the decision of en or decryption
229232
*
230-
* @param \phpbu\App\Backup\Target $target
231-
* @return \phpbu\App\Cli\Executable\OpenSSL
233+
* @param Target $target
234+
* @return Executable\OpenSSL
232235
* @throws \phpbu\App\Exception
233236
*/
234237
private function createOpenSSL(Target $target): Executable\OpenSSL

0 commit comments

Comments
 (0)