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