<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; color: rgb(0, 0, 0); font-size: 14px; font-family: Calibri, sans-serif;">
<div>
<div>Brent, thank you for your suggestions.</div>
<div><br>
</div>
<div>I removed the unmarshall and the validation code, but the problem remains, investigating a little bit further, my exception says:</div>
<div><br>
</div>
<div>
<div>Caused by: org.w3c.dom.DOMException: Unable to resolve namespace prefix ds found on element {http://www.w3.org/2000/09/xmldsig#}DigestMethod</div>
<div><span class="Apple-tab-span" style="white-space:pre"></span>at net.shibboleth.utilities.java.support.xml.NamespaceSupport.rootNamespaces(NamespaceSupport.java:247)</div>
<div><span class="Apple-tab-span" style="white-space:pre"></span>at net.shibboleth.utilities.java.support.xml.NamespaceSupport.rootNamespaces(NamespaceSupport.java:295)</div>
<div><span class="Apple-tab-span" style="white-space:pre"></span>at net.shibboleth.utilities.java.support.xml.NamespaceSupport.rootNamespaces(NamespaceSupport.java:200)</div>
<div><span class="Apple-tab-span" style="white-space:pre"></span>at org.opensaml.core.xml.io.AbstractXMLObjectMarshaller.prepareForAdoption(AbstractXMLObjectMarshaller.java:422)</div>
<div><span class="Apple-tab-span" style="white-space:pre"></span>... 40 more</div>
<div><br>
</div>
</div>
<div>
<div>It seems some namespace might be missing during the marshaling of the encrypted assertion. I think the encrypted method worked fine, its this “ds” namespace that might be missing some where after my assertion was encrypted. I am still investigating.</div>
<div><br>
</div>
<div>I am going over all source code I can find related to V3, if I find more details, I will post there.</div>
<div><br>
</div>
<div>Thank you</div>
<div><span style="font-family: 'Calibri Light'; color: rgb(0, 73, 144);"></span></div>
</div>
</div>
<div><br>
</div>
<span id="OLK_SRC_BODY_SECTION">
<div style="font-family:Calibri; font-size:11pt; text-align:left; color:black; BORDER-BOTTOM: medium none; BORDER-LEFT: medium none; PADDING-BOTTOM: 0in; PADDING-LEFT: 0in; PADDING-RIGHT: 0in; BORDER-TOP: #b5c4df 1pt solid; BORDER-RIGHT: medium none; PADDING-TOP: 3pt">
<span style="font-weight:bold">From: </span>Brent Putman <<a href="mailto:putmanb@georgetown.edu">putmanb@georgetown.edu</a>><br>
<span style="font-weight:bold">Date: </span>Thursday, April 27, 2017 at 6:11 PM<br>
<span style="font-weight:bold">To: </span>Shib Dev <<a href="mailto:dev@shibboleth.net">dev@shibboleth.net</a>>, "Locatelli da Silva, Thiago" <<a href="mailto:thiago.locatellidasilva@transamerica.com">thiago.locatellidasilva@transamerica.com</a>><br>
<span style="font-weight:bold">Subject: </span>Re: OpenSAML V3: Problems while marshaling encrypted assertion<br>
</div>
<div><br>
</div>
<div>
<div text="#000000" bgcolor="#FFFFFF">
<p><br>
</p>
<br>
<div class="moz-cite-prefix">On 4/26/17 9:39 PM, Locatelli da Silva, Thiago wrote:<br>
</div>
<blockquote type="cite" cite="mid:D526BC12.D6C3%25thiago.locatellidasilva@transamerica.com">
<div>
<div>This is how I am signing the assertion:</div>
<div><br>
</div>
<div>
<p style="margin: 0px; font-size: 11px; line-height: normal;
font-family: Monaco;">
<span style="color: #931a68">private</span> Assertion createSignedAssertion()
<span style="color: #931a68">throws</span> SamlException {</p>
<p style="margin: 0px; font-size: 11px; line-height: normal;
font-family: Monaco;">
<span style="color: #931a68">try</span> {</p>
<p style="margin: 0px; font-size: 11px; line-height: normal;
font-family: Monaco; min-height: 15px;">
</p>
<p style="margin: 0px; font-size: 11px; line-height: normal;
font-family: Monaco;">
Signature <span style="color: #7e504f">signature</span> = createSignature();</p>
<p style="margin: 0px; font-size: 11px; line-height: normal;
font-family: Monaco;">
Assertion <span style="color: #7e504f">assertion</span> = createAssertion();</p>
<p style="margin: 0px; font-size: 11px; line-height: normal;
font-family: Monaco;">
<span style="color: #7e504f">assertion</span>.setSignature(<span style="color: #7e504f">signature</span>);</p>
<p style="margin: 0px; font-size: 11px; line-height: normal;
font-family: Monaco; min-height: 15px;">
<br>
</p>
<p style="margin: 0px; font-size: 11px; line-height: normal;
font-family: Monaco;">
MarshallerFactory <span style="color: #7e504f">marshallerFactory</span> = XMLObjectProviderRegistrySupport.getMarshallerFactory();</p>
<p style="margin: 0px; font-size: 11px; line-height: normal;
font-family: Monaco;">
<span style="color: #7e504f">marshallerFactory</span>.getMarshaller(<span style="color: #7e504f">assertion</span>).marshall(<span style="color: #7e504f">assertion</span>);</p>
<p style="margin: 0px; font-size: 11px; line-height: normal;
font-family: Monaco;">
Signer.signObject(<span style="color: #7e504f">signature</span>);</p>
<p style="margin: 0px; font-size: 11px; line-height: normal;
font-family: Monaco; min-height: 15px;">
<br>
</p>
<p style="margin: 0px; font-size: 11px; line-height: normal;
font-family: Monaco;">
UnmarshallerFactory <span style="color:
#7e504f">unmarshallerFactory</span> = XMLObjectProviderRegistrySupport.getUnmarshallerFactory();</p>
<p style="margin: 0px; font-size: 11px; line-height: normal;
font-family: Monaco;">
Assertion <span style="color: #7e504f">signedAssertion</span> = (Assertion)
<span style="color: #7e504f">unmarshallerFactory</span>.getUnmarshaller(<span style="color: #7e504f">assertion</span>.getDOM()).unmarshall(<span style="color: #7e504f">assertion</span>.getDOM());</p>
<p style="margin: 0px; font-size: 11px; line-height: normal;
font-family: Monaco; min-height: 15px;">
<br>
</p>
<p style="margin: 0px; font-size: 11px; line-height: normal;
font-family: Monaco; color: rgb(126, 80, 79);">
<span style="color: #000000"> </span><span style="color: #931a68">return</span><span style="color:
#000000"></span>signedAssertion<span style="color: #000000">;</span></p>
</div>
</div>
</blockquote>
<br>
The only thing that looks odd or unusual in your code so far is what you are doing above to unmarshall a new Assertion object after you've signed the input Assertion. You don't in general have to do that. You just sign it as you are doing and then make use
of the existing Assertion instance. It's already signed. I don't know off-hand if what you are doing could be screwing up the XML namespaces per the exception, but it could be, as it certainly is related to the DOM instances that are cached on the objects.<br>
<br>
I would suggest to try just commenting out those two unmarshalling lines above and just return the 'assertion' instance.<br>
<br>
</div>
</div>
</span><br>
<hr>
<font face="Arial" color="Gray" size="1"><br>
CONFIDENTIALITY NOTICE<br>
This transmission is intended for the sole use of the individual and/or entity to whom it is addressed, and may contain information and/or attachments that are privileged, confidential and exempt from disclosure under applicable law. If the reader of this transmission
is not the intended recipient, you are hereby notified that any disclosure, dissemination, distribution, duplication or the taking of any action in reliance on the contents of this transmission by someone other than the intended addressee or its designated
agent is strictly prohibited. If your receipt of this transmission is in error, please notify the sender by replying immediately to this transmission and destroying the transmission. For your protection, do not include Social Security numbers, passwords or
other non-public and personal information in your email. Thank you.<br>
</font>
</body>
</html>