@@ -130,7 +130,7 @@ |
||
| 130 | 130 | $frontendData = []; |
| 131 | 131 | $frontendData['challengeEncoded'] = $challengeEncoded; |
| 132 | 132 | $frontendData['state'] = []; |
| 133 | - foreach (['Source', 'FIDO2Scope','FIDO2Username','FIDO2Displayname','requestTokenModel'] as $stateItem) { |
|
| 133 | + foreach (['Source', 'FIDO2Scope', 'FIDO2Username', 'FIDO2Displayname', 'requestTokenModel'] as $stateItem) { |
|
| 134 | 134 | $frontendData['state'][$stateItem] = $state[$stateItem]; |
| 135 | 135 | } |
| 136 | 136 | |
@@ -172,7 +172,7 @@ |
||
| 172 | 172 | |
| 173 | 173 | if ($debugEnabled) { |
| 174 | 174 | $response = new RunnableResponse( |
| 175 | - function ($authObject, $state) { |
|
| 175 | + function($authObject, $state) { |
|
| 176 | 176 | echo $authObject->getDebugBuffer(); |
| 177 | 177 | echo $authObject->getValidateBuffer(); |
| 178 | 178 | echo "Debug mode, not continuing to " . ($state['FIDO2WantsRegister'] ? "credential registration page." : "destination."); |
@@ -196,7 +196,7 @@ |
||
| 196 | 196 | $id = $this->authState::saveState($state, 'webauthn:request'); |
| 197 | 197 | if ($debugEnabled === true) { |
| 198 | 198 | $response = new RunnableResponse( |
| 199 | - function ($regObject, $id) { |
|
| 199 | + function($regObject, $id) { |
|
| 200 | 200 | echo $regObject->getDebugBuffer(); |
| 201 | 201 | echo $regObject->getValidateBuffer(); |
| 202 | 202 | echo "<form id='regform' method='POST' action='" . |
@@ -75,7 +75,7 @@ |
||
| 75 | 75 | } |
| 76 | 76 | $keyResource = openssl_pkey_get_public($keyObject->asPEM()); |
| 77 | 77 | if ($keyResource === false) { |
| 78 | - $this->fail("Unable to construct public key resource from PEM (was algo type ". $this->algo .")."); |
|
| 78 | + $this->fail("Unable to construct public key resource from PEM (was algo type " . $this->algo . ")."); |
|
| 79 | 79 | } |
| 80 | 80 | /** |
| 81 | 81 | * §7.2 STEP 17: validate signature |
@@ -23,7 +23,7 @@ discard block |
||
| 23 | 23 | */ |
| 24 | 24 | public const PK_ALGORITHM_ECDSA = "-7"; |
| 25 | 25 | public const PK_ALGORITHM_RSA = "-257"; |
| 26 | - public const PK_ALGORITHM = [ self::PK_ALGORITHM_ECDSA, self::PK_ALGORITHM_RSA ]; |
|
| 26 | + public const PK_ALGORITHM = [self::PK_ALGORITHM_ECDSA, self::PK_ALGORITHM_RSA]; |
|
| 27 | 27 | public const AAGUID_ASSURANCE_LEVEL_NONE = 0; |
| 28 | 28 | public const AAGUID_ASSURANCE_LEVEL_SELF = 1; |
| 29 | 29 | public const AAGUID_ASSURANCE_LEVEL_BASIC = 2; |
@@ -184,7 +184,7 @@ discard block |
||
| 184 | 184 | // Found the root CA with Google, see above, and will perform chain validation even if the spec doesn't say so. |
| 185 | 185 | |
| 186 | 186 | // first, clear the openssl error backlog. We might need error data in case things go sideways. |
| 187 | - while(openssl_error_string() !== false); |
|
| 187 | + while (openssl_error_string() !== false); |
|
| 188 | 188 | |
| 189 | 189 | $stmtDecoded = $attestationArray['attStmt']; |
| 190 | 190 | if (!isset($stmtDecoded['x5c'])) { |
@@ -200,7 +200,7 @@ discard block |
||
| 200 | 200 | !isset($certProps['extensions']['1.2.840.113635.100.8.2']) |
| 201 | 201 | || empty($certProps['extensions']['1.2.840.113635.100.8.2']) |
| 202 | 202 | ) { |
| 203 | - $this->fail( "The required nonce value is not present in the OID." ); |
|
| 203 | + $this->fail("The required nonce value is not present in the OID."); |
|
| 204 | 204 | } |
| 205 | 205 | $toCompare = substr($certProps['extensions']['1.2.840.113635.100.8.2'], 6); |
| 206 | 206 | if ($nonce != $toCompare) { |
@@ -208,7 +208,7 @@ discard block |
||
| 208 | 208 | } |
| 209 | 209 | |
| 210 | 210 | // chain validation first |
| 211 | - foreach ( $stmtDecoded['x5c'] as $runIndex => $runCert ) { |
|
| 211 | + foreach ($stmtDecoded['x5c'] as $runIndex => $runCert) { |
|
| 212 | 212 | if (isset($stmtDecoded['x5c'][$runIndex + 1])) { // there is a next cert, so follow the chain |
| 213 | 213 | $certResource = openssl_x509_read(Utils\Crypto::der2pem($runCert)); |
| 214 | 214 | $signerPubKey = openssl_pkey_get_public(Utils\Crypto::der2pem($stmtDecoded['x5c'][$runIndex + 1])); |
@@ -222,7 +222,7 @@ discard block |
||
| 222 | 222 | $certResource = openssl_x509_read(Utils\Crypto::der2pem($runCert)); |
| 223 | 223 | $signerPubKey = openssl_pkey_get_public($APPLE_WEBAUTHN_ROOT_CA); |
| 224 | 224 | if (openssl_x509_verify($certResource, $signerPubKey) != 1) { |
| 225 | - $this->fail("Error during root CA validation of the attestation chain certificate, which is ".Utils\Crypto::der2pem($runCert)); |
|
| 225 | + $this->fail("Error during root CA validation of the attestation chain certificate, which is " . Utils\Crypto::der2pem($runCert)); |
|
| 226 | 226 | } |
| 227 | 227 | } |
| 228 | 228 | } |
@@ -254,9 +254,9 @@ discard block |
||
| 254 | 254 | // § 8.8 Bullet 5 |
| 255 | 255 | $credentialDetails = openssl_pkey_get_details($credentialResource); |
| 256 | 256 | $keyDetails = openssl_pkey_get_details($keyResource); |
| 257 | - if ( $credentialDetails['bits'] != $keyDetails['bits'] || |
|
| 258 | - $credentialDetails['key'] != $keyDetails['key'] || |
|
| 259 | - $credentialDetails['type'] != $keyDetails['type'] ) { |
|
| 257 | + if ($credentialDetails['bits'] != $keyDetails['bits'] || |
|
| 258 | + $credentialDetails['key'] != $keyDetails['key'] || |
|
| 259 | + $credentialDetails['type'] != $keyDetails['type']) { |
|
| 260 | 260 | $this->fail("The credential public key does not match the certificate public key in attestationData. (" |
| 261 | 261 | . $credentialDetails['key'] |
| 262 | 262 | . " - " |
@@ -542,7 +542,7 @@ discard block |
||
| 542 | 542 | */ |
| 543 | 543 | if (in_array($arrayPK['3'], self::PK_ALGORITHM)) { // we requested -7 or -257, so want to see it here |
| 544 | 544 | $this->algo = $arrayPK['3']; |
| 545 | - $this->pass("Public Key Algorithm is expected (".implode(' or ', WebAuthnRegistrationEvent::PK_ALGORITHM).")."); |
|
| 545 | + $this->pass("Public Key Algorithm is expected (" . implode(' or ', WebAuthnRegistrationEvent::PK_ALGORITHM) . ")."); |
|
| 546 | 546 | } else { |
| 547 | 547 | $this->fail("Public Key Algorithm mismatch!"); |
| 548 | 548 | } |
@@ -5,11 +5,11 @@ |
||
| 5 | 5 | exit(1); |
| 6 | 6 | } |
| 7 | 7 | $token = file_get_contents($argv[1]); |
| 8 | -$blobContent = json_decode(base64_decode(str_replace('_', '/', str_replace('-','+',explode('.', $token)[1]))),true); |
|
| 8 | +$blobContent = json_decode(base64_decode(str_replace('_', '/', str_replace('-', '+', explode('.', $token)[1]))), true); |
|
| 9 | 9 | $outFormat = []; |
| 10 | 10 | foreach ($blobContent['entries'] as $oneEntry) { |
| 11 | 11 | if (isset($oneEntry['aaguid'])) { |
| 12 | - $outFormat[str_replace('-','',$oneEntry['aaguid'])] = [ |
|
| 12 | + $outFormat[str_replace('-', '', $oneEntry['aaguid'])] = [ |
|
| 13 | 13 | "model" => $oneEntry["metadataStatement"]["description"], |
| 14 | 14 | "RootPEMs" => $oneEntry["metadataStatement"]["attestationRootCertificates"] |
| 15 | 15 | ]; |