Check OpenSSL version in Android with Java runtime or shell command I have a problem with checking OpenSSL version in Android device. I've tried to grep OpenSSL from system/lib/libssl.so with java runtime.exec, but it doesn't work?

Anyone can help me, how to make a command to check OpenSSL version in Android?
grep doesn't really like binary files, but you can extract the strings from the binary and grep those using strings. This binary is not available on most stock ROMs, but you can use Busybox or a similar tool to use it on most devices.

On my device the following command lists the correct OpenSSL version used by libssl.so:

strings /system/lib/libssl.so | grep -i openssl


This gives me the following output:

OpenSSLDie
OPENSSL_cleanse
OPENSSL_DIR_read
OPENSSL_DIR_end
external/openssl/ssl/bio_ssl.c
external/openssl/ssl/d1_both.c
external/openssl/ssl/d1_enc.c
external/openssl/ssl/d1_lib.c
external/openssl/ssl/d1_pkt.c
external/openssl/ssl/d1_srtp.c
external/openssl/ssl/s23_clnt.c
external/openssl/ssl/s23_lib.c
external/openssl/ssl/s23_srvr.c
external/openssl/ssl/s2_clnt.c
external/openssl/ssl/s2_enc.c
external/openssl/ssl/s2_lib.c
external/openssl/ssl/s2_pkt.c
external/openssl/ssl/s2_srvr.c
external/openssl/ssl/s3_both.c
external/openssl/ssl/s3_cbc.c
external/openssl/ssl/s3_clnt.c
external/openssl/ssl/s3_enc.c
external/openssl/ssl/s3_lib.c
external/openssl/ssl/s3_pkt.c
external/openssl/ssl/s3_srvr.c
external/openssl/ssl/ssl_asn1.c
external/openssl/ssl/ssl_cert.c
OPENSSL_DIR_read(&amp;ctx, '
external/openssl/ssl/ssl_ciph.c
OPENSSL_malloc Error
OpenSSL 1.0.1j 15 Oct 2014
external/openssl/ssl/ssl_lib.c
external/openssl/ssl/ssl_rsa.c
external/openssl/ssl/ssl_sess.c
external/openssl/ssl/ssl_txt.c
external/openssl/ssl/t1_enc.c
external/openssl/ssl/t1_lib.c
external/openssl/ssl/t1_reneg.c
external/openssl/ssl/tls_srp.c
DTLSv1 part of OpenSSL 1.0.1j 15 Oct 2014
SSLv2 part of OpenSSL 1.0.1j 15 Oct 2014
SSLv3 part of OpenSSL 1.0.1j 15 Oct 2014
TLSv1 part of OpenSSL 1.0.1j 15 Oct 2014


I can't confirm that this works for every device, but I see no reason why this would fail.