C++ 如何确定openssl库的版本?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/23320480/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
How to determine version of openssl library?
提问by Naseef Ur Rahman
I have a pre-built OpenSSL library (libssl.a and libcrypto.a) which are being used for my C++ application. I don't know the version of the OpenSSL library.
我有一个预构建的 OpenSSL 库(libssl.a 和 libcrypto.a),用于我的 C++ 应用程序。我不知道 OpenSSL 库的版本。
Is there any way to get the version number from these pre-built libraries?
有没有办法从这些预建库中获取版本号?
采纳答案by lpapp
You can do this programatically by reading the following:
您可以通过阅读以下内容以编程方式执行此操作:
and
和
Basically, you will need to use the following functions:
基本上,您将需要使用以下功能:
SSLeay()
SSLeay_version()
SSLeay()
SSLeay_version()
回答by JohnTESlade
There is a string inside the library containing the version details called SSLEAY_VERSION- it looks like:
库中有一个字符串,其中包含名为SSLEAY_VERSION的版本详细信息- 它看起来像:
OpenSSL 0.9.5a 1 Apr 2000
OpenSSL 1.0.1e-fips 11 Feb 2013
OpenSSL 0.9.5a 1 Apr 2000
OpenSSL 1.0.1e-fips 11 Feb 2013
You can find this from the binary library using strings and grep:
您可以使用字符串和 grep 从二进制库中找到它:
strings libcrypto.so | grep "^OpenSSL \S\+ [0-9]\+ \S\+ [0-9]\+"
回答by Jan ATAC
You could also use :
您还可以使用:
openssl version -a
See reference at : https://linux.die.net/man/1/version
请参阅参考资料:https: //linux.die.net/man/1/version
回答by Divakar Y
Well the filtering may may not always work. You could do
那么过滤可能并不总是有效。你可以做
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