/** * Verify the chain file. * * @param int $purpose X509_PURPOSE_* * * @return bool */ public function verify(int $purpose = X509_PURPOSE_ANY) : bool { $chainFile = new TempFile(); $chainFile->setContent($this); $certificate = $this[0]; return $certificate->checkPurpose($purpose, [], $chainFile); }
/** * @param string $mime * @param $chain * * @return bool */ public function verify(string $mime, $chain) : bool { $inputFileName = new TempFile('smime_signed_'); $inputFileName->setContent($mime); $status = openssl_pkcs7_verify($inputFileName, $this->getFlags(), '/dev/null', [], $chain); if (!is_bool($status)) { throw new RuntimeException(OpenSSL::getLastError()); } return $status; }
public function testGetSizeAndCount() { $file = new TempFile(); $file->setContent('foo'); $file->clearStatCache(); $this->assertSame(3, $file->getSize()); $this->assertSame(3, count($file)); $file->append('bar'); $file->clearStatCache(); $this->assertSame(6, $file->getSize()); $this->assertSame(6, count($file)); }