def _cert_details(cert_pointer):
data_pointer = None<EOL>try:<EOL><INDENT>data_pointer = Security.SecCertificateCopyData(cert_pointer)<EOL>der_cert = CFHelpers.cf_data_to_bytes(data_pointer)<EOL>cert_hash = hashlib.sha1(der_cert).digest()<EOL>return (der_cert, cert_hash)<EOL><DEDENT>finally:<EOL><INDENT>if data_pointer is not None:<EOL><INDENT>CoreFoundation.CFRelease(data_pointer)<EOL><DEDENT><DEDENT>
Return the certificate and a hash of it

:param cert_pointer:
    A SecCertificateRef

:return:
    A 2-element tuple:
     - [0]: A byte string of the SHA1 hash of the cert
     - [1]: A byte string of the DER-encoded contents of the cert