Rev 868 | Rev 877 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 868 | Rev 870 | ||
---|---|---|---|
Line 439... | Line 439... | ||
439 | ); |
439 | ); |
440 | 440 | ||
441 | $json = json_encode($ary); |
441 | $json = json_encode($ary); |
442 | 442 | ||
443 | if (OIDplus::getPkiStatus()) { |
443 | if (OIDplus::getPkiStatus()) { |
- | 444 | try { |
|
444 | require_once __DIR__.'/json/security.inc.php'; |
445 | require_once __DIR__.'/json/security.inc.php'; |
445 | $json = oidplus_json_sign($json, OIDplus::getSystemPrivateKey(), OIDplus::getSystemPublicKey()); |
446 | $json = oidplus_json_sign($json, OIDplus::getSystemPrivateKey(), OIDplus::getSystemPublicKey()); |
- | 447 | } catch (Exception $e) { |
|
- | 448 | } |
|
446 | } |
449 | } |
447 | 450 | ||
448 | // Good JSON schema validator here: https://www.jsonschemavalidator.net |
451 | // Good JSON schema validator here: https://www.jsonschemavalidator.net |
449 | header('Content-Type:application/json; charset=UTF-8'); |
452 | header('Content-Type:application/json; charset=UTF-8'); |
450 | echo $json; |
453 | echo $json; |
Line 473... | Line 476... | ||
473 | ' xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"'. |
476 | ' xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"'. |
474 | ' xsi:schemaLocation="'.XML_URN.' '.XML_URN_URL.'">'. |
477 | ' xsi:schemaLocation="'.XML_URN.' '.XML_URN_URL.'">'. |
475 | $xml. |
478 | $xml. |
476 | '</root>'; |
479 | '</root>'; |
477 | 480 | ||
478 | if (OIDplus::getPkiStatus()) { |
481 | if (!OIDplus::getPkiStatus()) { |
- | 482 | $xml .= '<!-- Cannot add signature: OIDplus PKI is not initialized (OpenSSL missing?) -->'; |
|
- | 483 | } else if (!class_exists('DOMDocument')) { |
|
- | 484 | $xml .= '<!-- Cannot add signature: "PHP-XML" extension not installed -->'; |
|
- | 485 | } else { |
|
- | 486 | try { |
|
479 | require_once __DIR__.'/xml/security.inc.php'; |
487 | require_once __DIR__.'/xml/security.inc.php'; |
480 | $xml = oidplus_xml_sign($xml, OIDplus::getSystemPrivateKey(), OIDplus::getSystemPublicKey()); |
488 | $xml = oidplus_xml_sign($xml, OIDplus::getSystemPrivateKey(), OIDplus::getSystemPublicKey()); |
- | 489 | } catch (Exception $e) { |
|
- | 490 | $xml .= '<!-- Cannot add signature: '.$e.' -->'; |
|
- | 491 | } |
|
481 | } |
492 | } |
482 | 493 | ||
483 | header('Content-Type:application/xml; charset=UTF-8'); |
494 | header('Content-Type:application/xml; charset=UTF-8'); |
484 | echo $xml; |
495 | echo $xml; |
485 | } |
496 | } |