硬盘加密

Compatible Nitrokeys

3A/C/Mini

Passkey

HSM 2

Pro 2

FIDO2

Storage 2

Start

U2F

active

inactive

active

active

inactive

active

active

inactive

VeraCrypt (以前的TrueCrypt)

`VeraCrypt <https://www.veracrypt.fr/en/Home.html>`__是一款适用于Windows、macOS和GNU+Linux的免费开源磁盘加密软件。它是TrueCrypt的继承者,因此被推荐使用,尽管以下说明也应适用于TrueCrypt。

Follow these steps to use the program with Nitrokey Storage 2 or Nitrokey Pro 2:

  1. 安装最新版本的`OpenSC <https://github.com/OpenSC/OpenSC/wiki>`__,或者下载`PKCS#11库 <https://smartcard-auth.de/download-en.html>`__。

  2. Choose the library in VeraCrypt under Settings>Preferences>Security Token (location depends on system, e.g. /usr/lib/opensc).

  3. 通过Tools>Keyfile Generator生成一个64字节的密钥文件。

  4. Now you should be able to import the generated key file via Tools>Manage Security Token Keyfiles. You should choose the first Slot ([0] User PIN). The keyfile is then stored on the Nitrokey as Private Data Object 1 (PrivDO1).

  5. 在这之后,你应该安全地擦除你电脑上的原始密钥文件!

  6. 现在你可以用Nitrokey使用VeraCrypt:创建一个容器,选择设备上的密钥文件作为密码的替代。

警告

安全方面的考虑

Please note that VeraCrypt doesn't make use of the full security which Nitrokey (and smart cards in general) offer. Instead it stores a keyfile on the Nitrokey which theoretically could be stolen by a compromised host, since the Private Data Object 1 is not protected by the Nitrokey's PIN.

在GNU+Linux上用LUKS/dm-crypt进行硬盘加密

如需设置 LUKS 磁盘加密,请参阅我们的指南:

Purism has created a simple script to add the Nitrokey/LibremKey as a way to unlock LUKS partitions (not tested by Nitrokey yet).

`这个项目<https://github.com/artosan/nitroluks/>`__旨在通过Nitrokey Pro或基于Password Safe的Storage(尚未被Nitrokey测试)来简化LUKS的使用。关于如何在Gentoo上使用它的描述可以在`这里<https://amedeos.github.io/gentoo/nitrokey/2019/01/21/gentoo-nitrokey-luks.html>`__找到。

对于Arch Linux,见`initramfs-scencrypt <https://github.com/fuhry/initramfs-scencrypt>`__。

在GNU+Linux上用EncFS进行存储加密

小技巧

先决条件

请确保你`安装了设备驱动程序,改变了默认的PIN码,并使用GnuPG <https://www.nitrokey.com/start>`__生成或导入密钥。

EncFS is an easy to utlity for encrypted file systems and it is based on FUSE. You may follow these steps to use it with very long passwords and Nitrokey Pro 2.

初始化

  1. 创建一个具有随机数据的密钥文件。

    $ dd bs=64 count=1 if=/dev/urandom of=keyfile
    
  2. 加密密钥文件,并使用你的Nitrokey的用户ID。

    $ gpg --encrypt keyfile
    
  3. 移除明文的密钥文件。

    $ rm keyfile # you may want to use 'wipe' or 'shred' to securely delete the keyfile
    
  4. 创建挂载点。

    $ mkdir ~/.cryptdir ~/cryptdir
    
  5. 创建实际的加密文件夹

    $ gpg -d keyfile.gpg | encfs -S ~/.cryptdir ~/cryptdir
    # There may appears an error message about missing permission of fusermount
    # This message can be ignored
    
  6. 解除对新文件系统的挂载。

    $ fusermount -u ~/cryptdir
    

使用方法

  1. 挂载加密的文件系统,并输入Nitrokey的PIN码。

    $ gpg -d keyfile.gpg | encfs -S ~/.cryptdir ~/cryptdir
    
  2. 使用完毕后,解除对文件系统的挂载。

    $ fusermount -u ~/cryptdir
    

在GNU+Linux上使用ECryptFS进行存储加密

`eCryptfs <https://www.ecryptfs.org/>`__是GNU+Linux的一个基于文件的透明加密文件系统,可以通过一个PKCS#11驱动与Nitrokey一起使用。

见`这些<http://tkxuyen.com/blog/?p=293>`__说明。

  1. 将证书和密钥导入到Nitrokey。

    # Warning: This will delete existing keys on your Nitrokey!
    $ pkcs15-init --delete-objects privkey,pubkey --id 3 --store-private-key user@example.com.p12 --format pkcs12 --auth-id 3 --verify-pin
    
  2. 创建文件~/.ecryptfsrc.pkcs11。

    $ editor ~/.ecryptfsrc.pkcs11
    
  3. 输入这个内容。

    $ pkcs11-log-level=5 pkcs11-provider1,name=name,library=/usr/lib/opensc-pkcs11.so,cert-private=true
    $ openvpn --show-pkcs11-ids path to opensc-pkcs11 module
    Certificate
        DN: /description=Iv4IQpLO02Mnix9i/CN=user@example.com/emailAddress=user@example.com
        Serial: 066E04
        Serialized id: ZeitControl/PKCS\x2315\x20emulated/000500000c7f/OpenPGP\x20card\x20\x28User\x20PIN\x29/03
    
  4. 复制序列化的ID,供以后使用。

    $ ecryptfs-manager
    # This will show list option. Choose option "Add public key to keyring"
    # Choose pkcs11-helper
    # Enter the serialized ID of step 3 to PKCS#11 ID.
    

或者,尝试`ESOSI <https://sourceforge.net/projects/esosi/>`__或使用OpenSC和OpenVPN遵循这些步骤。

指南的来源:https://www.nitrokey.com/documentation/applications#a:hard-disk-encryption