decrypt a saml 2.0 response having aes 128 and rsa I need to decrypt a saml 2.0 response. But, the response object has reference to aes 128 and rsa algorithms, and I am having hard time in finding a way to decrypt.

Below is the structure of the response (replacing the sensitive data with some random values)

&lt;samlp:Response xmlns:samlp="urn:oasis:names:tc:SAML:2.0:protocol" Destination="" ID="_12345" InResponseTo="" IssueInstant="2015-01-01T10:00:00.000Z" Version="2.0"&gt;
&lt;saml:EncryptedAssertion xmlns:saml="urn:oasis:names:tc:SAML:2.0:assertion"&gt;
&lt;xenc:EncryptedData xmlns:xenc="http://www.w3.org/2001/04/xmlenc#" Id="12333" Type="http://www.w3.org/2001/04/xmlenc#Element"&gt;
    &lt;xenc:EncryptionMethod Algorithm="http://www.w3.org/2001/04/xmlenc#aes128-cbc" xmlns:xenc="http://www.w3.org/2001/04/xmlenc#"/&gt;
    &lt;ds:KeyInfo xmlns:ds="http://www.w3.org/2000/09/xmldsig#"&gt;
        &lt;ds:RetrievalMethod Type="http://www.w3.org/2001/04/xmlenc#EncryptedKey" URI="#12567"/&gt;
    &lt;/ds:KeyInfo&gt;
    &lt;xenc:CipherData xmlns:xenc="http://www.w3.org/2001/04/xmlenc#"&gt;
        &lt;xenc:CipherValue xmlns:xenc="http://www.w3.org/2001/04/xmlenc#"&gt;xxxxxxxxxxx&lt;/xenc:CipherValue&gt;
    &lt;/xenc:CipherData&gt;
&lt;/xenc:EncryptedData&gt;
&lt;xenc:EncryptedKey xmlns:xenc="http://www.w3.org/2001/04/xmlenc#" Id="12567"&gt;
    &lt;xenc:EncryptionMethod Algorithm="http://www.w3.org/2001/04/xmlenc#rsa-oaep-mgf1p" xmlns:xenc="http://www.w3.org/2001/04/xmlenc#"&gt;
        &lt;ds:DigestMethod xmlns:ds="http://www.w3.org/2000/09/xmldsig#" Algorithm="http://www.w3.org/2000/09/xmldsig#sha1"/&gt;
    &lt;/xenc:EncryptionMethod&gt;
    &lt;ds:KeyInfo xmlns:ds="http://www.w3.org/2000/09/xmldsig#"&gt;
        &lt;ds:KeyValue&gt;
            &lt;ds:RSAKeyValue&gt;
                &lt;ds:Modulus&gt;xxxxxxxxxx&lt;/ds:Modulus&gt;
                &lt;ds:Exponent&gt;xxxxxxxx&lt;/ds:Exponent&gt;
            &lt;/ds:RSAKeyValue&gt;
        &lt;/ds:KeyValue&gt;
    &lt;/ds:KeyInfo&gt;
    &lt;xenc:CipherData xmlns:xenc="http://www.w3.org/2001/04/xmlenc#"&gt;
        &lt;xenc:CipherValue xmlns:xenc="http://www.w3.org/2001/04/xmlenc#"&gt;xxxxxxx&lt;/xenc:CipherValue&gt;
    &lt;/xenc:CipherData&gt;
    &lt;xenc:ReferenceList&gt;
        &lt;xenc:DataReference URI="#12333"/&gt;
    &lt;/xenc:ReferenceList&gt;
&lt;/xenc:EncryptedKey&gt;
&lt;/saml:EncryptedAssertion&gt;
&lt;/samlp:Response&gt;


Now, how should I proceed with this response and the private key, I have.

I am able to decrypt the response successfully on a online tool https://www.samltool.com/decrypt.php, but I couldn't get the internals, which I need.
For a definitive answer, you really should see the documentation for the data format you're dealing with, but just quickly looking at the XML response, it would seem that you're dealing with a hybrid encryption scheme.

That is, your encrypted message consists of two parts:


The actual data (in xenc:EncryptedData), encrypted using AES-CBC with a single-use per-message key.
The AES key used to encrypt the data, itself encrypted (in xenc:EncryptedKey) with RSA-OAEP.


The main reason for using this kind of hybrid encryption, instead of directly encrypting the data directly with RSA, is that public-key encryption algorithms like RSA tend to be rather slow, increase the message length considerably, and generally be poorly suited for encrypting long message.  They work just fine for encrypting AES keys (which are just random bitstrings 16 / 32 bytes long), though.  So we use AES to encrypt the message (which is fast and only adds a few bytes to the message length), and then encrypt the AES key with RSA so that the intended recipient can decrypt it.