示例#1
0
文件: ReaderTest.php 项目: sqon/sqon
 /**
  * Verify that the signature can be read.
  */
 public function testReadFileSignatureFromSqon()
 {
     $file = new File('php://memory', 'w+');
     $file->write(hash('sha1', 'test', true));
     $file->seek(0);
     $reader = new Reader($file);
     self::assertEquals(hash('sha1', 'test', true), $reader->getSignature(), 'The signature was not properly read from the Sqon.');
 }
示例#2
0
文件: Sqon.php 项目: sqon/sqon
 /**
  * {@inheritdoc}
  */
 public static function isValid($path)
 {
     $file = new File($path, 'r');
     $reader = new Reader($file);
     $signature = new Signature();
     return $reader->getSignature() === $signature->generate($file, true);
 }