def _cert_details(cert_pointer):
 data_pointer = None
 try:
  data_pointer = Security.SecCertificateCopyData(cert_pointer)
  der_cert = CFHelpers.cf_data_to_bytes(data_pointer)
  cert_hash = hashlib.sha1(der_cert).digest()
  return (der_cert, cert_hash)
 finally:
  if (data_pointer is not None):
   CoreFoundation.CFRelease(data_pointer)

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