MacOS 使用本地用户登录

Compatible Nitrokeys

3A/C/Mini

Passkey

HSM 2

Pro 2

FIDO2

Storage 2

Start

U2F

active

inactive

inactive

inactive

inactive

inactive

inactive

inactive

This document explains how to use the PIV smart card of a Nitrokey 3 for local user logon on MacOS. It is available as of firmware version 1.8 and higher.

先决条件

The following setup was used at the time of writing this guide:

  • MacOS 15.6 (Sequoia)

  • nitropy 0.10.0

  • Nitrokey 3 with PIV smart card, firmware version 1.8.1

Configure smartcard logon for local use

假设硝基上的 PIV 小程序已在出厂前复位。不过,覆盖密钥和证书也应该可以。

当 PIN、PUK 和管理密钥没有更改时,使用``nitropy nk3 piv`` 命令会更方便,因为此时会使用默认值。因此,我们假设您尚未更改它们。如果已经更改,则必须在必要时提供。

  1. Generate a key and a certificate in PIV slot 9a:

    
    

    硝酸盐 nk3 piv --experimental generate-key --key 9a --algo nistp256 --subject-name "CN=Foo Bar" --subject-alt-name-upn "foo@bar.com"

  2. Generate a key and a certificate in PIV slot 9d:

    
    

    硝酸盐 nk3 piv --experimental generate-key --key 9d --algo nistp256 --subject-name "CN=Foo Bar" --subject-alt-name-upn "foo@bar.com"

  3. 确认硝基现在在插槽 9a 和 9d 中有证书:

    
    

    硝酸盐 nk3 piv --experimental list-certificates

  4. 验证系统是否能识别硝基,是否能找到身份:

    
    

    sc_auth identities

This should print something like this:

SmartCard: com.apple.pivtoken:<nitrokey serial number>
Unpaired identities:
someId       <username> - Zertifikat zur PIV-Authentifizierung (<CN>)
  1. 现在拔下硝基,然后重新插入。操作系统应将硝基识别为 PIV 智能卡,并建议与当前登录的用户配对。

  2. 确认后,您可能需要输入 PIV PIN 码进行初始签名,还可能需要输入密码才能将 PIV 证书导入 MacOS 钥匙串。

  3. 验证 PIV 身份是否已成功与本地 MacOS 用户配对:

    
    

    sc_auth list

This should print something like this:

Hash: someId
  1. 完成。现在你应该可以使用 PIV PIN 码用你的硝基登录 Mac 了。