如何确定openssl库的版本?

Nas*_*man 16 c++ openssl

我有一个预构建的OpenSSL库(libssl.a和libcrypto.a),它们用于我的C++应用程序.我不知道OpenSSL库的版本.

有没有办法从这些预先构建的库中获取版本号?

Joh*_*ade 20

库中有一个字符串,其中包含名为SSLEAY_VERSION的版本详细信息- 它看起来像:

  • OpenSSL 0.9.5a 1 Apr 2000
  • OpenSSL 1.0.1e-fips 11 Feb 2013

您可以使用strings和grep从二进制库中找到它:

strings libcrypto.so | grep "^OpenSSL \S\+ [0-9]\+ \S\+ [0-9]\+"
Run Code Online (Sandbox Code Playgroud)


lpa*_*app 10

您可以通过阅读以下内容以编程方式执行此操作:

基本上,您需要使用以下功能:

  • SSLeay()
  • SSLeay_version()

  • @Naseef:[this](https://github.com/ppelleti/https-example/blob/master/https-common.c#L39)有帮助吗? (2认同)

小智 7

那么过滤可能并不总是有效。你可以做

strings libssl.so | grep "^OpenSSL"
OpenSSLDie
OpenSSL 1.0.2n  7 Dec 2017

strings libcrypto.so | grep "^OpenSSL"
OpenSSLDie
OpenSSL_add_all_ciphers
OpenSSL_add_all_digests
OpenSSL 1.0.2n  7 Dec 2017
OpenSSL HMAC method
OpenSSL EC algorithm
OpenSSL RSA method
OpenSSL DSA method
OpenSSL ECDSA method
OpenSSL DH Method
OpenSSL X9.42 DH method
OpenSSL PKCS#3 DH method
OpenSSL ECDH method
OpenSSL 'dlfcn' shared library method
OpenSSL default
OpenSSL default user interface
OpenSSL CMAC method
Run Code Online (Sandbox Code Playgroud)


Jan*_*TAC 6

您还可以使用:

openssl version -a
Run Code Online (Sandbox Code Playgroud)

请参阅参考资料:https : //linux.die.net/man/1/version