/** * @depends testGenerateIv */ function testConcatIv($iv) { $catFile = Encryption\Crypt::concatIv($this->dataLong, $iv); // Fetch encryption metadata from end of file $meta = substr($catFile, -22); $identifier = substr($meta, 0, 6); // Fetch IV from end of file $foundIv = substr($meta, 6); $this->assertEquals('00iv00', $identifier); $this->assertEquals($iv, $foundIv); // Remove IV and IV identifier text to expose encrypted content $data = substr($catFile, 0, -22); $this->assertEquals($this->dataLong, $data); return array('iv' => $iv, 'catfile' => $catFile); }