@@ -16,7 +16,7 @@ discard block |
||
16 | 16 | |
17 | 17 | // extract request parameters; action is mandatory |
18 | 18 | if(!isset($_REQUEST['action'])) |
19 | - exit; |
|
19 | + exit; |
|
20 | 20 | |
21 | 21 | $action = $_REQUEST['action']; |
22 | 22 | $id = ( isset($_REQUEST['id']) ? $_REQUEST['id'] : FALSE ); |
@@ -48,7 +48,7 @@ discard block |
||
48 | 48 | break; |
49 | 49 | case 'listIdentityProviders': |
50 | 50 | if(! $federation) |
51 | - $federation = $id; |
|
51 | + $federation = $id; |
|
52 | 52 | $API->JSON_listIdentityProviders($federation); |
53 | 53 | break; |
54 | 54 | case 'listAllIdentityProviders': |
@@ -56,13 +56,13 @@ discard block |
||
56 | 56 | break; |
57 | 57 | case 'listProfiles': // needs $idp set - abort if not |
58 | 58 | if(! $idp) |
59 | - $idp = $id; |
|
59 | + $idp = $id; |
|
60 | 60 | if ($idp === FALSE) exit; |
61 | 61 | $API->JSON_listProfiles($idp,$sort); |
62 | 62 | break; |
63 | 63 | case 'listDevices': |
64 | 64 | if(! $profile) |
65 | - $profile = $id; |
|
65 | + $profile = $id; |
|
66 | 66 | $API->JSON_listDevices($profile); |
67 | 67 | break; |
68 | 68 | case 'generateInstaller': // needs $id and $profile set |
@@ -79,13 +79,13 @@ discard block |
||
79 | 79 | break; |
80 | 80 | case 'profileAttributes': // needs $id set |
81 | 81 | if(! $profile) |
82 | - $profile = $id; |
|
82 | + $profile = $id; |
|
83 | 83 | if ($profile === FALSE) exit; |
84 | 84 | $API->JSON_profileAttributes($profile); |
85 | 85 | break; |
86 | 86 | case 'sendLogo': // needs $id and $disco set |
87 | 87 | if(! $idp) |
88 | - $idp = $id; |
|
88 | + $idp = $id; |
|
89 | 89 | if ($idp === FALSE) exit; |
90 | 90 | $API->sendLogo($idp, $disco,$width,$height); |
91 | 91 | break; |
@@ -103,11 +103,11 @@ discard block |
||
103 | 103 | break; |
104 | 104 | case 'orderIdentityProviders': |
105 | 105 | if(! $federation) |
106 | - $federation = $id; |
|
107 | - if($location) { |
|
106 | + $federation = $id; |
|
107 | + if($location) { |
|
108 | 108 | $A=explode(':',$location); |
109 | 109 | $L = ['lat'=>$A[0],'lon'=>$A[1]]; |
110 | - } else |
|
110 | + } else |
|
111 | 111 | $L = NULL; |
112 | 112 | $API->JSON_orderIdentityProviders($federation,$L); |
113 | 113 | break; |
@@ -23,33 +23,33 @@ discard block |
||
23 | 23 | //debug(4,$_REQUEST); |
24 | 24 | |
25 | 25 | /** |
26 | - * Menu class helps to define the menu on the main page |
|
27 | - */ |
|
26 | + * Menu class helps to define the menu on the main page |
|
27 | + */ |
|
28 | 28 | class Menu { |
29 | 29 | /** |
30 | - * the constructor takes an array argument defining menu items. |
|
31 | - * the array must be indexed by strings which will be passed to user/cat_info.php a the page argument |
|
32 | - * the values of the array can be either a simple string which is passed to user/cat_info.php |
|
33 | - * as the title argument or an two element array - the first element of this array will be |
|
34 | - * the title and the second is a style specification applied to the given menu item |
|
30 | + * the constructor takes an array argument defining menu items. |
|
31 | + * the array must be indexed by strings which will be passed to user/cat_info.php a the page argument |
|
32 | + * the values of the array can be either a simple string which is passed to user/cat_info.php |
|
33 | + * as the title argument or an two element array - the first element of this array will be |
|
34 | + * the title and the second is a style specification applied to the given menu item |
|
35 | 35 | */ |
36 | 36 | public function __construct($menu_array) { |
37 | - $this->menu = $menu_array; |
|
37 | + $this->menu = $menu_array; |
|
38 | 38 | } |
39 | 39 | |
40 | 40 | private function printMenuLine($index,$title="",$style="") { |
41 | 41 | if ($style !== "") |
42 | - print "<tr><td style='$style'><a href='javascript:infoCAT(\"$index\",\"".rawurlencode($title)."\")'>$title</a></td></tr>\n"; |
|
42 | + print "<tr><td style='$style'><a href='javascript:infoCAT(\"$index\",\"".rawurlencode($title)."\")'>$title</a></td></tr>\n"; |
|
43 | 43 | else |
44 | - print "<tr><td><a href='javascript:infoCAT(\"$index\",\"".rawurlencode($title)."\")'>$title</a></td></tr>\n"; |
|
44 | + print "<tr><td><a href='javascript:infoCAT(\"$index\",\"".rawurlencode($title)."\")'>$title</a></td></tr>\n"; |
|
45 | 45 | } |
46 | 46 | |
47 | 47 | public function printMenu() { |
48 | - foreach ($this->menu as $index => $title) |
|
49 | - if(is_array($title)) |
|
50 | - $this->printMenuLine($index,$title[0],$title[1]); |
|
51 | - else |
|
52 | - $this->printMenuLine($index,$title); |
|
48 | + foreach ($this->menu as $index => $title) |
|
49 | + if(is_array($title)) |
|
50 | + $this->printMenuLine($index,$title[0],$title[1]); |
|
51 | + else |
|
52 | + $this->printMenuLine($index,$title); |
|
53 | 53 | } |
54 | 54 | |
55 | 55 | private $menu; |
@@ -94,7 +94,7 @@ discard block |
||
94 | 94 | $OS = $Gui->detectOS(); |
95 | 95 | debug(4,$OS); |
96 | 96 | if($OS) |
97 | - print "recognised_os = '".$OS['device']."';\n"; |
|
97 | + print "recognised_os = '".$OS['device']."';\n"; |
|
98 | 98 | $download_message = sprintf(_("Download your %s installer"),Config::$CONSORTIUM['name']); |
99 | 99 | print 'download_message = "'.$download_message.'";'; |
100 | 100 | //TODO modify this based on OS detection |
@@ -149,13 +149,13 @@ discard block |
||
149 | 149 | <table id="left_menu"> |
150 | 150 | <?php |
151 | 151 | $menu = new Menu( [ |
152 | - "about_consortium"=>[sprintf(_("About %s"), Config::$CONSORTIUM['name']),'padding-bottom:20px;font-weight: bold; '], |
|
153 | - "about"=>sprintf(_("About %s"), Config::$APPEARANCE['productname']), |
|
154 | - "tou"=>sprintf(_("Terms of use")), |
|
155 | - "faq"=>sprintf(_("FAQ")), |
|
156 | - "report"=>sprintf(_("Report a problem")), |
|
157 | - "develop"=>sprintf(_("Become a CAT developer")), |
|
158 | - "admin"=>[sprintf(_("%s admin:<br>manage your IdP"), Config::$CONSORTIUM['name']),'padding-top:30px;'], |
|
152 | + "about_consortium"=>[sprintf(_("About %s"), Config::$CONSORTIUM['name']),'padding-bottom:20px;font-weight: bold; '], |
|
153 | + "about"=>sprintf(_("About %s"), Config::$APPEARANCE['productname']), |
|
154 | + "tou"=>sprintf(_("Terms of use")), |
|
155 | + "faq"=>sprintf(_("FAQ")), |
|
156 | + "report"=>sprintf(_("Report a problem")), |
|
157 | + "develop"=>sprintf(_("Become a CAT developer")), |
|
158 | + "admin"=>[sprintf(_("%s admin:<br>manage your IdP"), Config::$CONSORTIUM['name']),'padding-top:30px;'], |
|
159 | 159 | ]); |
160 | 160 | |
161 | 161 | $menu->printMenu(); ?> |
@@ -224,9 +224,9 @@ discard block |
||
224 | 224 | <strong><?php echo _("Welcome aboard the eduroam® user community!")?></strong> |
225 | 225 | <p> |
226 | 226 | <span id="download_info"><?php |
227 | - /// the empty href is dynamically exchanged with the actual path by jQuery at runtime |
|
228 | - echo _("Your download will start shortly. In case of problems with the automatic download please use this direct <a href=''>link</a>."); |
|
229 | - ?></span> |
|
227 | + /// the empty href is dynamically exchanged with the actual path by jQuery at runtime |
|
228 | + echo _("Your download will start shortly. In case of problems with the automatic download please use this direct <a href=''>link</a>."); |
|
229 | + ?></span> |
|
230 | 230 | <p> |
231 | 231 | <?php printf(_("Dear user from %s,"),"<span class='inst_name'></span>") ?> |
232 | 232 | <br/> |
@@ -338,14 +338,14 @@ discard block |
||
338 | 338 | </td> |
339 | 339 | <td style="padding-left:80px; text-align:right;"> |
340 | 340 | <?php |
341 | - if (Config::$CONSORTIUM['name'] == "eduroam" && isset(Config::$CONSORTIUM['deployment-voodoo']) && Config::$CONSORTIUM['deployment-voodoo'] == "Operations Team") // SW: APPROVED |
|
342 | - echo " |
|
341 | + if (Config::$CONSORTIUM['name'] == "eduroam" && isset(Config::$CONSORTIUM['deployment-voodoo']) && Config::$CONSORTIUM['deployment-voodoo'] == "Operations Team") // SW: APPROVED |
|
342 | + echo " |
|
343 | 343 | <span id='logos' style='position:fixed; left:50%;'><img src='resources/images/dante.png' alt='DANTE' style='height:23px;width:47px'/> |
344 | 344 | <img src='resources/images/eu.png' alt='EU' style='height:23px;width:27px;border-width:0px;'/></span> |
345 | 345 | <span id='eu_text' style='text-align:right;'><a href='http://ec.europa.eu/dgs/connect/index_en.htm' style='text-decoration:none; vertical-align:top;'>European Commission Communications Networks, Content and Technology</a></span>"; |
346 | - else |
|
347 | - echo " "; |
|
348 | - ?> |
|
346 | + else |
|
347 | + echo " "; |
|
348 | + ?> |
|
349 | 349 | </td> |
350 | 350 | </tr> |
351 | 351 | </table> |
@@ -42,8 +42,8 @@ |
||
42 | 42 | $p = new Profile($profile_id); |
43 | 43 | |
44 | 44 | if(!$p->institution || $p->institution !== $inst_id) { |
45 | - header("HTTP/1.0 404 Not Found"); |
|
46 | - return; |
|
45 | + header("HTTP/1.0 404 Not Found"); |
|
46 | + return; |
|
47 | 47 | } |
48 | 48 | |
49 | 49 | // now we generate the installer |
@@ -205,14 +205,14 @@ |
||
205 | 205 | </td> |
206 | 206 | <td style="padding-left:80px; padding-right:20px; text-align:right; vertical-align:top;"> |
207 | 207 | <?php |
208 | - if (Config::$CONSORTIUM['name'] == "eduroam" && isset(Config::$CONSORTIUM['deployment-voodoo']) && Config::$CONSORTIUM['deployment-voodoo'] == "Operations Team") // SW: APPROVED |
|
209 | - echo " |
|
208 | + if (Config::$CONSORTIUM['name'] == "eduroam" && isset(Config::$CONSORTIUM['deployment-voodoo']) && Config::$CONSORTIUM['deployment-voodoo'] == "Operations Team") // SW: APPROVED |
|
209 | + echo " |
|
210 | 210 | <span id='logos' style='position:fixed; left:50%;'><img src='resources/images/dante.png' alt='DANTE' style='height:23px;width:47px'/> |
211 | 211 | <img src='resources/images/eu.png' alt='EU' style='height:23px;width:27px;border-width:0px;'/></span> |
212 | 212 | <span id='eu_text' style='text-align:right;'><a href='http://ec.europa.eu/dgs/connect/index_en.htm' style='text-decoration:none; vertical-align:top;'>European Commission Communications Networks, Content and Technology</a></span>"; |
213 | - else |
|
214 | - echo " "; |
|
215 | - ?> |
|
213 | + else |
|
214 | + echo " "; |
|
215 | + ?> |
|
216 | 216 | </td> |
217 | 217 | </tr> |
218 | 218 | </table> |
@@ -191,9 +191,9 @@ |
||
191 | 191 | * gets the language setting in CAT |
192 | 192 | */ |
193 | 193 | static public function get_lang() { |
194 | - if(self::$LANG === '') |
|
195 | - list(self::$LANG, $xx) = self::set_lang(); |
|
196 | - return self::$LANG; |
|
194 | + if(self::$LANG === '') |
|
195 | + list(self::$LANG, $xx) = self::set_lang(); |
|
196 | + return self::$LANG; |
|
197 | 197 | } |
198 | 198 | |
199 | 199 | /** |
@@ -74,32 +74,32 @@ discard block |
||
74 | 74 | * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
75 | 75 | */ |
76 | 76 | |
77 | - // Encoding modes |
|
77 | + // Encoding modes |
|
78 | 78 | |
79 | - define('QR_MODE_NUL', -1); |
|
80 | - define('QR_MODE_NUM', 0); |
|
81 | - define('QR_MODE_AN', 1); |
|
82 | - define('QR_MODE_8', 2); |
|
83 | - define('QR_MODE_KANJI', 3); |
|
84 | - define('QR_MODE_STRUCTURE', 4); |
|
85 | - |
|
86 | - // Levels of error correction. |
|
87 | - |
|
88 | - define('QR_ECLEVEL_L', 0); |
|
89 | - define('QR_ECLEVEL_M', 1); |
|
90 | - define('QR_ECLEVEL_Q', 2); |
|
91 | - define('QR_ECLEVEL_H', 3); |
|
79 | + define('QR_MODE_NUL', -1); |
|
80 | + define('QR_MODE_NUM', 0); |
|
81 | + define('QR_MODE_AN', 1); |
|
82 | + define('QR_MODE_8', 2); |
|
83 | + define('QR_MODE_KANJI', 3); |
|
84 | + define('QR_MODE_STRUCTURE', 4); |
|
85 | + |
|
86 | + // Levels of error correction. |
|
87 | + |
|
88 | + define('QR_ECLEVEL_L', 0); |
|
89 | + define('QR_ECLEVEL_M', 1); |
|
90 | + define('QR_ECLEVEL_Q', 2); |
|
91 | + define('QR_ECLEVEL_H', 3); |
|
92 | 92 | |
93 | - // Supported output formats |
|
93 | + // Supported output formats |
|
94 | 94 | |
95 | - define('QR_FORMAT_TEXT', 0); |
|
96 | - define('QR_FORMAT_PNG', 1); |
|
95 | + define('QR_FORMAT_TEXT', 0); |
|
96 | + define('QR_FORMAT_PNG', 1); |
|
97 | 97 | |
98 | - class qrstr { |
|
99 | - public static function set(&$srctab, $x, $y, $repl, $replLen = false) { |
|
100 | - $srctab[$y] = substr_replace($srctab[$y], ($replLen !== false)?substr($repl,0,$replLen):$repl, $x, ($replLen !== false)?$replLen:strlen($repl)); |
|
101 | - } |
|
102 | - } |
|
98 | + class qrstr { |
|
99 | + public static function set(&$srctab, $x, $y, $repl, $replLen = false) { |
|
100 | + $srctab[$y] = substr_replace($srctab[$y], ($replLen !== false)?substr($repl,0,$replLen):$repl, $x, ($replLen !== false)?$replLen:strlen($repl)); |
|
101 | + } |
|
102 | + } |
|
103 | 103 | |
104 | 104 | |
105 | 105 | |
@@ -211,9 +211,9 @@ discard block |
||
211 | 211 | //---------------------------------------------------------------------- |
212 | 212 | public static function buildCache() |
213 | 213 | { |
214 | - QRtools::markTime('before_build_cache'); |
|
214 | + QRtools::markTime('before_build_cache'); |
|
215 | 215 | |
216 | - $mask = new QRmask(); |
|
216 | + $mask = new QRmask(); |
|
217 | 217 | for ($a=1; $a <= QRSPEC_VERSION_MAX; $a++) { |
218 | 218 | $frame = QRspec::newFrame($a); |
219 | 219 | if (QR_IMAGE) { |
@@ -221,13 +221,13 @@ discard block |
||
221 | 221 | QRimage::png(self::binarize($frame), $fileName, 1, 0); |
222 | 222 | } |
223 | 223 | |
224 | - $width = count($frame); |
|
225 | - $bitMask = array_fill(0, $width, array_fill(0, $width, 0)); |
|
226 | - for ($maskNo=0; $maskNo<8; $maskNo++) |
|
227 | - $mask->makeMaskNo($maskNo, $width, $frame, $bitMask, true); |
|
224 | + $width = count($frame); |
|
225 | + $bitMask = array_fill(0, $width, array_fill(0, $width, 0)); |
|
226 | + for ($maskNo=0; $maskNo<8; $maskNo++) |
|
227 | + $mask->makeMaskNo($maskNo, $width, $frame, $bitMask, true); |
|
228 | 228 | } |
229 | 229 | |
230 | - QRtools::markTime('after_build_cache'); |
|
230 | + QRtools::markTime('after_build_cache'); |
|
231 | 231 | } |
232 | 232 | |
233 | 233 | //---------------------------------------------------------------------- |
@@ -647,10 +647,10 @@ discard block |
||
647 | 647 | |
648 | 648 | // Version information pattern ----------------------------------------- |
649 | 649 | |
650 | - // Version information pattern (BCH coded). |
|
650 | + // Version information pattern (BCH coded). |
|
651 | 651 | // See Table 1 in Appendix D (pp.68) of JIS X0510:2004. |
652 | 652 | |
653 | - // size: [QRSPEC_VERSION_MAX - 6] |
|
653 | + // size: [QRSPEC_VERSION_MAX - 6] |
|
654 | 654 | |
655 | 655 | public static $versionPattern = [ |
656 | 656 | 0x07c94, 0x085bc, 0x09a99, 0x0a4d3, 0x0bbf6, 0x0c762, 0x0d847, 0x0e60d, |
@@ -1438,7 +1438,7 @@ discard block |
||
1438 | 1438 | -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, |
1439 | 1439 | -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, |
1440 | 1440 | 36, -1, -1, -1, 37, 38, -1, -1, -1, -1, 39, 40, -1, 41, 42, 43, |
1441 | - 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 44, -1, -1, -1, -1, -1, |
|
1441 | + 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 44, -1, -1, -1, -1, -1, |
|
1442 | 1442 | -1, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, |
1443 | 1443 | 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, -1, -1, -1, -1, -1, |
1444 | 1444 | -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, |
@@ -2500,17 +2500,17 @@ discard block |
||
2500 | 2500 | * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
2501 | 2501 | */ |
2502 | 2502 | |
2503 | - define('N1', 3); |
|
2504 | - define('N2', 3); |
|
2505 | - define('N3', 40); |
|
2506 | - define('N4', 10); |
|
2503 | + define('N1', 3); |
|
2504 | + define('N2', 3); |
|
2505 | + define('N3', 40); |
|
2506 | + define('N4', 10); |
|
2507 | 2507 | |
2508 | - class QRmask { |
|
2508 | + class QRmask { |
|
2509 | 2509 | |
2510 | - public $runLength = []; |
|
2510 | + public $runLength = []; |
|
2511 | 2511 | |
2512 | - //---------------------------------------------------------------------- |
|
2513 | - public function __construct() |
|
2512 | + //---------------------------------------------------------------------- |
|
2513 | + public function __construct() |
|
2514 | 2514 | { |
2515 | 2515 | $this->runLength = array_fill(0, QRSPEC_WIDTH_MAX + 1, 0); |
2516 | 2516 | } |
@@ -328,7 +328,6 @@ |
||
328 | 328 | * - RETVAL_NOT_CONFIGURED; needs Config::$RADIUSTESTS['TLS-discoverytag'] |
329 | 329 | * - RETVAL_INVALID (at least one format error) |
330 | 330 | * - RETVAL_OK (all fine) |
331 | - |
|
332 | 331 | * @return int one of two RETVALs above |
333 | 332 | */ |
334 | 333 | public function NAPTR_compliance() { |
@@ -33,42 +33,42 @@ discard block |
||
33 | 33 | * @author http://php.net/manual/en/ref.openssl.php (comment from 29-Mar-2007) |
34 | 34 | */ |
35 | 35 | public function pem2der($pem_data) { |
36 | - $begin = "CERTIFICATE-----"; |
|
37 | - $end = "-----END"; |
|
38 | - $pem_data = substr($pem_data, strpos($pem_data, $begin)+strlen($begin)); |
|
39 | - $pem_data = substr($pem_data, 0, strpos($pem_data, $end)); |
|
40 | - $der = base64_decode($pem_data); |
|
41 | - return $der; |
|
36 | + $begin = "CERTIFICATE-----"; |
|
37 | + $end = "-----END"; |
|
38 | + $pem_data = substr($pem_data, strpos($pem_data, $begin)+strlen($begin)); |
|
39 | + $pem_data = substr($pem_data, 0, strpos($pem_data, $end)); |
|
40 | + $der = base64_decode($pem_data); |
|
41 | + return $der; |
|
42 | 42 | } |
43 | 43 | |
44 | 44 | public function der2pem($der_data) { |
45 | - $pem = chunk_split(base64_encode($der_data), 64, "\n"); |
|
46 | - $pem = "-----BEGIN CERTIFICATE-----\n".$pem."-----END CERTIFICATE-----\n"; |
|
47 | - return $pem; |
|
45 | + $pem = chunk_split(base64_encode($der_data), 64, "\n"); |
|
46 | + $pem = "-----BEGIN CERTIFICATE-----\n".$pem."-----END CERTIFICATE-----\n"; |
|
47 | + return $pem; |
|
48 | 48 | } |
49 | 49 | /** |
50 | - * prepare PEM and DER formats, MD5 and SHA1 fingerprints and subject of the certificate |
|
51 | - * |
|
52 | - * returns an array with the following fields: |
|
53 | - * <pre> uuid |
|
54 | - * pem certificate in PEM format |
|
55 | - * der certificate in DER format |
|
56 | - * md5 MD5 fingerprint |
|
57 | - * sha1 SHA1 fingerprint |
|
58 | - * name certificate subject |
|
59 | - * root value 1 if root certificate 0 otherwise |
|
60 | - * ca value 1 if CA certificate 0 otherwise |
|
61 | - * |
|
62 | - * </pre> |
|
63 | - * @param blob $cadata certificate in ether PEM or DER format |
|
64 | - * @return array |
|
65 | - */ |
|
50 | + * prepare PEM and DER formats, MD5 and SHA1 fingerprints and subject of the certificate |
|
51 | + * |
|
52 | + * returns an array with the following fields: |
|
53 | + * <pre> uuid |
|
54 | + * pem certificate in PEM format |
|
55 | + * der certificate in DER format |
|
56 | + * md5 MD5 fingerprint |
|
57 | + * sha1 SHA1 fingerprint |
|
58 | + * name certificate subject |
|
59 | + * root value 1 if root certificate 0 otherwise |
|
60 | + * ca value 1 if CA certificate 0 otherwise |
|
61 | + * |
|
62 | + * </pre> |
|
63 | + * @param blob $cadata certificate in ether PEM or DER format |
|
64 | + * @return array |
|
65 | + */ |
|
66 | 66 | public function processCertificate ($cadata) { |
67 | 67 | $begin_pem = strpos($cadata,"-----BEGIN CERTIFICATE-----"); |
68 | - if($begin_pem !== FALSE) { |
|
68 | + if($begin_pem !== FALSE) { |
|
69 | 69 | $end_c = strpos($cadata,"-----END CERTIFICATE-----") + 25; |
70 | 70 | if($end_c !== FALSE) { |
71 | - $cadata = substr($cadata,$begin_pem,$end_c - $begin_pem); |
|
71 | + $cadata = substr($cadata,$begin_pem,$end_c - $begin_pem); |
|
72 | 72 | } |
73 | 73 | $ca_der = X509::pem2der($cadata); |
74 | 74 | $ca_pem = X509::der2pem($ca_der); |
@@ -91,25 +91,25 @@ discard block |
||
91 | 91 | $out = ["uuid" => uuid(), "pem" => $ca_pem, "der" => $ca_der, "md5"=>$md5, "sha1"=>$sha1, "name"=>$mydetails['name']]; |
92 | 92 | $diff_a = array_diff($mydetails['issuer'], $mydetails['subject']); |
93 | 93 | if(count($diff_a) == 0 ) { |
94 | - $out['root'] = 1; |
|
95 | - $mydetails['type'] = 'root'; |
|
94 | + $out['root'] = 1; |
|
95 | + $mydetails['type'] = 'root'; |
|
96 | 96 | } else { |
97 | - $out['root'] = 0; |
|
97 | + $out['root'] = 0; |
|
98 | 98 | } |
99 | 99 | // if no basicContraints are set at all, this is a problem in itself |
100 | 100 | // is this a CA? or not? Treat as server, but add a warning... |
101 | 101 | if (isset($mydetails['extensions']['basicConstraints'])) { |
102 | - $out['ca'] = preg_match('/^CA:TRUE/',$mydetails['extensions']['basicConstraints']); |
|
103 | - $out['basicconstraints_set'] = 1; |
|
102 | + $out['ca'] = preg_match('/^CA:TRUE/',$mydetails['extensions']['basicConstraints']); |
|
103 | + $out['basicconstraints_set'] = 1; |
|
104 | 104 | } else { |
105 | - $out['ca'] = 0; // we need to resolve this ambiguity |
|
106 | - $out['basicconstraints_set'] = 0; |
|
105 | + $out['ca'] = 0; // we need to resolve this ambiguity |
|
106 | + $out['basicconstraints_set'] = 0; |
|
107 | 107 | } |
108 | 108 | |
109 | 109 | if( $out['ca'] > 0 && $out['root'] == 0 ) |
110 | - $mydetails['type'] = 'interm_ca'; |
|
110 | + $mydetails['type'] = 'interm_ca'; |
|
111 | 111 | if( $out['ca'] == 0 && $out['root'] == 0 ) |
112 | - $mydetails['type'] = 'server'; |
|
112 | + $mydetails['type'] = 'server'; |
|
113 | 113 | $mydetails['sha1'] = $sha1; |
114 | 114 | $out['full_details'] = $mydetails; |
115 | 115 | |
@@ -119,51 +119,51 @@ discard block |
||
119 | 119 | |
120 | 120 | openssl_x509_export($myca, $output, FALSE); |
121 | 121 | if(preg_match('/^\s+Signature Algorithm:\s*(.*)\s*$/m', $output, $match)) |
122 | - $out['full_details']['signature_algorithm'] = $match[1]; |
|
122 | + $out['full_details']['signature_algorithm'] = $match[1]; |
|
123 | 123 | else |
124 | - $out['full_details']['signature_algorithm'] = $output; |
|
124 | + $out['full_details']['signature_algorithm'] = $output; |
|
125 | 125 | |
126 | 126 | if((preg_match('/^\s+Public-Key:\s*\((.*) bit\)\s*$/m', $output, $match)) && is_numeric($match[1])) |
127 | - $out['full_details']['public_key_length'] = $match[1]; |
|
127 | + $out['full_details']['public_key_length'] = $match[1]; |
|
128 | 128 | else |
129 | - $out['full_details']['public_key_length'] = $output; |
|
129 | + $out['full_details']['public_key_length'] = $output; |
|
130 | 130 | |
131 | 131 | return $out; |
132 | 132 | } |
133 | 133 | |
134 | 134 | /** |
135 | - * split a certificate file into components |
|
136 | - * |
|
137 | - * returns an array containing the PEM format of the certificate (s) |
|
138 | - * if the file contains multiple certificates it gets split into components |
|
139 | - * |
|
140 | - * @param blob $cadata certificate in ether PEM or DER format |
|
141 | - * @return array |
|
142 | - */ |
|
135 | + * split a certificate file into components |
|
136 | + * |
|
137 | + * returns an array containing the PEM format of the certificate (s) |
|
138 | + * if the file contains multiple certificates it gets split into components |
|
139 | + * |
|
140 | + * @param blob $cadata certificate in ether PEM or DER format |
|
141 | + * @return array |
|
142 | + */ |
|
143 | 143 | |
144 | 144 | public function splitCertificate($cadata) { |
145 | - $returnarray = []; |
|
146 | - // maybe we got no real cert data at all? The code is hardened, but will |
|
147 | - // produce ugly WARNING level output in the logfiles, so let's avoid at least |
|
148 | - // the trivial case: if the file is empty, there's no cert in it |
|
149 | - if ($cadata == "") |
|
150 | - return $returnarray; |
|
151 | - $start_c = strpos($cadata,"-----BEGIN CERTIFICATE-----" ); |
|
152 | - if( $start_c !== FALSE) { |
|
145 | + $returnarray = []; |
|
146 | + // maybe we got no real cert data at all? The code is hardened, but will |
|
147 | + // produce ugly WARNING level output in the logfiles, so let's avoid at least |
|
148 | + // the trivial case: if the file is empty, there's no cert in it |
|
149 | + if ($cadata == "") |
|
150 | + return $returnarray; |
|
151 | + $start_c = strpos($cadata,"-----BEGIN CERTIFICATE-----" ); |
|
152 | + if( $start_c !== FALSE) { |
|
153 | 153 | $cadata = substr($cadata,$start_c); |
154 | 154 | $end_c = strpos($cadata,"-----END CERTIFICATE-----") + 25; |
155 | 155 | $next_c = strpos($cadata,"-----BEGIN CERTIFICATE-----",30); |
156 | 156 | while ( $next_c !== FALSE) { |
157 | - $returnarray[] = substr($cadata,0,$end_c); |
|
158 | - $cadata = substr($cadata,$next_c); |
|
159 | - $end_c = strpos($cadata,"-----END CERTIFICATE-----") + 25; |
|
160 | - $next_c = strpos($cadata,"-----BEGIN CERTIFICATE-----",30); |
|
157 | + $returnarray[] = substr($cadata,0,$end_c); |
|
158 | + $cadata = substr($cadata,$next_c); |
|
159 | + $end_c = strpos($cadata,"-----END CERTIFICATE-----") + 25; |
|
160 | + $next_c = strpos($cadata,"-----BEGIN CERTIFICATE-----",30); |
|
161 | 161 | } |
162 | 162 | $returnarray[] = substr($cadata,0,$end_c); |
163 | 163 | } else { |
164 | 164 | // TODO: before we blindly hand it over to der2pem - is this valid DER |
165 | 165 | // data at all? |
166 | - $returnarray[] = X509::der2pem($cadata); |
|
166 | + $returnarray[] = X509::der2pem($cadata); |
|
167 | 167 | } |
168 | 168 | // print_r($returnarray); |
169 | 169 |
@@ -77,7 +77,7 @@ |
||
77 | 77 | */ |
78 | 78 | public static $TLS = ["OUTER" => TLS, "INNER" => NONE]; |
79 | 79 | |
80 | - /** |
|
80 | + /** |
|
81 | 81 | * EAP-TLS: Outer EAP Type = 13, no inner EAP |
82 | 82 | * |
83 | 83 | * @var array of EAP type IDs that describe EAP-TLS |