コード例 #1
0
ファイル: Chain.php プロジェクト: blar/openssl
 /**
  * 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);
 }
コード例 #2
0
ファイル: Pkcs7.php プロジェクト: blar/openssl
 /**
  * @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;
 }
コード例 #3
0
ファイル: TempFileTest.php プロジェクト: blar/filesystem
 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));
 }