如何修复 tpm2_ptool tpm:parameter(2):curve not supported
问题
你正在尝试使用如下命令通过 tpm2_ptool 创建密钥
fix_tpm2_ptool.sh
tpm2_ptool addkey --label=ssh --userpin=zeigh6iraewich1aengip6Dee2bait --algorithm=ecc384并收到错误 tpm:parameter(2):curve not supported:
tpm2_ptool_curve_not_supported.txt
Traceback (most recent call last):
File "/usr/bin/tpm2_ptool", line 33, in <module>
sys.exit(load_entry_point('tpm2-pkcs11-tools==1.33.7', 'console_scripts', 'tpm2_ptool')())
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3/dist-packages/tpm2_pkcs11/tpm2_ptool.py", line 26, in main
commandlet.init('A tool for manipulating the tpm2-pkcs11 database')
File "/usr/lib/python3/dist-packages/tpm2_pkcs11/command.py", line 102, in init
commandlet.get()[d['which']](d)
File "/usr/lib/python3/dist-packages/tpm2_pkcs11/commandlets_keys.py", line 295, in __call__
objects = super(AddKeyCommand, self).__call__(args)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3/dist-packages/tpm2_pkcs11/commandlets_keys.py", line 202, in __call__
tertiarypriv, tertiarypub, tertiarypubdata = self.new_key_create(
^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3/dist-packages/tpm2_pkcs11/commandlets_keys.py", line 289, in new_key_create
tertiarypriv, tertiarypub, tertiarypubdata = tpm2.create(
^^^^^^^^^^^^
File "/usr/lib/python3/dist-packages/tpm2_pkcs11/tpm2.py", line 226, in create
raise RuntimeError("Could not execute tpm2_create: %s" %
RuntimeError: Could not execute tpm2_create: b'WARNING:esys:src/tss2-esys/api/Esys_Create.c:399:Esys_Create_Finish() Received TPM Error \nERROR:esys:src/tss2-esys/api/Esys_Create.c:134:Esys_Create() Esys Finish ErrorCode (0x000002e6) \nERROR: Esys_Create(0x2E6) - tpm:parameter(2):curve not supported\nERROR: Unable to run tpm2_create\n'解决方案
你的特定 TPM 实现不支持你尝试使用的曲线。你可以找出哪些(椭圆)曲线
虽然 tpm2_ptool 支持以下曲线:
ecc224ecc256ecc384ecc521
你的 TPM 实现(物理 TPM 或软件 TPM)可能不支持所有曲线。
通常,当你的 TPM 不支持例如 384 位 曲线时,它也不支持任何位数更高的曲线。因此,我建议尝试下一个更小的曲线。
try_ecc256.sh
tpm2_ptool addkey --label=ssh --userpin=zeigh6iraewich1aengip6Dee2bait --algorithm=ecc256根据 Dell,TPM 2.0 兼容的 TPM 必须至少支持 ecc256。
继续尝试更小的曲线,直到找到一个可用的。找出支持哪些曲线的最佳方法是全部尝试一遍,查找文档通常需要更长的时间而且往往根本不成功。
Check out similar posts by category:
Cryptography
If this post helped you, please consider buying me a coffee or donating via PayPal to support research & publishing of new posts on TechOverflow