@staticmethod<EOL><INDENT>def generate_name_id(value, sp_nq, sp_format=None, cert=None, debug=False, nq=None):<DEDENT>
root = OneLogin_Saml2_XML.make_root("<STR_LIT>" % OneLogin_Saml2_Constants.NS_SAML)<EOL>name_id = OneLogin_Saml2_XML.make_child(root, '<STR_LIT>' % OneLogin_Saml2_Constants.NS_SAML)<EOL>if sp_nq is not None:<EOL><INDENT>name_id.set('<STR_LIT>', sp_nq)<EOL><DEDENT>if sp_format is not None:<EOL><INDENT>name_id.set('<STR_LIT>', sp_format)<EOL><DEDENT>if nq is not None:<EOL><INDENT>name_id.set('<STR_LIT>', nq)<EOL><DEDENT>name_id.text = value<EOL>if cert is not None:<EOL><INDENT>xmlsec.enable_debug_trace(debug)<EOL>manager = xmlsec.KeysManager()<EOL>manager.add_key(xmlsec.Key.from_memory(cert, xmlsec.KeyFormat.CERT_PEM, None))<EOL>enc_data = xmlsec.template.encrypted_data_create(<EOL>root, xmlsec.Transform.AES128, type=xmlsec.EncryptionType.ELEMENT, ns="<STR_LIT>")<EOL>xmlsec.template.encrypted_data_ensure_cipher_value(enc_data)<EOL>key_info = xmlsec.template.encrypted_data_ensure_key_info(enc_data, ns="<STR_LIT>")<EOL>enc_key = xmlsec.template.add_encrypted_key(key_info, xmlsec.Transform.RSA_OAEP)<EOL>xmlsec.template.encrypted_data_ensure_cipher_value(enc_key)<EOL>enc_ctx = xmlsec.EncryptionContext(manager)<EOL>enc_ctx.key = xmlsec.Key.generate(xmlsec.KeyData.AES, <NUM_LIT>, xmlsec.KeyDataType.SESSION)<EOL>enc_data = enc_ctx.encrypt_xml(enc_data, name_id)<EOL>return '<STR_LIT>' + compat.to_string(OneLogin_Saml2_XML.to_string(enc_data)) + '<STR_LIT>'<EOL><DEDENT>else:<EOL><INDENT>return OneLogin_Saml2_XML.extract_tag_text(root, "<STR_LIT>")<EOL><DEDENT>
Generates a nameID.

:param value: fingerprint
:type: string

:param sp_nq: SP Name Qualifier
:type: string

:param sp_format: SP Format
:type: string

:param cert: IdP Public Cert to encrypt the nameID
:type: string

:param debug: Activate the xmlsec debug
:type: bool

:returns: DOMElement | XMLSec nameID
:rtype: string

:param nq: IDP Name Qualifier
:type: string