LassoSaml2EncryptedElement

## LassoSaml2EncryptedElement LassoSaml2EncryptedElement — <saml2:EncryptedElement> |

## Synopsis

    struct              LassoSaml2EncryptedElement;
    LassoNode *         lasso_saml2_encrypted_element_new   (void);
    lasso_error_t       lasso_saml2_encrypted_element_decrypt
                                                            (LassoSaml2EncryptedElement *encrypted_element,
                                                             xmlSecKey *encryption_private_key,
                                                             LassoNode **decrypted_node);
    LassoSaml2EncryptedElement * lasso_saml2_encrypted_element_build_encrypted_persistent_name_id
                                                            (const char *id,
                                                             const char *idpID,
                                                             const LassoProvider *provider);
    lasso_error_t       lasso_saml2_encrypted_element_server_decrypt
                                                            (LassoSaml2EncryptedElement *encrypted_element,
                                                             LassoServer *server,
                                                             LassoNode **decrypted_node);

## Description

This element can contain an encrypted XML document fragment, use `lasso_saml2_encrypted_element_decrypt()` to retrieve it.

Figure 55. Schema fragment for saml2:EncryptedElement

    <complexType name="EncryptedElementType">
      <sequence>
        <element ref="xenc:EncryptedData"/>
        <element ref="xenc:EncryptedKey" minOccurs="0" maxOccurs="unbounded"/>
      </sequence>
    </complexType>

## Details

### struct LassoSaml2EncryptedElement

    struct LassoSaml2EncryptedElement {
    	LassoNode parent;

    	/* elements */
    	xmlNode *EncryptedData;
    	GList *EncryptedKey; /* of xmlNode* */
    	LassoNode *original_data;
    };

### lasso_saml2_encrypted_element_new ()

    LassoNode *         lasso_saml2_encrypted_element_new   (void);

Creates a new LassoSaml2EncryptedElement object.

Returns : | a newly created LassoSaml2EncryptedElement object

### lasso_saml2_encrypted_element_decrypt ()

    lasso_error_t       lasso_saml2_encrypted_element_decrypt
                                                            (LassoSaml2EncryptedElement *encrypted_element,
                                                             xmlSecKey *encryption_private_key,
                                                             LassoNode **decrypted_node);

Decrypt the content of a LassoSaml2EncryptedElement using the given xmlSecKey. The xmlNode resulting of decrypting it is converted into a LassoNode object.

`encrypted_element` : | the LassoSaml2EncryptedElement to decrypt
`encryption_private_key` : | the xmlSecKey to decrypt the node
Returns : | 0 if successful, an error otherwise.

### lasso_saml2_encrypted_element_build_encrypted_persistent_name_id ()

    LassoSaml2EncryptedElement * lasso_saml2_encrypted_element_build_encrypted_persistent_name_id
                                                            (const char *id,
                                                             const char *idpID,
                                                             const LassoProvider *provider);

### lasso_saml2_encrypted_element_server_decrypt ()

    lasso_error_t       lasso_saml2_encrypted_element_server_decrypt
                                                            (LassoSaml2EncryptedElement *encrypted_element,
                                                             LassoServer *server,
                                                             LassoNode **decrypted_node);

Decrypt the given encrypted element using the encryption private key of the `server` object

`encrypted_element` : | a LassoSaml2EncryptedElement object
`server` : | a LassoServer object
`decrypted_node:(out)` : | an output arg for a LassoNode
Returns : | 0 if successful, an error code otherwise. See `lasso_saml2_encrypted_element_server_decrypt()`.