Rev 868 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 868 | Rev 1130 | ||
---|---|---|---|
Line 20... | Line 20... | ||
20 | // Works with composer.json |
20 | // Works with composer.json |
21 | // "robrichards/xmlseclibs": "^3.1" |
21 | // "robrichards/xmlseclibs": "^3.1" |
22 | // or |
22 | // or |
23 | // "selective/xmldsig": "^2.4" |
23 | // "selective/xmldsig": "^2.4" |
24 | 24 | ||
- | 25 | /** |
|
- | 26 | * @param string $xml_content |
|
- | 27 | * @param string $pubkey |
|
- | 28 | * @return void |
|
- | 29 | * @throws Exception |
|
- | 30 | */ |
|
25 | function oidplus_xml_verify($xml_content, $pubkey) { |
31 | function oidplus_xml_verify(string $xml_content, string $pubkey) { |
26 | require_once __DIR__.'/vendor/autoload.php'; |
32 | require_once __DIR__.'/vendor/autoload.php'; |
27 | 33 | ||
28 | $sig_ok = false; |
34 | $sig_ok = false; |
29 | if (class_exists('\RobRichards\XMLSecLibs\XMLSecurityDSig')) { |
35 | if (class_exists('\RobRichards\XMLSecLibs\XMLSecurityDSig')) { |
30 | // Template: https://github.com/robrichards/xmlseclibs/blob/master/tests/xmlsec-verify.phpt |
36 | // Template: https://github.com/robrichards/xmlseclibs/blob/master/tests/xmlsec-verify.phpt |
Line 73... | Line 79... | ||
73 | if (!$sig_ok) { |
79 | if (!$sig_ok) { |
74 | throw new Exception("Signature verification failed!"); |
80 | throw new Exception("Signature verification failed!"); |
75 | } |
81 | } |
76 | } |
82 | } |
77 | 83 | ||
- | 84 | /** |
|
- | 85 | * @param string $xml_content |
|
- | 86 | * @param string $privkey |
|
- | 87 | * @param string $pubkey |
|
- | 88 | * @return false|string|void |
|
- | 89 | * @throws Exception |
|
- | 90 | */ |
|
78 | function oidplus_xml_sign($xml_content, $privkey, $pubkey) { |
91 | function oidplus_xml_sign(string $xml_content, string $privkey, string $pubkey) { |
79 | require_once __DIR__.'/vendor/autoload.php'; |
92 | require_once __DIR__.'/vendor/autoload.php'; |
80 | 93 | ||
81 | if (class_exists('\RobRichards\XMLSecLibs\XMLSecurityDSig')) { |
94 | if (class_exists('\RobRichards\XMLSecLibs\XMLSecurityDSig')) { |
82 | // Template: https://github.com/robrichards/xmlseclibs/blob/master/README.md |
95 | // Template: https://github.com/robrichards/xmlseclibs/blob/master/README.md |
83 | 96 |