code: def validate_binary_sign(signed_query, signature, cert=None, algorithm=OneLogin_Saml2_Constants.RSA_SHA1, debug=False):
          
          try:
              xmlsec.enable_debug_trace(debug)
              dsig_ctx = xmlsec.SignatureContext()
              dsig_ctx.key = xmlsec.Key.from_memory(cert, xmlsec.KeyFormat.CERT_PEM, None)
  
              sign_algorithm_transform_map = {
                  OneLogin_Saml2_Constants.DSA_SHA1: xmlsec.Transform.DSA_SHA1,
                  OneLogin_Saml2_Constants.RSA_SHA1: xmlsec.Transform.RSA_SHA1,
                  OneLogin_Saml2_Constants.RSA_SHA256: xmlsec.Transform.RSA_SHA256,
                  OneLogin_Saml2_Constants.RSA_SHA384: xmlsec.Transform.RSA_SHA384,
                  OneLogin_Saml2_Constants.RSA_SHA512: xmlsec.Transform.RSA_SHA512
              }
              sign_algorithm_transform = sign_algorithm_transform_map.get(algorithm, xmlsec.Transform.RSA_SHA1)
  
              dsig_ctx.verify_binary(compat.to_bytes(signed_query),
                                     sign_algorithm_transform,
                                     compat.to_bytes(signature))
              return True
          except xmlsec.Error as e:
              if debug:
                  print(e)
              return False
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