canonicalization

Generating an XML document hash in C#

What's the best way to go about hashing an XML document in C#? I'd like to hash an XML document so that I can tell if it was manually changed from when it was generated. I'm not using this for security--it's OK if someone changes the XML, and changes the hash to match. For example, I'd hash the child nodes of the root and store the hash...

verifying a WCF signed SOAP message

I have a problem verifying a SOAP message timestamp and body. Before starting to write any code I'm trying to verify it by myself, these are the steps I followed to verify the timestamp: 1) Extract the timestamp tag, add any used namespace and write it to a file: <u:Timestamp u:Id="uuid-cd1febd3-a76a-4148-8a3e-367aee62293d-1" xmlns:u=...

Compare URIs for a search bot?

For a search bot, I am working on a design to: * compare URIs and * determine which URIs are really the same page Dealing with redirects and aliases: Case 1: Redirects Case 2: Aliases e.g. www Case 3: URL parameters e.g. sukshma.net/node#parameter I have two approaches I could follow, one approach is to explicitly check for redirects ...

CAT.NET "Sanitize the file path prior to passing it to file system routines" message

Hi. I'm analyzing my code (C#, desktop application) with CAT.NET Code Analysis and getting "Sanitize the file path prior to passing it to file system routines" message when dealing with file names. What I don't understand is that to ensure the file name is valid, I use: void SomeMethod(String filename) { filename = System.IO.Path.Ge...

Which is the proper XML exclusive canonicalization?

I'm using xmlseclibs to try and sign a SOAP document, but it does not seem to canonicalize things in the same way depending on whether I'm signing or validating. I'll give you an example. This is the XML I am trying to sign: <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"&gt; <soapenv:Header/> <soapenv:Body>...

Wordpress auto-generated "canonical" links - how to add a custom URL parameter?

Hello - Does anyone know how to modify the Wordpress canonical links to add a custom URL parameter? I have a Wordpress site with a page that queries a separate (non-Wordpress) database. I passed the URL parameter "pubID" to display individual books and it is working OK. Example: http://www.uglyducklingpresse.org/catalog/browse/item/...

How to Canonicalize a Stax XML object.

Hello, i want to Canonicalize a Stax object, the program it's doing it with DOM, but dom can't manage big XML documents (like 1GB), so STAX it's the solution. The Code that i have it's: File file=new File("big-1gb.xml"); org.apache.xml.security.Init.init(); DocumentBuilderFactory dfactory = DocumentBuilderFactory.newInstance(); Docu...

Generate canonical / real URL based on base.href or location

Is there a method/function to get the canonical / transformed URL, respecting any base.href setting of the page? I can get the base URL via (in jQuery) using $("base").attr("href") and I could use string methods to parse the URL meant to being made relative to this, but $("base").attr("href") has no host, path etc attributes (like win...

Canonical Link Code - Need 2 Refactored Versions - Remove Param / Query Strings

function canlink() { echo '<link rel="canonical" href="http://' . $_SERVER["HTTP_HOST"] . $_SERVER["REQUEST_URI"] . '" />'; } Need one version that removes just & and everything after and another that removes ? and everything after, I've been looking for a clean minimalist solution for the past 2-3 days with nothing close. Thanks, Bry...

SEO Canonical Issue resolution on iis

i have a site running on IIS that i have Canonical Issue with. the error is: The page with URL "http://www.site.org/images/join_forum.gif" can also be accessed by using URL "https://www.site.org/images/join_forum.gif".Search engines identify unique pages by using URLs. When a single page can be accessed by using any one of multiple UR...

Windows: How to canonicalize a file to the special folder?

i want to to persist some filenames for the user (e.g. recent files). Let's use six example files: c:\Documents & Settings\Ian\My Documents\Budget.xls c:\Documents & Settings\Ian\My Documents\My Pictures\Daughter's Winning Goal.jpg c:\Documents & Settings\Ian\Application Data\uTorrent c:\Documents & Settings\All Users\Application Data...

How To Use XmlDsigC14NTransform Class in C#

Hello, I am trying to canonicalize an xml node by using System.Security.Cryptography.Xml.XMLDsigC14nTransform class of c# .net Framework 2.0. The instance expects three different input types, NodeList, Stream and XMLDocument. I try the transform with all of these input types but I get different results. What I really want to do is to ...

handling carriage return in canonicalization with java

Hello, I am trying to canonicalize an html text node by com/sun/org/apache/xml/internal/security/c14n/Canonicalizer.java class. My input file has carriage return and a line feed at the end. Upon canonicalization I expect to see the carriage return transformed into &#xD;. However, the the output I get does not contain the carriage return...

How to correctly canonicalize a URL in an ASP.NET MVC application?

I'm trying to find a good general purpose way to canonicalize urls in an ASP.NET MVC 2 application. Here's what I've come up with so far: // Using an authorization filter because it is executed earlier than other filters public class CanonicalizeAttribute : AuthorizeAttribute { public bool ForceLowerCase { get;set; } public Can...