且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

OpenSSL RSA_sign()返回零错误代码

更新时间:2023-12-03 14:51:04

但是,我收到了"RSA签名失败 错误:00000000:lib(0):func(0):原因(0)"将此字符串放入我的错误中 输出.

But, I got "RSA signature FAILED with error:00000000:lib(0):func(0):reason(0)" this string into my error output.

请问有人可以向我解释这些错误吗?

Could anyone explain me the mistakes, please?

我没有看到main函数,所以这只是猜测...

I don't see a main function, so this is just speculation...

main中的SSL_library_initERR_load_crypto_strings中添加呼叫.您可能还需要致电OpenSSL_add_all_ciphers.

Add a call to SSL_library_init and ERR_load_crypto_strings in main. You may also need a call to OpenSSL_add_all_ciphers.

由于没有得到正确的错误字符串,因此您可以尝试打印ERR_get_error()的结果.获得ERR_get_error()的结果后,就可以通过openssl errstr命令运行它:

Since you are not getting a good error string, you might try printing the result of ERR_get_error(). Once you get the result of ERR_get_error(), you can run it through the openssl errstr command:

$ openssl errstr 0406506C
error:0406506C:rsa routines:RSA_EAY_PRIVATE_DECRYPT:data greater than mod len

另请参阅OpenSSL Wiki上的库初始化.

Also see Library Initialization on the OpenSSL wiki.