'Stores the TLS X.509 certificate for the given server
Args:
server_name (str): The name of the server.
from_server (str): Where the certificate was looked up
time_now_ms (int): The time now in milliseconds
tls_certificate (OpenSSL.crypto.X509): The X.509 certificate.'

def store_server_certificate(self, server_name, from_server, time_now_ms, tls_certificate):

    tls_certificate_bytes = OpenSSL.crypto.dump_certificate(OpenSSL.crypto.FILETYPE_ASN1, tls_certificate)
    fingerprint = hashlib.sha256(tls_certificate_bytes).hexdigest()
    return self._simple_upsert(table='server_tls_certificates', keyvalues={'server_name': server_name, 'fingerprint': fingerprint}, values={'from_server': from_server, 'ts_added_ms': time_now_ms, 'tls_certificate': buffer(tls_certificate_bytes)}, desc='store_server_certificate')
