コード例 #1
0
 public function testSignAndVerifyFromEmbedded()
 {
     $obj = new Statement(['actor' => ['mbox' => COMMON_MBOX], 'verb' => ['id' => COMMON_VERB_ID], 'object' => new Activity(['id' => COMMON_ACTIVITY_ID . '/StatementTest/testSignAndVerifyFromEmbedded'])]);
     $obj->sign('file://' . $GLOBALS['KEYs']['private'], $GLOBALS['KEYs']['password'], ['x5c' => 'file://' . $GLOBALS['KEYs']['public']]);
     $attachment = $obj->getAttachments()[0];
     $this->assertSame($attachment->getUsageType(), 'http://adlnet.gov/expapi/attachments/signature', 'usage type value');
     $this->assertSame($attachment->getContentType(), 'application/octet-stream', 'content type value');
     $result = $obj->verify();
     if (!$result['success']) {
         print $result['reason'];
     }
     $this->assertTrue($result['success'], 'success return value');
 }