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 功能。

阅读更多

用RemoteApp访问虚拟机中的应用

上一篇文章中,我分析了在隔离环境中运行应用的多种方法。在我的生活中,我需要将一些不可信应用放在 Hyper-V 虚拟机中运行。但是这样做会导致我在工作时需要频繁地在本地和远程桌面之间切换,而且可能收不到虚拟机内的通知。因此,我希望能够在保持隔离的同时获得与本地应用几乎相同的体验。

RemoteApp 是微软基于远程桌面开发的软件。相比于后者将整个桌面绘制出来,RemoteApp 仅仅绘制一个应用的界面,应用会出现在本地的任务栏和托盘,使用本地的通知中心进行推送,提供了与本地应用几乎相同的体验。在这篇文章中,我将介绍如何使用 RemoteApp 访问虚拟机中的应用。

阅读更多

在隔离环境中运行应用的几种方案

在隔离环境中运行应用有诸多好处。在开发时,我们可以通过这种方法防止环境冲突、保证在不同设备上运行时环境一致;在生活中使用软件时,我们可以通过这种方法防止软件对计算机造成破坏。本文讨论了在 Windows 上在隔离环境中运行应用的四种方案:WSL+Docker, Windows Sandbox, Sandboxie 和虚拟机。

阅读更多