@staticmethod<EOL><INDENT>def decrypt_element(encrypted_data, key, debug=False, inplace=False):<DEDENT>
if isinstance(encrypted_data, Element):<EOL><INDENT>encrypted_data = fromstring(str(encrypted_data.toxml()), forbid_dtd=True)<EOL><DEDENT>elif isinstance(encrypted_data, basestring):<EOL><INDENT>encrypted_data = fromstring(str(encrypted_data), forbid_dtd=True)<EOL><DEDENT>elif not inplace and isinstance(encrypted_data, etree._Element):<EOL><INDENT>encrypted_data = deepcopy(encrypted_data)<EOL><DEDENT>error_callback_method = None<EOL>if debug:<EOL><INDENT>error_callback_method = print_xmlsec_errors<EOL><DEDENT>xmlsec.set_error_callback(error_callback_method)<EOL>mngr = xmlsec.KeysMngr()<EOL>key = xmlsec.Key.loadMemory(key, xmlsec.KeyDataFormatPem, None)<EOL>mngr.addKey(key)<EOL>enc_ctx = xmlsec.EncCtx(mngr)<EOL>return enc_ctx.decrypt(encrypted_data)<EOL>
Decrypts an encrypted element.

:param encrypted_data: The encrypted data.
:type: lxml.etree.Element | DOMElement | basestring

:param key: The key.
:type: string

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

:param inplace: update passed data with decrypted result
:type: bool

:returns: The decrypted element.
:rtype: lxml.etree.Element