@@ -107,7 +107,9 @@ |
||
| 107 | 107 | { |
| 108 | 108 | // find the :QN10, -QN10, QH10 etc. bit |
| 109 | 109 | $pos = stripos($ocraSuite, ":q"); |
| 110 | - if ($pos===false) $pos = stripos($ocraSuite, "-q"); |
|
| 110 | + if ($pos===false) { |
|
| 111 | + $pos = stripos($ocraSuite, "-q"); |
|
| 112 | + } |
|
| 111 | 113 | if ($pos===false) { |
| 112 | 114 | // No challenge config specified. Since we only support challenge based OCRA, we fallback to default 10 digit hexadecimal. |
| 113 | 115 | return array("format"=>"H", "length"=>10); |
@@ -101,12 +101,15 @@ discard block |
||
| 101 | 101 | $sessionInformationLength = 0; |
| 102 | 102 | $timeStampLength = 0; |
| 103 | 103 | |
| 104 | - if(stripos($ocraSuite, "sha1")!==false) |
|
| 105 | - $crypto = "sha1"; |
|
| 106 | - if(stripos($ocraSuite, "sha256")!==false) |
|
| 107 | - $crypto = "sha256"; |
|
| 108 | - if(stripos($ocraSuite, "sha512")!==false) |
|
| 109 | - $crypto = "sha512"; |
|
| 104 | + if(stripos($ocraSuite, "sha1")!==false) { |
|
| 105 | + $crypto = "sha1"; |
|
| 106 | + } |
|
| 107 | + if(stripos($ocraSuite, "sha256")!==false) { |
|
| 108 | + $crypto = "sha256"; |
|
| 109 | + } |
|
| 110 | + if(stripos($ocraSuite, "sha512")!==false) { |
|
| 111 | + $crypto = "sha512"; |
|
| 112 | + } |
|
| 110 | 113 | |
| 111 | 114 | // How many digits should we return |
| 112 | 115 | $oS = substr($ocraSuite, strpos($ocraSuite, ":")+1, strpos($ocraSuite, ":", strpos($ocraSuite, ":")+1) -strpos($ocraSuite, ":")-1); |
@@ -116,31 +119,35 @@ discard block |
||
| 116 | 119 | // Counter |
| 117 | 120 | if(stripos($ocraSuite, ":c") !==false) { |
| 118 | 121 | // Fix the length of the HEX string |
| 119 | - while(strlen($counter) < 16) |
|
| 120 | - $counter = "0" . $counter; |
|
| 122 | + while(strlen($counter) < 16) { |
|
| 123 | + $counter = "0" . $counter; |
|
| 124 | + } |
|
| 121 | 125 | $counterLength=8; |
| 122 | 126 | } |
| 123 | 127 | // Question |
| 124 | 128 | if(stripos($ocraSuite, ":q")!==false || |
| 125 | 129 | stripos($ocraSuite, "-q")!==false) { |
| 126 | - while(strlen($question) < 256) |
|
| 127 | - $question = $question . "0"; |
|
| 130 | + while(strlen($question) < 256) { |
|
| 131 | + $question = $question . "0"; |
|
| 132 | + } |
|
| 128 | 133 | $questionLength=128; |
| 129 | 134 | } |
| 130 | 135 | |
| 131 | 136 | // Password |
| 132 | 137 | if(stripos($ocraSuite, ":p")!==false || |
| 133 | 138 | stripos($ocraSuite, "-p") !==false) { |
| 134 | - while(strlen($password) < 40) |
|
| 135 | - $password = "0" . $password; |
|
| 139 | + while(strlen($password) < 40) { |
|
| 140 | + $password = "0" . $password; |
|
| 141 | + } |
|
| 136 | 142 | $passwordLength=20; |
| 137 | 143 | } |
| 138 | 144 | |
| 139 | 145 | // sessionInformation |
| 140 | 146 | if(stripos($ocraSuite, ":s") !==false || |
| 141 | 147 | stripos($ocraSuite, "-s", strpos($ocraSuite, ":", strpos($ocraSuite, ":")+1)) !== false) { |
| 142 | - while(strlen($sessionInformation) < 128) |
|
| 143 | - $sessionInformation = "0" . $sessionInformation; |
|
| 148 | + while(strlen($sessionInformation) < 128) { |
|
| 149 | + $sessionInformation = "0" . $sessionInformation; |
|
| 150 | + } |
|
| 144 | 151 | |
| 145 | 152 | $sessionInformationLength=64; |
| 146 | 153 | } |
@@ -148,8 +155,9 @@ discard block |
||
| 148 | 155 | // TimeStamp |
| 149 | 156 | if(stripos($ocraSuite, ":t") !==false || |
| 150 | 157 | stripos($ocraSuite, "-t") !== false) { |
| 151 | - while(strlen($timeStamp) < 16) |
|
| 152 | - $timeStamp = "0" . $timeStamp; |
|
| 158 | + while(strlen($timeStamp) < 16) { |
|
| 159 | + $timeStamp = "0" . $timeStamp; |
|
| 160 | + } |
|
| 153 | 161 | $timeStampLength=8; |
| 154 | 162 | } |
| 155 | 163 | |
@@ -453,7 +453,9 @@ |
||
| 453 | 453 | $sessionId = session_id(); |
| 454 | 454 | } |
| 455 | 455 | $status = $this->_stateStorage->getValue("enrollstatus".$sessionId); |
| 456 | - if (is_null($status)) return self::ENROLLMENT_STATUS_IDLE; |
|
| 456 | + if (is_null($status)) { |
|
| 457 | + return self::ENROLLMENT_STATUS_IDLE; |
|
| 458 | + } |
|
| 457 | 459 | return $status; |
| 458 | 460 | } |
| 459 | 461 | |
@@ -47,7 +47,9 @@ |
||
| 47 | 47 | */ |
| 48 | 48 | public function getPath() |
| 49 | 49 | { |
| 50 | - if (substr($this->path, -1)!="/") return $this->path."/"; |
|
| 50 | + if (substr($this->path, -1)!="/") { |
|
| 51 | + return $this->path."/"; |
|
| 52 | + } |
|
| 51 | 53 | return $this->path; |
| 52 | 54 | } |
| 53 | 55 | } |
@@ -122,12 +122,15 @@ discard block |
||
| 122 | 122 | $cryptoFunction = $components[1]; |
| 123 | 123 | $dataInput = strtolower($components[2]); // lower here so we can do case insensitive comparisons |
| 124 | 124 | |
| 125 | - if(stripos($cryptoFunction, "sha1")!==false) |
|
| 126 | - $crypto = "sha1"; |
|
| 127 | - if(stripos($cryptoFunction, "sha256")!==false) |
|
| 128 | - $crypto = "sha256"; |
|
| 129 | - if(stripos($cryptoFunction, "sha512")!==false) |
|
| 130 | - $crypto = "sha512"; |
|
| 125 | + if(stripos($cryptoFunction, "sha1")!==false) { |
|
| 126 | + $crypto = "sha1"; |
|
| 127 | + } |
|
| 128 | + if(stripos($cryptoFunction, "sha256")!==false) { |
|
| 129 | + $crypto = "sha256"; |
|
| 130 | + } |
|
| 131 | + if(stripos($cryptoFunction, "sha512")!==false) { |
|
| 132 | + $crypto = "sha512"; |
|
| 133 | + } |
|
| 131 | 134 | |
| 132 | 135 | $codeDigits = substr($cryptoFunction, strrpos($cryptoFunction, "-")+1); |
| 133 | 136 | |
@@ -135,56 +138,65 @@ discard block |
||
| 135 | 138 | // Counter |
| 136 | 139 | if($dataInput[0] == "c" ) { |
| 137 | 140 | // Fix the length of the HEX string |
| 138 | - while(strlen($counter) < 16) |
|
| 139 | - $counter = "0" . $counter; |
|
| 141 | + while(strlen($counter) < 16) { |
|
| 142 | + $counter = "0" . $counter; |
|
| 143 | + } |
|
| 140 | 144 | $counterLength=8; |
| 141 | 145 | } |
| 142 | 146 | // Question |
| 143 | 147 | if($dataInput[0] == "q" || |
| 144 | 148 | stripos($dataInput, "-q")!==false) { |
| 145 | - while(strlen($question) < 256) |
|
| 146 | - $question = $question . "0"; |
|
| 149 | + while(strlen($question) < 256) { |
|
| 150 | + $question = $question . "0"; |
|
| 151 | + } |
|
| 147 | 152 | $questionLength=128; |
| 148 | 153 | } |
| 149 | 154 | |
| 150 | 155 | // Password |
| 151 | 156 | if(stripos($dataInput, "psha1")!==false) { |
| 152 | - while(strlen($password) < 40) |
|
| 153 | - $password = "0" . $password; |
|
| 157 | + while(strlen($password) < 40) { |
|
| 158 | + $password = "0" . $password; |
|
| 159 | + } |
|
| 154 | 160 | $passwordLength=20; |
| 155 | 161 | } |
| 156 | 162 | |
| 157 | 163 | if(stripos($dataInput, "psha256")!==false) { |
| 158 | - while(strlen($password) < 64) |
|
| 159 | - $password = "0" . $password; |
|
| 164 | + while(strlen($password) < 64) { |
|
| 165 | + $password = "0" . $password; |
|
| 166 | + } |
|
| 160 | 167 | $passwordLength=32; |
| 161 | 168 | } |
| 162 | 169 | |
| 163 | 170 | if(stripos($dataInput, "psha512")!==false) { |
| 164 | - while(strlen($password) < 128) |
|
| 165 | - $password = "0" . $password; |
|
| 171 | + while(strlen($password) < 128) { |
|
| 172 | + $password = "0" . $password; |
|
| 173 | + } |
|
| 166 | 174 | $passwordLength=64; |
| 167 | 175 | } |
| 168 | 176 | |
| 169 | 177 | // sessionInformation |
| 170 | 178 | if(stripos($dataInput, "s064") !==false) { |
| 171 | - while(strlen($sessionInformation) < 128) |
|
| 172 | - $sessionInformation = "0" . $sessionInformation; |
|
| 179 | + while(strlen($sessionInformation) < 128) { |
|
| 180 | + $sessionInformation = "0" . $sessionInformation; |
|
| 181 | + } |
|
| 173 | 182 | |
| 174 | 183 | $sessionInformationLength=64; |
| 175 | 184 | } else if(stripos($dataInput, "s128") !==false) { |
| 176 | - while(strlen($sessionInformation) < 256) |
|
| 177 | - $sessionInformation = "0" . $sessionInformation; |
|
| 185 | + while(strlen($sessionInformation) < 256) { |
|
| 186 | + $sessionInformation = "0" . $sessionInformation; |
|
| 187 | + } |
|
| 178 | 188 | |
| 179 | 189 | $sessionInformationLength=128; |
| 180 | 190 | } else if(stripos($dataInput, "s256") !==false) { |
| 181 | - while(strlen($sessionInformation) < 512) |
|
| 182 | - $sessionInformation = "0" . $sessionInformation; |
|
| 191 | + while(strlen($sessionInformation) < 512) { |
|
| 192 | + $sessionInformation = "0" . $sessionInformation; |
|
| 193 | + } |
|
| 183 | 194 | |
| 184 | 195 | $sessionInformationLength=256; |
| 185 | 196 | } else if(stripos($dataInput, "s512") !==false) { |
| 186 | - while(strlen($sessionInformation) < 128) |
|
| 187 | - $sessionInformation = "0" . $sessionInformation; |
|
| 197 | + while(strlen($sessionInformation) < 128) { |
|
| 198 | + $sessionInformation = "0" . $sessionInformation; |
|
| 199 | + } |
|
| 188 | 200 | |
| 189 | 201 | $sessionInformationLength=64; |
| 190 | 202 | } else if (stripos($dataInput, "-s") !== false ) { |
@@ -196,8 +208,9 @@ discard block |
||
| 196 | 208 | // to prevent matching the "s" in the password input e.g. "psha1". |
| 197 | 209 | // [C] | QFxx | [PH | Snnn | TG] : Challenge-Response computation |
| 198 | 210 | // [C] | QFxx | [PH | TG] : Plain Signature computation |
| 199 | - while(strlen($sessionInformation) < 128) |
|
| 200 | - $sessionInformation = "0" . $sessionInformation; |
|
| 211 | + while(strlen($sessionInformation) < 128) { |
|
| 212 | + $sessionInformation = "0" . $sessionInformation; |
|
| 213 | + } |
|
| 201 | 214 | |
| 202 | 215 | $sessionInformationLength=64; |
| 203 | 216 | } |
@@ -207,8 +220,9 @@ discard block |
||
| 207 | 220 | // TimeStamp |
| 208 | 221 | if($dataInput[0] == "t" || |
| 209 | 222 | stripos($dataInput, "-t") !== false) { |
| 210 | - while(strlen($timeStamp) < 16) |
|
| 211 | - $timeStamp = "0" . $timeStamp; |
|
| 223 | + while(strlen($timeStamp) < 16) { |
|
| 224 | + $timeStamp = "0" . $timeStamp; |
|
| 225 | + } |
|
| 212 | 226 | $timeStampLength=8; |
| 213 | 227 | } |
| 214 | 228 | |