相关疑难解决方法(0)

错误:"在OpenSSL 1.1.0中无效使用不完整类型'RSA {aka struct rsa_st}"

我有旧的代码,用于链接旧版本的openssl.此代码的一部分从PEM文件加载密钥,并尝试通过使用以下代码来了解此密钥是私钥还是公钥:

if( (prv->p==0 || prv->q==0) ) {
    // This is not a private key!
    throw error("No private key for decryption");
}
Run Code Online (Sandbox Code Playgroud)

使用最新版本的openssl,这(有理由)不编译:

crypto.cpp: In function ‘key* decrypt_header(file_t, RSA*)’:
crypto.cpp:158:13: error: invalid use of incomplete type ‘RSA {aka struct rsa_st}’
     if( (prv->p==0 || prv->q==0) ) {
             ^~
Run Code Online (Sandbox Code Playgroud)

我理解直接访问struct的私有成员被替换为一个函数,但我很难搞清楚哪个函数是什么.

c openssl

5
推荐指数
2
解决办法
6673
查看次数

错误:在C ++项目中使用HMAC_CTX时类型不完整

我正在尝试 在笔记本电脑中编译该库 ndn-cxx。我已经在另一台计算机上尝试过,并且编译成功,但是现在出现此错误,我认为它与openssl相关。我使用sudo apt-cache search libssl验证笔记本电脑中是否装有openssl | grep SSL,结果为:

  • libssl-ocaml-用于OpenSSL的OCaml绑定(运行时)
  • libssl-ocaml-dev-用于OpenSSL的OCaml绑定
  • libssl0.9.8-SSL共享库
  • libsslcommon2-企业消息传递系统-通用SSL库
  • libsslcommon2-dev-企业消息传递系统-常见的SSL开发文件

我在尝试编译库时遇到的错误是:

../src/security/transform/hmac-filter.cpp:49:12: error: field ‘m_context’ has incomplete type
   HMAC_CTX m_context;
            ^

../src/security/transform/hmac-filter.cpp: In constructor 
‘ndn::security::transform::HmacFilter::Impl::Impl()’:
../src/security/transform/hmac-filter.cpp:35:20: error: ‘m_context’ was not declared in this scope
     HMAC_CTX_init(&m_context);
                    ^

../src/security/transform/hmac-filter.cpp:35:29: error: ‘HMAC_CTX_init’ was not declared in this scope
     HMAC_CTX_init(&m_context);
                             ^

../src/security/transform/hmac-filter.cpp: In destructor ‘ndn::security::transform::HmacFilter::Impl::~Impl()’:
../src/security/transform/hmac-filter.cpp:40:23: error: ‘m_context’ was not declared in this scope
     HMAC_CTX_cleanup(&m_context);
                       ^    

../src/security/transform/hmac-filter.cpp:40:32: error: ‘HMAC_CTX_cleanup’ was not declared in this scope
     HMAC_CTX_cleanup(&m_context); …
Run Code Online (Sandbox Code Playgroud)

c++ ssl openssl

5
推荐指数
1
解决办法
2358
查看次数

标签 统计

openssl ×2

c ×1

c++ ×1

ssl ×1