fixes for obtaining certificate serial number (older versions of
OpenSSL behave differently from newer ones)