title: XML parse error in encrypted Attribute in SAML response
body: <p>I have a simple web application (JSF) based on Spring Security SAML to test the BIG-IP F5 as IdP. After the login on F5, everything works fine when there is no encrypted Attributes in the SAML response, but whenever one Attribute is encrypted, there is an XML parse error. The decryption is OK. </p>
  
  <p>In debug I can see that all non-encrypted  Attributes are handled without any problems(class: <code>org.springframework.security.saml.websso.WebSSOProfileConsumerImpl.processAuthenticationResponse(SAMLMessageContext context)</code>), also the first encrypted attribute (password) is correctly decrypted in class <code>org.opensaml.xml.encryption.Decrypter.decryptDataToDOM(EncryptedData encryptedData, Key dataEncKey)</code>: The value for variable <code>bytes</code> (as String) after decryption is :</p>
  
  <pre><code>&lt;saml2:Attribute Name="password" NameFormat="urn:oasis:names:tc:SAML:2.0:attrname-format:unspecified"&gt;&lt;saml2:AttributeValue&gt;foo&lt;/saml2:AttributeValue&gt;&lt;/saml2:Attribute&gt;
  </code></pre>
  
  <p>When this Attribute is being parsed in <code>org.opensaml.xml.parse. StaticBasicParserPool.parse(InputStream input)</code></p>
  
  <p>There is an exception: The prefix "saml2" for element "saml2:Attribute" is not bound</p>
  
  <pre><code>[org.opensaml.xml.parse.StaticBasicParserPool]: XML Parsing Error org.xml.sax.SAXParseException; lineNumber: 1; columnNumber: 103; The prefix "saml2" for element "saml2:Attribute" is not bound.
  </code></pre>
  
  <p>I suppose that not having the namespace in this decrypted XML fragment is causing the error? Any ideas how to solve this problem? Could it be just a configuration problem on the F5? Thanks in advance.</p>
  
  <p>Here is the SAML Assertion, encrypted Attribute being in <code>&lt;saml2:EncryptedAttribute&gt;</code> ... <code>&lt;xenc:CipherData&gt;</code>:</p>
  
  <pre><code>&lt;saml2:Assertion xmlns:saml2="urn:oasis:names:tc:SAML:2.0:assertion" ID="_b6cf253b4cb9338aca76d98c3a0bb12ba083c7" IssueInstant="2016-03-15T10:09:51Z" Version="2.0"&gt;
      &lt;saml2:Issuer&gt;https://idp.foo.bar&lt;/saml2:Issuer&gt;
      …
      &lt;saml2:AttributeStatement&gt;
          &lt;saml2:Attribute Name="mobile" NameFormat="urn:oasis:names:tc:SAML:2.0:attrname-format:unspecified"&gt;
              &lt;saml2:AttributeValue&gt;555-123-456&lt;/saml2:AttributeValue&gt;
          &lt;/saml2:Attribute&gt;
          &lt;saml2:Attribute Name="mail" NameFormat="urn:oasis:names:tc:SAML:2.0:attrname-format:unspecified"&gt;
              &lt;saml2:AttributeValue&gt;foo@bar.com&lt;/saml2:AttributeValue&gt;
          &lt;/saml2:Attribute&gt;
          &lt;saml2:Attribute Name="telephoneNumber" NameFormat="urn:oasis:names:tc:SAML:2.0:attrname-format:unspecified"&gt;
              &lt;saml2:AttributeValue&gt;555-345-678&lt;/saml2:AttributeValue&gt;
          &lt;/saml2:Attribute&gt;
          &lt;saml2:EncryptedAttribute&gt;
              &lt;xenc:EncryptedData xmlns:xenc="http://www.w3.org/2001/04/xmlenc#" Id="_76f515ac5b705170900e61bfc2e47c365496e1" Type="http://www.w3.org/2001/04/xmlenc#Element"&gt;
                  &lt;xenc:EncryptionMethod Algorithm="http://www.w3.org/2001/04/xmlenc#aes128-cbc"/&gt;
                  &lt;ds:KeyInfo xmlns:ds="http://www.w3.org/2000/09/xmldsig#"&gt;
                      &lt;xenc:EncryptedKey Id="_e6bc635bd69d40954b107517e362560683e05d"&gt;
                          &lt;xenc:EncryptionMethod Algorithm="http://www.w3.org/2001/04/xmlenc#rsa-oaep-mgf1p"&gt;
                              &lt;ds:DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1"/&gt;
                          &lt;/xenc:EncryptionMethod&gt;
                          &lt;ds:KeyInfo&gt;
                              &lt;ds:X509Data&gt;
                                  &lt;ds:X509Certificate&gt;MIIDUjCCA…&lt;/ds:X509Certificate&gt;
                              &lt;/ds:X509Data&gt;
                          &lt;/ds:KeyInfo&gt;
                          &lt;xenc:CipherData&gt;
  &lt;xenc:CipherValue&gt;fdGfjQ2…&lt;/xenc:CipherValue&gt;
                          &lt;/xenc:CipherData&gt;
                      &lt;/xenc:EncryptedKey&gt;
                  &lt;/ds:KeyInfo&gt;
                  &lt;xenc:CipherData&gt;
  &lt;xenc:CipherValue&gt;dEUUgk3A…&lt;/xenc:CipherValue&gt;
                  &lt;/xenc:CipherData&gt;
              &lt;/xenc:EncryptedData&gt;
          &lt;/saml2:EncryptedAttribute&gt;
          &lt;saml2:Attribute Name="username" NameFormat="urn:oasis:names:tc:SAML:2.0:attrname-format:unspecified"&gt;
              &lt;saml2:AttributeValue&gt;userid&lt;/saml2:AttributeValue&gt;
          &lt;/saml2:Attribute&gt;
      &lt;/saml2:AttributeStatement&gt;
  &lt;/saml2:Assertion&gt;
  </code></pre>