@staticmethod<EOL><INDENT>def decrypt_element(encrypted_data, key, debug=False, inplace=False):<DEDENT>
if isinstance(encrypted_data, Element):<EOL><INDENT>encrypted_data = OneLogin_Saml2_XML.to_etree(str(encrypted_data.toxml()))<EOL><DEDENT>if not inplace and isinstance(encrypted_data, OneLogin_Saml2_XML._element_class):<EOL><INDENT>encrypted_data = deepcopy(encrypted_data)<EOL><DEDENT>elif isinstance(encrypted_data, OneLogin_Saml2_XML._text_class):<EOL><INDENT>encrypted_data = OneLogin_Saml2_XML._parse_etree(encrypted_data)<EOL><DEDENT>xmlsec.enable_debug_trace(debug)<EOL>manager = xmlsec.KeysManager()<EOL>manager.add_key(xmlsec.Key.from_memory(key, xmlsec.KeyFormat.PEM, None))<EOL>enc_ctx = xmlsec.EncryptionContext(manager)<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