我正在为FIDO2构建一个Android认证器。我一直坚持读/写的特点。我正在研制75.Chrome可以检测到我的Android BLE认证器。在检测到我的BLE身份验证器后,将从身份验证方调用onCharacteristicReadRequest()。在onCharacteristicReadRequest()内部,我使用了下面编写的代码,但之后没有来自客户端的响应。
我尝试过0b01000000版本的U2F。它很好用。当我移动FIDO2版本0b100000时,我面临着这个问题。我是广告fido服务和设备信息服务的认证者。这两个服务都添加了Thread.sleep(1000)间隔。我不能按顺序添加这两个服务。当我按顺序添加这两个服务时,我将得到ArrayIndexOutofBoundException。
我不知道这两个问题是否相互关联。如果我做错了什么,请纠正我。
{
...
}else if (characteristic.getUuid().equals(FidoUUIDConstants.FIDO_SERVICE_REVISION_BITFIELD)) {
status = BluetoothGatt.GATT_SUCCESS;
ByteBuffer bb = ByteBuffer.allocate(1);
bb.order(ByteOrder.BIG_ENDIAN);
bb.put((byte) (1 << 5));
bytes = bb.array();
}
mGattServer.sendResponse(device, requestId, status, 0, bytes);客户端应在预期fidoServiceBitFieldversion之后读取/写入特性。
发布于 2019-06-15 10:30:39
我同意包的关心。根据CTAP规范,您应该使用读/写权限定义对应于每个特征的描述符。注意,每个描述符的UUID都需要有效的UUID 128位格式。所有描述符都具有读写权限。例如:
UUID CONTROL_POINT_DESCRIPTOR_UUID = UUID.fromString("00002901-0000-1000-8000-00805f9b34fb");
BluetoothGattDescriptor controlPointDescriptor = new BluetoothGattDescriptor(
CONTROL_POINT_DESCRIPTOR_UUID,
BluetoothGattDescriptor.PERMISSION_READ | BluetoothGattDescriptor.PERMISSION_WRITE
);发布于 2019-06-11 16:52:49
我不能按顺序添加这两个服务
我认为您可以像下面这样添加device info service:
gattServer = bleManager.openGattServer(this, new BluetoothGattServerCallback() {
@Override
public void onServiceAdded(int status, BluetoothGattService service) {
if (service.getUuid().equals(FidoUUIDConstants.FIDO2_GATT_SERVICE)) {
gattServer.addService(deviceInfoService);
}
}
});
gattServer.addService(fido2GattService)对于特征fidoServiceRevisionBitfield,我只是简单地遵循了a device that only supports FIDO2 Rev 1 will only have a fidoServiceRevisionBitfield characteristic of length 1 with value 0x20.在索引8.3.5.1. FIDO Service of CTAP文件上的语句。因此,我的执行是:
if(characteristic.getUuid().equals(FIDO2GattService.SERVICE_REVISION_BITFIELD)) {
status = BluetoothGatt.GATT_SUCCESS;
bytes = new byte[] {0x20}
}
gattServer.sendResponse(device, requestId, status, 0, bytes);发布于 2019-06-12 14:41:17
您应该覆盖BluetoothGattServerCallback的所有方法
我认为您缺少了onDescriptorReadRequest、onDescriptorWriteRequest工具。
@Override
public void onDescriptorReadRequest(BluetoothDevice device, int requestId, int offset, BluetoothGattDescriptor descriptor) {
if (descriptor.getCharacteristic().getUuid().equals(FIDO2GattService.CONTROL_POINT_UUID) &&
descriptor.getUuid().equals(FIDO2GattService.CONTROL_POINT_DESCRIPTOR_UUID)) {
gattServer.sendResponse(device, requestId, BluetoothGatt.GATT_SUCCESS, offset, new byte[] {0x31, 0x2e, 0x32});
} else {
gattServer.sendResponse(device, requestId, BluetoothGatt.GATT_SUCCESS, offset, new byte[] {0x00, 0x00});
}
}
@Override
public void onDescriptorWriteRequest(BluetoothDevice device, int requestId, BluetoothGattDescriptor descriptor, boolean preparedWrite, boolean responseNeeded, int offset, byte[] value) {
gattServer.sendResponse(device, requestId, BluetoothGatt.GATT_SUCCESS, offset, value);
}https://stackoverflow.com/questions/56538947
复制相似问题