Slide 82
Slide 82 text
8. 伴ݕূ༻ͷΞΫγϣϯΛՃ
app/Http/Controllers/Auth/RegisterController.php
ެ։伴ΛΰϦͬͱ࡞
Ϣʔβʔʹඥ͚ͮͯอଘ
// attestedCredentialData ͷύʔεʢ؆қ൛ʣ
if (substr($flag, 1, 1)) {
$aaguid = array_slice($authDataByteArray, 37, 16);
$credentialIdLength = array_slice($authDataByteArray, 53, 2);
$credentialIdLength = $this->byteArrayToEndian($credentialIdLength);
$credentialId = array_slice($authDataByteArray, 55, $credentialIdLength);
$credentialPublicKey = $this->byteArrayToString(array_slice($authDataByteArray, 55 + $credentialIdLength));
$credentialPublicKeyData = CBOREncoder::decode($credentialPublicKey);
if ($this->byteArrayToHex($credentialId) !== bin2hex(base64_decode($publicKeyCredential->rawId))) {
throw new \Exception('invalid! Not match Credential ID');
}
} else {
throw new \Exception('Invalid! AttestedCredentialData is not Include.');
}
// ެ։伴ͷௐ
$key1 = unpack('C*', $credentialPublicKeyData['-2']->get_byte_string());
$key2 = unpack('C*', $credentialPublicKeyData['-3']->get_byte_string());
$credentialPublicKey = array_merge([4], $key1, $key2);
$credentialPublicKey = $this->createPubkeyPem($credentialPublicKey);