SignedXml.CheckSignature returns false when the root element has namespace declarations

Hi,

I am using SignedXml with RSACryptoServiceProvider to sign some XML.
the verification seems to work OK if there is no namespace declaration
on the root element of the XML but if there is one it always returns
false.

here's a complete example:

XmlDocument doc = new XmlDocument();
doc.LoadXml("<foo xmlns:foo=\"foo\" />");
SignedXml sx = new SignedXml(doc);
RSACryptoServiceProvider csp = new RSACryptoServiceProvider();
sx.SigningKey = csp;
Reference refe = new Reference("");
sx.AddReference(refe);
sx.ComputeSignature();
XmlElement signature = sx.GetXml();
SignedXml sx2 = new SignedXml(doc);
sx.LoadXml(signature);
bool result = sx.CheckSignature(csp);

note that it's signing and verifying exactly the same bit of XML with
exactly the same CryptoServiceProvider. The example as shown always
returns false but if you replace the second line with:

    doc.LoadXml("<foo />");

The CheckSignature method returns true.

Is there some subtlety with the way namespaces work in XML signatures
or is this a bug in the implementation?

note that  the namespace isn't even referenced in the XML content so I
wouldn't expect it to have any effect. If I add a simlar namespace
declaration to a sub-node it doesn't affect the signature at all.

0
ajfish (41)
12/9/2008 4:32:03 PM
dotnet.xml 7266 articles. 0 followers. Follow

0 Replies
929 Views

Similar Articles

[PageSpeed] 24

Reply:

Similar Artilces:

Sales Return Quantities Entry in SOP: Returns
We use SOP to process returns. When we initially create the return, we indicate "Return" in the Sales Return Quantities Entry (via Quantities Returned field). Then our warehouse checks out the returned merchandise to determine if it has been damaged, etc. However, when we go back into the Return document, the Sales Return Quantities Entry does not open again to allow a change from "Returned" to "Damaged." Any suggestions? Thanks, Have you looked at inventory item transfer entries, using the "Quantity Type" button? You should be able to transfer ...

How do I prevent an autofill column returning a zero
I am a bit of a beginner & this might seem obvious, but when I create an autofill column, it seems to return a zero by default, so that any chart I then create has a vertical drop to zero and makes the scale look ridiculous. Any help would be appreciated It might help to post the formula in the cell. I had the same problem i think you had. In my Page1, you would put an "x" to transfer over to my Page2, and so it would not have a "0" on Page2, it put in the following: =IF(page1!O24="X","X","") The "" will return an empty cel...

return value from range of worksheets
I am trying to return the name of a person who worked the most hours in my volunteer table. The columns include the person's name, date worked, number of hours per shift and total hours worked. There are 100+ people that each have their own worksheet. I would like to use a lookup to return the name of the person with the most hours. How would I do this? I tried grouping the sheets and referencing the ranges I want to use. Thanks. As much as Excel looks like a 3D spreadsheet, its actual 3D functionality is very limited, especially if you are not comfortable with VBA solu...

vlookup returning #NA
I've tried searching, I've used contextures.com but couldn't find the right help. I have an extremely large table: A2:C49918 Column A = Zip Codes Column B = State Column C = County What I want is the state and county to pull when someone enters a zip in field G6 of a different sheet. my formula for state is as follows: =vlookup(G6,'Zip Code Lookup'!$A$2:$C$49918,2) and I am getting the infamous #NA as a returned result after I enter a valid value into G6. any suggestions. once I get this formula to work, I can use it to pull the county as well. and yes, I have fo...

carriage return in RichEdit
Okay, I've done a ton of searching on this one and I've found a lot of vague hints that this is possible, and not one answer so far. So I have a question for you. Is it possible to get CR/LF OUT of a Rich edit? I'm on xp, so I have CRichEditCtrl using Rich Edit 3.0. It says it handles CR/LF. Now, my understanding is that internally, it converst CR/LF to LF internally. If I make a call to .GetWindowText(), I get all the text correctly, but just the LF, it doesn't convert it back to CR/LF. The problem is, I want good old CR/LF in my output, and a CString.Replace(_T("\n...

Return Column Heading based on value in row
I want to return the column heading based on the highest value in a range of rows. I want to return the week that had the most units sold. I have the units sold for each week by item and the total for that week. I used the large() and found the largest amount but I don't know where to begin on returning the week that this number occurs. I have 1218 items over a 23 week period that I want to compare. Any help is greatly appreciated. Thank, Lee Coleman Say the item data is in row 7 and the columns headers are in row 1. In Z10 thru Z12 enter: =LARGE(A7:W7,1) =MATCH(X10,A7:W7,0) =I...

How to override the default NameSpace when deserializing an xml file
Hi all. In my company we have a webservice that exposes an OBJECT, the company that made the webservice gave us the object dll so that we can have there functionallity (lots of logic). As a part of some changes we made we wanted to remopve the constrain of the dll they gave us, so we started using the class exposed by the webservice and created a special class that will have the functinallity needed for that object. The problem is that the object recieved from some queried to the webservice was saved to a private xml file and is need to be deserialized later on... Now that we have sta...

XmlDsigC14NTransform signedXml.ComputeSignature()
1. signedXml.ComputeSignature() outputs a digest value of something. what is it? I mean, how can i get it? I get the canonical form of my xml with XmlDsigC14NTransform then digest it but the digest value is different. 2.signedXml.ComputeSignature() uses XmlDsigC14NTransform. But how? What are the parameters? I also need to obtain canonicalized XML in C14N format, but I haven't discovered how to do it. When I compare the DigestValue gen'd by ComputeSignature and my own DigestValue gen'd using ComputeHash, I get different values, but only when namespaces are involved. "Lemba...

Return value from stored procedure that returns a recordset
I need a stored procedure that returns a recordset and a return value, for example, (oversimplified, of course) CREATE PROC test_proc as begin set nocount on declare @err int select * from customers select @err = @@ERROR set nocount off return @err go The stored procedure will be called from an ASP.Net page using SqlCommand.ExecuteReader. I understand that the return value will not be available (through an SqlParameter with Direction = ReturnValue) until after reading all the records from the datareader and closing the reader. If I don't wa...

False (?) complains about URL in HTML-formatted email mesage
Hi, I am sending email from SQL Server in HTML format. It contains a link to a report. When I click on the link on email, after a minute or so of hesitation Outlook shows alert with following text: General failure. The URL was: "http://nareports/ReportServer/Pages/ReportViewer.aspx?/CBA+D...". The system cannon find the file specified. However I know that URL is fine because: a) I tested it by pasting into browser and b) even after that alert IE still starts and shows me my report as intended!! So the only problem seems to be with that alarm itself... ...

DoModal() returning -1
I have a class derived from CDialog that I call DoModal() on. Up until recently this was working fine. Now it seems it always returns -1 without appearing (It never hits OnInitDialog()). How can I diagnose this problem? Thanks, Drew Did you remove a control form the dialog template? Or did the ID of the dialog template change. Step into the DoModal method and see where it breaks. AliR. "Drew Myers" <drew.nospam.myers@esrd.com> wrote in message news:eoB8lH7iFHA.2484@TK2MSFTNGP15.phx.gbl... > I have a class derived from CDialog that I call DoModal() on. Up until ...

Return a charactar from a cell value
Simple question! How do I return a scharactar from a cell value in VB? Like... ANSWER = Left(Activecell.Value, 10) Msgbox ANSWER ....but for example I just want to return one charactar, the ninth, from the cell value. regards Marcus Marcus, MsgBox Left(ActiveCell, 10) or: Dim MyString as String MyString = ActiveCell.Value MsgBox MyString -- Earl Kiosterud mvpearl omitthisword at verizon period net ------------------------------------------- "Marcus Ostman" <marcus.ostman@smg.net> wrote in message news:c9ee00b1.0408110649.604966f2@posting.google.com... > Simple questi...

SignedXML #2
Hello, I'm trying to create signed XML document with SignedXml class. As a SigningKey I'd like to use key pair obtained from user certificate stored in current user certificate store. I'm using WSE 2 SP 2 to get certificate, but when I'm invoking ComputeSignature() method of SignedXML instance I recive the following exception: "An unhandled exception of type 'System.NotSupportedException' occurred in microsoft.web.services2.dll Additional information: DecryptValue" I'd also like to mention, that when I try to export key's parameters I recive the fol...

Array not working correctly Returns FALSE on second part
The below array I am working on is having a problem with the scond part. The cell is returning false. The first part works correctly when "All" is selected in my list box which triggers the first part, but when I select a specific region, the cells returns FALSE. Usually the array just doesn't work if there is a problem so I am not sure how to interpret this. I have checked the standard items that can cause problems with arrays. Specifically, name range size are equal. Thanks =IF('Dashboard-Sales'!$A$6="ALL",SUM(IF($AM3&Key!$B$2&Lists!$I$3...

How do i hide carriage returns?
How do i hide carriage returns? (the "boxes" behind a line of text) Format the cells to Wrap Text. Or get rid of the linefeeds. Edit>Replace what: ctrl + j with: space or nothing. Gord Dibben MS Excel MVP On Fri, 28 May 2010 09:41:01 -0700, TVGuy29 <TVGuy29@discussions.microsoft.com> wrote: >How do i hide carriage returns? (the "boxes" behind a line of text) > ...

did not return the results.
Hi, I have a big problem with my vista-windows mail.A few days ago, after 5 minutes that I had shut off my computer, in order to check one of my e-mail,I'm started it again.But windows mail gave error and send me error report that the e-mails not working correctly.Since that day,the content of the e-mails,attachments not to be seen when you click any of them.Mean it didn't retun the results.it is a bit urgent.Pls kindly help me. Thanks... Try repairing the database. See www.oehelp.com/WMUTil/ If you still have problems after that, see point 3 here (www.oehelp.c...

Returning null values
I have a report where I think that certain fields are not shrinking because while I think that the associated query fields look blank, they are no in fact null. How can I ensure that a query field (that is the result of an expression) is in fact null, and not just blank? Joseph Greenberg wrote: >I have a report where I think that certain fields are not shrinking because >while I think that the associated query fields look blank, they are no in >fact null. How can I ensure that a query field (that is the result of an >expression) is in fact null, and not just b...

SOP Return
How best should a situation like this be dealt with; Customer returns an item, payment method was cash. Customer returns the item and takes something of greater value. Customer said he will pay the difference of the second item. You could enter a sales invoice in SOP. Enter a negative quantity for the item being returned and a positive quantity for the new item. The difference between the two should be the amount the customer owes. -- Charles Allen, MVP "rcr" wrote: > How best should a situation like this be dealt with; > > Customer returns an item, payment method...

Returning records from Recordset object
Does anyone knows how to get records returned from the OpenRecordset function in the session.database.openrecordset function? I would like to returns records from a query using the session object. ...

How do I delete hard returns after footnote separators?
In the older version of Word, you could go to "View" to view footnotes and select the footnote separator formatting. You could then show formatting to see all of the default hard returns that preceded the actual footnote. I need to be able to delete those hard returns in '07, but cannot for the life of me figure out how. It works pretty much the same way, but (of course) all the buttons are in different places. 1) Be in Draft View (formerly Normal) 2) References tab, Show Footnotes button 3) Use dropdown at the top of the footnotes pane just as in the olden ...

HELP! When I delete email it returns as a new item...Outlook 2003
Even if I empty the deleted items folder. Say I receive 27 items and delete them and then empty the deleted items folder. At the next Send/Receive they all come back as new...sometimes multiple copies of each email. It is getting really bad as this has continued for days. My inbox keeps growing and I am losing my mind. Someone PLEASE HELP ME! ...

column header changed from letter to number, how return to letter
My cell A1 is now 1:1 how do I change the column header back to a letter? -- Ron go to tools>options>general and uncheck R1C1 reference Regards, Peo Sjoblom "Ron" wrote: > My cell A1 is now 1:1 how do I change the column header back to a letter? > -- > Ron Ron, tools, options, general, uncheck R1C1 ref. style -- Paul B Always backup your data before trying something new Please post any response to the newsgroups so others can benefit from it Feedback on answers is always appreciated! Using Excel 2002 & 2003 "Ron" <ron@excel.microsoft.com> ...

Returning Nil
Hello I have a timesheet in excel, I would like the final column to work out the overtime per day which is over 7 hours. I've entered the formula: =I6-$H$4 I6 is the cell that has the total hours worked per day, in decimals. ie 7.75 H4 contains Number 7. And this works ok. BUT if the timesheet hasn't been filled the formula returns -7 What is the formula that returns nil or null if the row hasn't been filled? BTW in I6 there is the formula: =HOUR(H8)+(INT((MINUTE(H8)+7)/15))/4 Thank you Jen =MAX(I6-$H$4,0) HTH, Bernie MS Excel MVP "JB" <somehow@somewhere>...

SIGNEDXML
Hi, I have the following problem: I need to sign a XML Document whith SignedXML in Visual Basic .Net. When i signed the xml document and use the id Attribute in the next format "Id" this work, but, when i do the same but i only replace the id attribute for "ID" this does not work and gives me the message "Malformed Reference Element". For instance: This is my XML <mydocument ID="myfirstdocument"> ...... </mydocument> This is my code in VB.NET.... reference.uri="#myfirstdocument"... The above sample does not work This other...

rate of return
I have MS Money 2007 Deluxe, and I'm trying to learn about the rate of return for my investments. When I attempt to determine the rate of return for an investment held in 2006, I get two different numbers. I ran a financial report for an investment account to see what my return was 2006. For the account, which has 3 difference mutual funds, the "% rate of return" was one number and the "annual % return" was another number. What number should I look at? I'm confused, but learning. In microsoft.public.money, Humpfries wrote: >I have MS Money 2007 Del...