Subversion Repositories oidplus

Rev

Rev 1321 | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 1321 Rev 1324
Line 45... Line 45...
45
 
45
 
46
                if (($params['aai_bits'] != '48') && ($params['aai_bits'] != '64')) {
46
                if (($params['aai_bits'] != '48') && ($params['aai_bits'] != '64')) {
47
                        throw new OIDplusException(_L("Invalid bit amount"));
47
                        throw new OIDplusException(_L("Invalid bit amount"));
48
                }
48
                }
49
 
49
 
50
                $aai = '';
-
 
51
                for ($i=0; $i<$params['aai_bits']/4; $i++) {
-
 
52
                        try {
-
 
53
                                $aai .= dechex(random_int(0, 15));
-
 
54
                        } catch (\Exception $e) {
-
 
55
                                $aai .= dechex(mt_rand(0, 15));
-
 
56
                        }
-
 
57
                }
-
 
58
 
-
 
59
                if (oidplus_is_true($params['aai_multicast'] ?? false)) {
50
                return array("status" => 0, "aai" => gen_aai((int)$params['aai_bits'], oidplus_is_true($params['aai_multicast'] ?? false)));
60
                        $aai[1] = '3';
-
 
61
                } else {
-
 
62
                        $aai[1] = '2';
-
 
63
                }
-
 
64
 
-
 
65
                $aai = strtoupper($aai);
-
 
66
                $aai = rtrim(chunk_split($aai, 2, '-'), '-');
-
 
67
 
-
 
68
                return array("status" => 0, "aai" => $aai);
-
 
69
        }
51
        }
70
 
52
 
71
        /**
53
        /**
72
         * @param string $actionID
54
         * @param string $actionID
73
         * @param array $params
55
         * @param array $params