code: def validate_binary_sign(signed_query, signature, cert=None, algorithm=OneLogin_Saml2_Constants.RSA_SHA1, debug=False):
          
          error_callback_method = None
          if debug:
              error_callback_method = print_xmlsec_errors
          xmlsec.set_error_callback(error_callback_method)
  
          dsig_ctx = xmlsec.DSigCtx()
  
          file_cert = OneLogin_Saml2_Utils.write_temp_file(cert)
          dsig_ctx.signKey = xmlsec.Key.load(file_cert.name, xmlsec.KeyDataFormatCertPem, None)
          file_cert.close()
  
          # Sign the metadata with our private key.
          sign_algorithm_transform_map = {
              OneLogin_Saml2_Constants.DSA_SHA1: xmlsec.TransformDsaSha1,
              OneLogin_Saml2_Constants.RSA_SHA1: xmlsec.TransformRsaSha1,
              OneLogin_Saml2_Constants.RSA_SHA256: xmlsec.TransformRsaSha256,
              OneLogin_Saml2_Constants.RSA_SHA384: xmlsec.TransformRsaSha384,
              OneLogin_Saml2_Constants.RSA_SHA512: xmlsec.TransformRsaSha512
          }
          sign_algorithm_transform = sign_algorithm_transform_map.get(algorithm, xmlsec.TransformRsaSha1)
  
          dsig_ctx.verifyBinary(signed_query, sign_algorithm_transform, signature)
          return True
docs: Validates signed binary data (Used to validate GET Signature).
  
          :param signed_query: The element we should validate
          :type: string
  
  
          :param signature: The signature that will be validate
          :type: string
  
          :param cert: The public cert
          :type: string
  
          :param algorithm: Signature algorithm
          :type: string
  
          :param debug: Activate the xmlsec debug
          :type: bool
  
          :param raise_exceptions: Whether to return false on failure or raise an exception
          :type raise_exceptions: Boolean