Getting an SSL certificates serial number and SHA1 hash?

Does anyone know how to retrieve the SHA1 hash and serial number of an SSL certificate provided to and HTTPSecureSocket?

If you use MBS Plugin, we could add functions to get metadata of certificates to our Encryption plugin.