| 
                                
                                    @@ 179-190 (lines=12) @@
                                 | 
                            
                                                            
                                    | 176 | 
                                     | 
                                        /**  | 
                                
                                                            
                                    | 177 | 
                                     | 
                                         * @expectedException \Mes\Security\CryptoBundle\Exception\CryptoException  | 
                                
                                                            
                                    | 178 | 
                                     | 
                                         */  | 
                                
                                                            
                                    | 179 | 
                                     | 
                                        public function testEncryptFileWithKeyThrowsException()  | 
                                
                                                            
                                    | 180 | 
                                     | 
                                        { | 
                                
                                                            
                                    | 181 | 
                                     | 
                                            try { | 
                                
                                                            
                                    | 182 | 
                                     | 
                                                $this->encryption->expects($this->once())  | 
                                
                                                            
                                    | 183 | 
                                     | 
                                                                 ->method('encryptFileWithKey') | 
                                
                                                            
                                    | 184 | 
                                     | 
                                                                 ->will($this->throwException(new BaseCryptoException()));  | 
                                
                                                            
                                    | 185 | 
                                     | 
                                            } catch (BaseCryptoException $e) { | 
                                
                                                            
                                    | 186 | 
                                     | 
                                                $this->throwException(new CryptoException());  | 
                                
                                                            
                                    | 187 | 
                                     | 
                                            }  | 
                                
                                                            
                                    | 188 | 
                                     | 
                                     | 
                                
                                                            
                                    | 189 | 
                                     | 
                                            $this->wrapper->encryptFileWithKey(__DIR__.'/file.txt', __DIR__.'/file.crypto', $this->getMockBuilder('Mes\Security\CryptoBundle\Model\KeyInterface') | 
                                
                                                            
                                    | 190 | 
                                     | 
                                                                                                                                     ->getMock());  | 
                                
                                                            
                                    | 191 | 
                                     | 
                                        }  | 
                                
                                                            
                                    | 192 | 
                                     | 
                                     | 
                                
                                                            
                                    | 193 | 
                                     | 
                                        /**  | 
                                
                                                                                
                                 | 
                                
                                    @@ 196-207 (lines=12) @@
                                 | 
                            
                                                            
                                    | 193 | 
                                     | 
                                        /**  | 
                                
                                                            
                                    | 194 | 
                                     | 
                                         * @expectedException \Mes\Security\CryptoBundle\Exception\CryptoException  | 
                                
                                                            
                                    | 195 | 
                                     | 
                                         */  | 
                                
                                                            
                                    | 196 | 
                                     | 
                                        public function testDecryptFileWithKeyThrowsException()  | 
                                
                                                            
                                    | 197 | 
                                     | 
                                        { | 
                                
                                                            
                                    | 198 | 
                                     | 
                                            try { | 
                                
                                                            
                                    | 199 | 
                                     | 
                                                $this->encryption->expects($this->once())  | 
                                
                                                            
                                    | 200 | 
                                     | 
                                                                 ->method('decryptFileWithKey') | 
                                
                                                            
                                    | 201 | 
                                     | 
                                                                 ->will($this->throwException(new BaseCryptoException()));  | 
                                
                                                            
                                    | 202 | 
                                     | 
                                            } catch (BaseCryptoException $e) { | 
                                
                                                            
                                    | 203 | 
                                     | 
                                                $this->throwException(new CryptoException());  | 
                                
                                                            
                                    | 204 | 
                                     | 
                                            }  | 
                                
                                                            
                                    | 205 | 
                                     | 
                                     | 
                                
                                                            
                                    | 206 | 
                                     | 
                                            $this->wrapper->decryptFileWithKey(__DIR__.'/file.crypto', __DIR__.'/file.txt', $this->getMockBuilder('Mes\Security\CryptoBundle\Model\KeyInterface') | 
                                
                                                            
                                    | 207 | 
                                     | 
                                                                                                                                     ->getMock());  | 
                                
                                                            
                                    | 208 | 
                                     | 
                                        }  | 
                                
                                                            
                                    | 209 | 
                                     | 
                                     | 
                                
                                                            
                                    | 210 | 
                                     | 
                                        /* ========================================  | 
                                
                                                                                
                                 | 
                                
                                    @@ 232-244 (lines=13) @@
                                 | 
                            
                                                            
                                    | 229 | 
                                     | 
                                        /**  | 
                                
                                                            
                                    | 230 | 
                                     | 
                                         * @expectedException \Mes\Security\CryptoBundle\Exception\CryptoException  | 
                                
                                                            
                                    | 231 | 
                                     | 
                                         */  | 
                                
                                                            
                                    | 232 | 
                                     | 
                                        public function testEncryptWithPasswordEncryptsPlaintextThrowsException()  | 
                                
                                                            
                                    | 233 | 
                                     | 
                                        { | 
                                
                                                            
                                    | 234 | 
                                     | 
                                            try { | 
                                
                                                            
                                    | 235 | 
                                     | 
                                                $this->encryption->expects($this->once())  | 
                                
                                                            
                                    | 236 | 
                                     | 
                                                                 ->method('encryptWithPassword') | 
                                
                                                            
                                    | 237 | 
                                     | 
                                                                 ->with('The quick brown fox jumps over the lazy dog', 'SuperSecretPa$$word') | 
                                
                                                            
                                    | 238 | 
                                     | 
                                                                 ->will($this->throwException(new EnvironmentIsBrokenException()));  | 
                                
                                                            
                                    | 239 | 
                                     | 
                                            } catch (EnvironmentIsBrokenException $e) { | 
                                
                                                            
                                    | 240 | 
                                     | 
                                                $this->throwException(new CryptoException());  | 
                                
                                                            
                                    | 241 | 
                                     | 
                                            }  | 
                                
                                                            
                                    | 242 | 
                                     | 
                                     | 
                                
                                                            
                                    | 243 | 
                                     | 
                                            $this->wrapper->encryptWithPassword('The quick brown fox jumps over the lazy dog', 'SuperSecretPa$$word'); | 
                                
                                                            
                                    | 244 | 
                                     | 
                                        }  | 
                                
                                                            
                                    | 245 | 
                                     | 
                                     | 
                                
                                                            
                                    | 246 | 
                                     | 
                                        public function testDecryptWithPasswordDecryptsCiphertext()  | 
                                
                                                            
                                    | 247 | 
                                     | 
                                        { | 
                                
                                                                                
                                 | 
                                
                                    @@ 261-273 (lines=13) @@
                                 | 
                            
                                                            
                                    | 258 | 
                                     | 
                                        /**  | 
                                
                                                            
                                    | 259 | 
                                     | 
                                         * @expectedException \Mes\Security\CryptoBundle\Exception\CryptoException  | 
                                
                                                            
                                    | 260 | 
                                     | 
                                         */  | 
                                
                                                            
                                    | 261 | 
                                     | 
                                        public function testDecryptWithPasswordDecryptsCiphertextThrowsException()  | 
                                
                                                            
                                    | 262 | 
                                     | 
                                        { | 
                                
                                                            
                                    | 263 | 
                                     | 
                                            try { | 
                                
                                                            
                                    | 264 | 
                                     | 
                                                $this->encryption->expects($this->once())  | 
                                
                                                            
                                    | 265 | 
                                     | 
                                                                 ->method('decryptWithPassword') | 
                                
                                                            
                                    | 266 | 
                                     | 
                                                                 ->with('ThisIsACipherText', 'SuperSecretPa$$word') | 
                                
                                                            
                                    | 267 | 
                                     | 
                                                                 ->will($this->throwException(new WrongKeyOrModifiedCiphertextException()));  | 
                                
                                                            
                                    | 268 | 
                                     | 
                                            } catch (BaseCryptoException $e) { | 
                                
                                                            
                                    | 269 | 
                                     | 
                                                $this->throwException(new CryptoException());  | 
                                
                                                            
                                    | 270 | 
                                     | 
                                            }  | 
                                
                                                            
                                    | 271 | 
                                     | 
                                     | 
                                
                                                            
                                    | 272 | 
                                     | 
                                            $this->wrapper->decryptWithPassword('ThisIsACipherText', 'SuperSecretPa$$word'); | 
                                
                                                            
                                    | 273 | 
                                     | 
                                        }  | 
                                
                                                            
                                    | 274 | 
                                     | 
                                     | 
                                
                                                            
                                    | 275 | 
                                     | 
                                        /* ============================================  | 
                                
                                                            
                                    | 276 | 
                                     | 
                                         *  | 
                                
                                                                                
                                 | 
                                
                                    @@ 301-312 (lines=12) @@
                                 | 
                            
                                                            
                                    | 298 | 
                                     | 
                                        /**  | 
                                
                                                            
                                    | 299 | 
                                     | 
                                         * @expectedException \Mes\Security\CryptoBundle\Exception\CryptoException  | 
                                
                                                            
                                    | 300 | 
                                     | 
                                         */  | 
                                
                                                            
                                    | 301 | 
                                     | 
                                        public function testEncryptFileWithPasswordEncryptsFileThrowsException()  | 
                                
                                                            
                                    | 302 | 
                                     | 
                                        { | 
                                
                                                            
                                    | 303 | 
                                     | 
                                            try { | 
                                
                                                            
                                    | 304 | 
                                     | 
                                                $this->encryption->expects($this->once())  | 
                                
                                                            
                                    | 305 | 
                                     | 
                                                                 ->method('encryptFileWithPassword') | 
                                
                                                            
                                    | 306 | 
                                     | 
                                                                 ->will($this->throwException(new EnvironmentIsBrokenException()));  | 
                                
                                                            
                                    | 307 | 
                                     | 
                                            } catch (EnvironmentIsBrokenException $e) { | 
                                
                                                            
                                    | 308 | 
                                     | 
                                                $this->throwException(new CryptoException());  | 
                                
                                                            
                                    | 309 | 
                                     | 
                                            }  | 
                                
                                                            
                                    | 310 | 
                                     | 
                                     | 
                                
                                                            
                                    | 311 | 
                                     | 
                                            $this->wrapper->encryptFileWithPassword(__DIR__.'/file.txt', __DIR__.'/file.crypto', 'SuperSecretPa$$word');  | 
                                
                                                            
                                    | 312 | 
                                     | 
                                        }  | 
                                
                                                            
                                    | 313 | 
                                     | 
                                     | 
                                
                                                            
                                    | 314 | 
                                     | 
                                        public function testDecryptFileWithPasswordDecryptsEncryptedFile()  | 
                                
                                                            
                                    | 315 | 
                                     | 
                                        { | 
                                
                                                                                
                                 | 
                                
                                    @@ 334-345 (lines=12) @@
                                 | 
                            
                                                            
                                    | 331 | 
                                     | 
                                        /**  | 
                                
                                                            
                                    | 332 | 
                                     | 
                                         * @expectedException \Mes\Security\CryptoBundle\Exception\CryptoException  | 
                                
                                                            
                                    | 333 | 
                                     | 
                                         */  | 
                                
                                                            
                                    | 334 | 
                                     | 
                                        public function testDecryptFileWithPasswordDecryptsEncryptedFileThrowsException()  | 
                                
                                                            
                                    | 335 | 
                                     | 
                                        { | 
                                
                                                            
                                    | 336 | 
                                     | 
                                            try { | 
                                
                                                            
                                    | 337 | 
                                     | 
                                                $this->encryption->expects($this->once())  | 
                                
                                                            
                                    | 338 | 
                                     | 
                                                                 ->method('decryptFileWithPassword') | 
                                
                                                            
                                    | 339 | 
                                     | 
                                                                 ->will($this->throwException(new WrongKeyOrModifiedCiphertextException()));  | 
                                
                                                            
                                    | 340 | 
                                     | 
                                            } catch (BaseCryptoException $e) { | 
                                
                                                            
                                    | 341 | 
                                     | 
                                                $this->throwException(new CryptoException());  | 
                                
                                                            
                                    | 342 | 
                                     | 
                                            }  | 
                                
                                                            
                                    | 343 | 
                                     | 
                                     | 
                                
                                                            
                                    | 344 | 
                                     | 
                                            $this->wrapper->decryptFileWithPassword(__DIR__.'/file.crypto', __DIR__.'/file.txt', 'SuperSecretPa$$word');  | 
                                
                                                            
                                    | 345 | 
                                     | 
                                        }  | 
                                
                                                            
                                    | 346 | 
                                     | 
                                    }  | 
                                
                                                            
                                    | 347 | 
                                     | 
                                     |