Generate Private Keys on YubiKey and Use them on Windows

Up until I wrote this blog post, the tutorials and documentation I have come across regarding the use of Yubikey PIV certificates with Windows all involved having a complete set of private and public keys (generated outside of Yubikey) to be installed on Windows and imported into Yubikey for use. However, Yubikey also provides a more secure option: generating the private key on the Yubikey itself. The advantage of this method is that the private key never leaves the Yubikey, making it impossible for it to be leaked. But in such a case, we don't have a private key to import into Windows, and Windows is unaware of our corresponding digital certificate, so it won't consider our certificate as an available one for signing.

This article will explain how to generate a private key on the Yubikey and associate it with the certificate on Windows, to enable code signing on Windows. Although the purpose of this article is code signing, the association method described in the article also applies to other scenarios that require the use of private keys generated on the Yubikey.

阅读更多

在 YubiKey 上生成私钥并在 Windows 上使用

截止到我写这篇博客,我在网络上所看到的将 Yubikey PIV 证书与 Windows 一起使用的教程和文档都是已经有完整的私钥和公钥(在 Yubikey 外生成),将其安装在 Windows 和导入到 Yubikey 使用。但是,Yubikey 还提供了一种具有更高安全性的选项:在 Yubikey 上生成私钥,这种方法的好处是私钥不会离开 Yubikey,因此不可能被泄露。但是在这样的情况下,我们没有可以用于导入到 Windows 的私钥,Windows 并不知道我们具有相应数字证书的私钥,在签名时不会将我们的证书作为可用的证书。

本文将介绍如何在 Yubikey 上生成私钥,使 Windows 将证书与 Yubikey 上的私钥相关联,以便在 Windows 上进行代码签名。尽管本文的目的是进行代码签名,但是文中的关联方法也适用于其他需要使用在 Yubikey 上生成的私钥的场景。

阅读更多

Yubikey 教程(三)在 WSL2 中使用 Yubikey

本文已过时

本文撰写于 2023 年 2 月 16 日,它已经过时。现在我们可以直接将 USB 设备共享给 WSL,以实现在 WSL 上直接使用 Yubikey。这远比本文提出的方法要方便。

WSL 即 Windows Subsystem for Linux,可以在 Windows 中运行 Linux 子系统。WSL2 使用虚拟机的方式运行 Linux 子系统,很方便在 Windows 中使用 Linux 的命令行工具。但是,WSL2 也有一些限制,比如不能直接访问 Windows 的硬件设备,比如 Yubikey。本文是 Yubikey 系列教程的第三篇,介绍如何在 WSL2 中使用 Yubikey 的 GPG 功能。

阅读更多

联想小新Air14IIL 2020拆机并更换硬盘

由于我的笔记本电脑(联想小新 Air14IIL 2020)的硬盘空间不足,我很早就筹划着为它更换硬盘。恰逢最近国产 SSD 厂商致钛和老牌厂商打价格战,SSD 价格下降,我买了一块 2T 的致钛 TiPlus5000 来更换旧硬盘。

这篇文章给出了联想小新 Air14IIL 2020 的拆机图(可能是目前最清晰的)以及对 TiPlus5000 的简单测试结果。

阅读更多