image:https://github.com/yubico/libfido2/workflows/linux/badge.svg["Linux Build Status (github actions)", link="https://github.com/Yubico/libfido2/actions"] image:https://github.com/yubico/libfido2/workflows/macos/badge.svg["macOS Build Status (github actions)", link="https://github.com/Yubico/libfido2/actions"] image:https://github.com/yubico/libfido2/workflows/windows/badge.svg["Windows Build Status (github actions)", link="https://github.com/Yubico/libfido2/actions"] image:https://github.com/yubico/libfido2/workflows/fuzzer/badge.svg["Fuzz Status (github actions)", link="https://github.com/Yubico/libfido2/actions"] image:https://oss-fuzz-build-logs.storage.googleapis.com/badges/libfido2.svg["Fuzz Status (oss-fuzz)", link="https://bugs.chromium.org/p/oss-fuzz/issues/list?sort=-opened&can=1&q=proj:libfido2"]
libfido2 提供库功能和命令行工具,用于通过 USB 或 NFC 与 FIDO 设备通信,并验证 attestation 和 assertion 签名。
libfido2 支持 FIDO U2F(CTAP 1)和 FIDO2(CTAP 2)协议。
有关用法,请参阅 examples/ 目录。
=== 许可证
libfido2 采用 BSD 2-Clause 许可证。完整的许可证文本请参阅 LICENSE 文件。
=== 支持平台
libfido2 已知可在 Linux、macOS、Windows、OpenBSD 和 FreeBSD 上运行。
=== 文档
文档提供 troff 和 HTML 格式。另提供 https://developers.yubico.com/libfido2/Manuals[*libfido2* 文档的在线镜像]。
=== 绑定
=== 发布
libfido2 当前版本为 1.17.0。带签名的发布 tarball 可在 Yubico 的 https://developers.yubico.com/libfido2/Releases[发布页面] 获取。
=== 依赖项
libfido2 依赖于 https://github.com/pjk/libcbor[libcbor]、https://www.openssl.org[OpenSSL] 3.0 或更高版本,以及 https://zlib.net[zlib]。在 Linux 上,还需要 libudev(https://www.freedesktop.org/wiki/Software/systemd[systemd] 的一部分)。
=== 安装
==== Fedora 34 及更高版本
$ sudo dnf install libfido2 libfido2-devel fido2-tools
==== Ubuntu 20.04(Focal)及更高版本
$ sudo apt install libfido2-1 libfido2-dev libfido2-doc fido2-tools
另外,较新版本的 libfido2 可在 Yubico 的 PPA 中获取。请按照下面 Ubuntu 18.04(Bionic)的说明进行操作。
==== Ubuntu 18.04(Bionic)
$ sudo apt install software-properties-common $ sudo apt-add-repository ppa:yubico/stable $ sudo apt update $ sudo apt install libfido2-1 libfido2-dev libfido2-doc fido2-tools
在 Linux 上,您可能需要添加一条 udev 规则才能访问 FIDO 设备。例如,udev 规则可以包含以下内容:
#udev rule for allowing HID access to Yubico devices for FIDO support.
==== macOS
$ brew install libfido2
==== Windows
请查阅 Yubico 的 https://developers.yubico.com/libfido2/Releases[发布页面] 以获取 ARM、ARM64、Win32 和 Win64 构建产物。
安全使用我们的库的前提是:构建产物被解压到受信任、不可写的目录中,且 DLL 与可执行文件放在一起。有关 DLL 部署和安全管理技术的通用指南,请参阅 Microsoft 的官方文档。请注意,我们的动态链接构建产物使用 /MD 构建,可能需要存在相应的 Visual C++ 运行时。
=== 从源码构建
在类 UNIX 系统上:
$ cmake -B build $ make -C build $ sudo make -C build install
根据平台不同,可能需要安装 https://www.freedesktop.org/wiki/Software/pkg-config/[pkg-config],或设置 PKG_CONFIG_PATH 环境变量。有关特定操作系统的完整构建说明,请参阅 .actions/(Linux、macOS、BSD)和 windows/ 目录。
=== 构建时定制
libfido2 支持多个 CMake 选项。其中一些选项需要额外的依赖。默认禁用的选项不受官方支持。
[%autowidth.stretch] |=== |选项 |描述 |默认值 | BUILD_EXAMPLES | 构建示例程序 | ON | BUILD_MANPAGES | 构建手册页 | ON | BUILD_SHARED_LIBS | 构建共享库 | ON | BUILD_STATIC_LIBS | 构建静态库 | ON | BUILD_TOOLS | 构建辅助工具 | ON | FUZZ | 启用 fuzzing 插桩 | OFF | NFC_LINUX | 在 Linux 上启用 netlink NFC 支持 | ON | USE_HIDAPI | 使用 hidapi 作为 HID 后端 | OFF | USE_PCSC | 启用实验性 PCSC 支持 | OFF | USE_WINHELLO | 将 Windows Hello 抽象为 FIDO 设备 | ON |===
USE_HIDAPI 选项需要 https://github.com/libusb/hidapi[hidapi]。USE_PCSC 选项在 Linux 上需要 https://github.com/LudovicRousseau/PCSC[pcsc-lite]。
=== 开发
请使用 https://github.com/Yubico/libfido2/discussions[GitHub Discussions] 提问和提出功能建议,并通过 https://github.com/Yubico/libfido2/pulls[GitHub pull-requests] 贡献代码。
=== 报告 Bug
请使用 https://github.com/Yubico/libfido2/issues[GitHub Issues] 报告 Bug。如需报告安全问题,请联系 [email protected]。PGP 公钥可在 https://www.yubico.com/support/security-advisories/issue-rating-system/ 找到。