Crypto++ Ed448 未知 oid

Crypto++ Ed448 unknown oid

我一直在尝试使用来自 debian experimental 的 crypto++ 7 生成 Ed448 ECDSA 密钥。我的代码如下:

AutoSeededRandomPool rng;
ECIES<ECP>::Decryptor d(rng, ASN1::curve448());

我可以毫无错误地编译这段代码,但是当它运行时,我得到以下异常:

terminate called after throwing an instance of 'CryptoPP::UnknownOID'
  what():  BER decode error: unknown object identifier

网上查了一下,似乎curve448是上个版本实现的。我该如何解决这个问题?

I have been trying to generate an Ed448 ECDSA key... It appears that curve448 was implemented last version.

我们前一段时间添加了 25519 和 448 曲线的 OID。添加它们是为了简化 curve25519 和 ed25519 的测试。您可以在 oids.h.

处查看 OID

它们的 OID 已添加到 Commit 7ca5f7d3b53f on on Apr 11, 2016, and then subsequently fixed on the same day at Commit 29e9bd2b27a9。 2016 年 4 月 11 日使它们可用于 Crypto++ 5.6.4。


I can compile this code without errors, but when it runs, I get the following exception

您遇到异常是因为 eccrypto.cpp 中没有 curve448 的域参数。您遇到以下异常是因为 it == end.

template <class EC> void DL_GroupParameters_EC<EC>::Initialize(const OID &oid)
{
    const EcRecommendedParameters<EllipticCurve> *begin, *end;
    GetRecommendedParameters(begin, end);
    const EcRecommendedParameters<EllipticCurve> *it = std::lower_bound(begin, end, oid, OIDLessThan());
    if (it == end || it->oid != oid)
        throw UnknownOID();

    const EcRecommendedParameters<EllipticCurve> &param = *it;
    m_oid = oid;
    ...
}

这是背景故事...

根据 curve25519 的 A state-of-the-art Diffie-Hellman function, the source code for the curve is at SUPERCOP。 SUPERCOP 是密码算法的基准测试程序。

我们在测试叉上有 curve25519 和 ed25519。我们从 SUPERCOP 中删除了实现。 SUPERCOP 具有 curve25519、curve448 和许多其他东西的优化参考实现。添加 curve25519 和 ed25519 后,我们计划使用 curve448。

我们根据 Andrew Moon 的实现添加了 curve25519。这提供了 x25519ed25519。另见 Issue 761 (x25519) and Issue 764 (ed25519)。

此时,curve448 的 Crypto++ 实现停止了。我认为您的选择是基于 SUPERCOP 自己推出,或者使用像 libsodium、Botan 或 OpenSSL 这样的库。