def __build_signature(self, data, saml_type, sign_algorithm=OneLogin_Saml2_Constants.RSA_SHA1):
assert saml_type in ('<STR_LIT>', '<STR_LIT>')<EOL>key = self.get_settings().get_sp_key()<EOL>if not key:<EOL><INDENT>raise OneLogin_Saml2_Error(<EOL>"<STR_LIT>" % saml_type,<EOL>OneLogin_Saml2_Error.PRIVATE_KEY_NOT_FOUND<EOL>)<EOL><DEDENT>msg = self.__build_sign_query(data[saml_type],<EOL>data.get('<STR_LIT>', None),<EOL>sign_algorithm,<EOL>saml_type)<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(sign_algorithm, xmlsec.Transform.RSA_SHA1)<EOL>signature = OneLogin_Saml2_Utils.sign_binary(msg, key, sign_algorithm_transform, self.__settings.is_debug_active())<EOL>data['<STR_LIT>'] = OneLogin_Saml2_Utils.b64encode(signature)<EOL>data['<STR_LIT>'] = sign_algorithm<EOL>
Builds the Signature
:param data: The Request data
:type data: dict

:param saml_type: The target URL the user should be redirected to
:type saml_type: string  SAMLRequest | SAMLResponse

:param sign_algorithm: Signature algorithm method
:type sign_algorithm: string