Skip to content

回复:Exception: 9key_error 错误 ​

原始发布页

打开来源页面
查看 1 个交叉存档

它是每次运行时都会发生,还是只在某个随机时刻发生过一次?

我以前从未见过这里失败。这是一次 OpenSSL 调用,我原以为它永远不会失败,但为了以防万一,我还是在那里加了错误检查。我想象不出它会怎样失败。也许是内存不足。

代码是:

key.h: EC_KEY* pkey;

pkey = EC_KEY_new_by_curve_name(NID_secp256k1); if (pkey == NULL) throw key_error("CKey::CKey() : EC_KEY_new_by_curve_name failed");

NID_secp256k1 是一个常量。

英文原文 ​

展开英文原文

Does it happen every time you run it, or just happened once at some random time?

I've never seen that fail before. It's a call to OpenSSL that I assumed would never fail, but I put an error check there just in case. I can't imagine how it would fail. Out of memory maybe.

The code is:

key.h: EC_KEY* pkey;

pkey = EC_KEY_new_by_curve_name(NID_secp256k1); if (pkey == NULL) throw key_error("CKey::CKey() : EC_KEY_new_by_curve_name failed");

NID_secp256k1 is a constant.

为历史保存,为中文读者整理。每篇档案均附来源与英文原文。