分享

ubuntu加密算法“AES256”的问题

 新用户34008MEn 2021-07-15

我按照这个方法加密外置硬盘,但是aes算法别名有问题

sudo modprobe dm-crypt
sudo modprobe sha256
sudo modprobe aes

aes 命令后出现以下错误

modprobe: ERROR: could not insert 'padlock_aes': No such device

我尝试了链接中提到的解决方法,但我的 /etc/modprobe.d/ 目录中没有别名文件

user@user:/home/$ cd /etc/modprobe.d/

user@user:/etc/modprobe.d$ ls | grep aliases

user@user:/etc/modprobe.d$ [no output]

我不知道如何处理这个,但后来当我尝试加密驱动器时,它通过以下命令成功加密

sudo cryptsetup --verify-passphrase luksFormat /dev/sdb1 -c aes -s 256 -h sha256

我不知道它是如何找到 aes256 算法的,或者只是忽略了 aes256 或者做了一些神奇的事情。

所以我想回答以下问题

  1. crypt-setup 如何成功加密我的驱动器?
  2. 如何确认在 crypt-setup 执行的加密中也实现了 aes256?

  3. 为什么我没有/etc/modprobe.d/alaises文件?是因为新版本吗?因为该解决方案上次在 10.04 版上进行了测试。





提前一般警告:不要手动更改cryptsetup带有-c( --cipher)、-s( --key-size) 和-h( --hash)等选项参数默认值通常足够合理,除非您知道自己在做什么,否则您实际上可能会选择更糟糕的参数。

这些默认值显示为cryptsetup --help作为参考,在带有 cryptsetup 1.7.2 的 Ubuntu 16.04 上,默认值为:

LUKS1: aes-xts-plain64, Key: 256 bits, LUKS header hashing: sha1, RNG: /dev/urandom

在带有 cryptsetup 1.7.2 的 Arch Linux 上,默认值是:

LUKS1: aes-xts-plain64, Key: 256 bits, LUKS header hashing: sha256, RNG: /dev/urandom


您链接的说明是为 2010 年发布的 Ubuntu 版本编写的。如今(甚至可能在那时)您不必手动加载内核模块来设置全盘加密。这些在cryptsetup被调用时自动加载

在 Linux 内核模块的上下文中,aes名称是几个可能实现的模块名称和别名。aes内核映像中内置了一个通用模块。然后还有替代的、更快的实现,这取决于某些硬件或 CPU 功能(如padlock-aesaesni-intel)。

即使无法加载这些硬件加速模块,仍然可以回退到通用 AES 实现,这就是为什么cryptsetup仍然可以使用它。

To confirm that AES256 encryption is indeed in use, you can use the cryptsetup luksDump /dev/sdb1 command which shows something like:

...                                        
Cipher name:    aes
Cipher mode:    xts-plain64
Hash spec:      sha256
Payload offset: 4096
MK bits:        256

Here you can see that the AES cipher was used using the SHA256 hash function for password derivation. The key size is 256 bits (so you are indeed using AES256).

For your last question (why you do not have an /etc/modprobe/aliases file), this file does not exist in recent Ubuntu versions.

相关文章推荐:

    本站是提供个人知识管理的网络存储空间,所有内容均由用户发布,不代表本站观点。请注意甄别内容中的联系方式、诱导购买等信息,谨防诈骗。如发现有害或侵权内容,请点击一键举报。
    转藏 分享 献花(0

    0条评论

    发表

    请遵守用户 评论公约

    类似文章 更多