title: opensaml 3 signature from saml response is null
body: <p>Hi i got this errormessage:</p>
  
  <pre><code>net.shibboleth.utilities.java.support.logic.ConstraintViolationException: Signature was null
  </code></pre>
  
  <p>On validating a SAML response from Azure AD.</p>
  
  <p>For test purpose i saved a response file as xml and found a tag:</p>
  
  <pre><code>&lt;ds:Signature xmlns:ds="http://www.w3.org/2000/09/xmldsig#"&gt;
          &lt;ds:SignedInfo&gt;
              &lt;ds:CanonicalizationMethod Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#" /&gt;
              &lt;ds:SignatureMethod
                  Algorithm="http://www.w3.org/2001/04/xmldsig-more#rsa-sha256" /&gt;
              &lt;ds:Reference URI="#_97031c65-0139-4047-a416-9495df5d6ed7"&gt;
                  &lt;ds:Transforms&gt;
                      &lt;ds:Transform
                          Algorithm="http://www.w3.org/2000/09/xmldsig#enveloped-signature" /&gt;
                      &lt;ds:Transform Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#" /&gt;
                  &lt;/ds:Transforms&gt;
                  &lt;ds:DigestMethod Algorithm="http://www.w3.org/2001/04/xmlenc#sha256" /&gt;
                  &lt;ds:DigestValue&gt;
                      KMaFHRt8inqVYsMGKnAryKUTQUbYGPUDPxdvj6T08OQ=
                  &lt;/ds:DigestValue&gt;
              &lt;/ds:Reference&gt;
          &lt;/ds:SignedInfo&gt;
          &lt;ds:SignatureValue&gt;
             .....
          &lt;/ds:SignatureValue&gt;
          &lt;KeyInfo xmlns="http://www.w3.org/2000/09/xmldsig#"&gt;
              &lt;X509Data&gt;
                  &lt;X509Certificate&gt;
                      ....
                  &lt;/X509Certificate&gt;
              &lt;/X509Data&gt;
          &lt;/KeyInfo&gt;
      &lt;/ds:Signature&gt;
  </code></pre>
  
  <p>i unmarshall the XML response:</p>
  
  <pre><code>InitializationService.initialize();
  DocumentBuilderFactory documentBuilderFactory = DocumentBuilderFactory.newInstance();
  documentBuilderFactory.setNamespaceAware(true);
  DocumentBuilder docBuilder = documentBuilderFactory.newDocumentBuilder();
  String content = new String(Files.readAllBytes(Paths.get("saml_response_azure.xml")));
  Document document = docBuilder.parse(new ByteArrayInputStream(content.trim().getBytes()));
  
  Element element = document.getDocumentElement();
  Unmarshaller unmarshaller = XMLObjectProviderRegistrySupport.getUnmarshallerFactory().getUnmarshaller(element);
  Response response = (Response) unmarshaller.unmarshall(element);
  </code></pre>
  
  <p>And error is dropped at:</p>
  
  <pre><code>Signature signature = response.getAssertions().get(0).getSignature() // returns null
  
  SAMLSignatureProfileValidator profValidator = new SAMLSignatureProfileValidator();
  profValidator.validate(signature);
  </code></pre>