-
-
Notifications
You must be signed in to change notification settings - Fork 195
Description
I am currently utilizing the fido2-net-lib within the context of Android/iOS Authentication/Assertion, where the process of Authentication and Assertion has been functioning as intended. However, I am encountering an issue specifically during the Assertion phase (using Huawei FIDO2), wherein I consistently receive the error message "Signature does not match."
To elaborate, the Authentication procedure proceeds without any complications, indicating that the interaction with the Huawei device is successful. Yet, upon attempting Assertion, despite employing Huawei FIDO2 and adhering meticulously to their official documentation for byte data conversion, I am unable to successfully assert using the fido2-net-lib.
In an effort to provide clarity, I would like to share sample data pertaining to both the Authentication and Assertion processes. It is noteworthy that when I utilize the Webauthn.io demo on the Huawei device, the Assertion process functions seamlessly.
Note: I have AppGallery huawei device (Huawei Y6p, Model: MED-LX9)
Attestation
{ "id": "ZDU3ZmQ2MGItNTdiYS00MGI1LTkxZWEtM2QwMTkzNmU1NDE5", "type": "public-key", "rawId": "ZDU3ZmQ2MGItNTdiYS00MGI1LTkxZWEtM2QwMTkzNmU1NDE5", "response": { "clientDataJSON": "eyJhbmRyb2lkUGFja2FnZU5hbWUiOiJjb20ud3MucGlzcCIsImNoYWxsZW5nZSI6IjdjN2VmYzI5MjMyYTQ4ODAwMjVkZWRmMTYyNjM3MTBiNTVkNTBiMmUwMTc1YWVlMjA5ZmQ3NDczZDYyMzNjOTIiLCJvcmlnaW4iOiJhbmRyb2lkOmFway1rZXktaGFzaDpYbW5ObzQ2eVhWdk1IMFN5MkJNMFBoX2Zoa3k2dGdjWXc0N1FtYmRwS3hFIiwidHlwZSI6IndlYmF1dGhuLmNyZWF0ZSJ9", "attestationObject": "o2NmbXRkbm9uZWdhdHRTdG10oGhhdXRoRGF0YVioe7eO1-fI3Si4Ni6jlzAO2QL7dQEyQqExKlELz8v10gVFAAAAAAECAwQFBgcIAQIDBAUGBwgAJGQ1N2ZkNjBiLTU3YmEtNDBiNS05MWVhLTNkMDE5MzZlNTQxOaUBAgMmIAEhWCA6mwPNifyw8iQedOV4hJ7QPRsA9X3IK1RjJqITsp64rCJYIGKmrcyu5phh1X_n0Y7tlOmMk6LQAge2APBm7BCb5fKW" } }
Assertion
{ "id": "ZDU3ZmQ2MGItNTdiYS00MGI1LTkxZWEtM2QwMTkzNmU1NDE5", "type": "public-key", "rawId": "ZDU3ZmQ2MGItNTdiYS00MGI1LTkxZWEtM2QwMTkzNmU1NDE5", "response": { "clientDataJSON": "eyJhbmRyb2lkUGFja2FnZU5hbWUiOiJjb20ud3MucGlzcCIsImNoYWxsZW5nZSI6IjhhMGFjZTQ1ZWU3OWJmNmVhNTQ1ODgwMzBiZDkxOGQ2NGY4MDI0Zjk0ZjQ2ZTc5MTIyMDczYzhlYmUwNDY0YzIiLCJvcmlnaW4iOiJhbmRyb2lkOmFway1rZXktaGFzaDpYbW5ObzQ2eVhWdk1IMFN5MkJNMFBoX2Zoa3k2dGdjWXc0N1FtYmRwS3hFIiwidHlwZSI6IndlYmF1dGhuLmdldCJ9", "authenticatorData": "e7eO1-fI3Si4Ni6jlzAO2QL7dQEyQqExKlELz8v10gUFAAAAAQ", "signature": "MEUCIGZ3Fgw4uqUqR7uY6UiVI6LHhcIpXcMB2h-YcsWCMCFUAiEAiLZ086wwS-vBbwYKnp9vR78fkLvZJoTh9aXPEwYM1z8", } }
Dart code
Authentication
`var clientDataEncoded =
base64Url.encode(utf8.encode(jsonEncode(ted))).replaceAll('/', '_');
var attestedObjectEncoded = base64Url
.encode(Uint8List.fromList(response.authenticatorAttestationResponse!
.attestationObject as List<int>))
.replaceAll('/', '_');
var credentialIdEncoded = base64Url
.encode(Uint8List.fromList(response
.authenticatorAttestationResponse!.credentialId as List<int>))
.replaceAll('/', '_');`
Assertion
`var authenticatorData = base64Url
.encode(response.assertionResponse!.authenticatorData as List)
.replaceAll('=', '');
var credentialIdEncoded = base64Url
.encode(response.assertionResponse!.credentialId as List<int>)
.replaceAll('=', '');
var signature = base64Url
.encode(response.assertionResponse!.signature as List<int>)
.replaceAll('=', '');`