Determining version of OpenSSL linked against python?

Anssi Saari as at sci.fi
Wed Jan 25 16:21:36 EST 2012


Adam Mercer <ramercer at gmail.com> writes:

> Can anyone offer any suggestions as to what is going wrong with the
> above code or offer an alternative way of determining the OpenSSl
> version using python-2.6?

I suppose you could use ctypes to load the library and call SSLeay()
which returns the OpenSSL version number as a C long.

Like this:

from ctypes import *
libssl = cdll.LoadLibrary("libssl.so")
openssl_version = libssl.SSLeay()
print "%.9X" % openssl_version

This gives me 0009080FF which corresponds to 0.9.8o release which is
what I have installed in Debian Squeeze.




More information about the Python-list mailing list