/** * Ensures that the filter allows de/encryption * * @return void */ public function testEncryptionWithDecryptionOpenssl() { if (version_compare(phpversion(), '5.4', '>=')) { $this->markTestIncomplete('Code to test is not compatible with PHP 5.4 '); } if (!extension_loaded('openssl')) { $this->markTestSkipped('Openssl extension not installed'); } $filter = new EncryptFilter(array('adapter' => 'Openssl')); $filter->setPublicKey(__DIR__ . '/_files/publickey.pem'); $output = $filter('teststring'); $envelopekeys = $filter->getEnvelopeKey(); $this->assertNotEquals('teststring', $output); $filter = new DecryptFilter(array('adapter' => 'Openssl')); $filter->setPassphrase('zPUp9mCzIrM7xQOEnPJZiDkBwPBV9UlITY0Xd3v4bfIwzJ12yPQCAkcR5BsePGVw RK6GS5RwXSLrJu9Qj8+fk0wPj6IPY5HvA9Dgwh+dptPlXppeBm3JZJ+92l0DqR2M ccL43V3Z4JN9OXRAfGWXyrBJNmwURkq7a2EyFElBBWK03OLYVMevQyRJcMKY0ai+ tmnFUSkH2zwnkXQfPUxg9aV7TmGQv/3TkK1SziyDyNm7GwtyIlfcigCCRz3uc77U Izcez5wgmkpNElg/D7/VCd9E+grTfPYNmuTVccGOes+n8ISJJdW0vYX1xwWv5l bK22CwD/l7SMBOz4M9XH0Jb0OhNxLza4XMDu0ANMIpnkn1KOcmQ4gB8fmAbBt'); $filter->setPrivateKey(__DIR__ . '/_files/privatekey.pem'); $filter->setEnvelopeKey($envelopekeys); $input = $filter($output); $this->assertEquals('teststring', trim($input)); }