473,385 Members | 1,780 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

XML digital signatures

AK
Hello,

Is it possible to sign resources pointed to from an xml doc and the
element that contains those urls at the same time?

This is the xml:

<osfm:assets name="">
<osfm:asset media-type="text/xml" name="META-INF/
Container.xml" />
<osfm:asset media-type="text/xml" name="META-INF/Manifest.xml" /
>
<osfm:asset media-type="text/xml" name="META-INF/Metadata.xml" /
>
</osfm:assets>

So, after hashing those three files I would also like to hash the
osfm:assets element, but I can't find a way to do that without
creating a new SignedXml object, which then means I've got two
signatures. Does anyone know if I can add the element here as well?

This is the code so far:

public void hashAssets(XmlDocument Doc, RSA Key)
{
// Create a SignedXml object
SignedXml signedXml = new SignedXml(Doc);

// Add the key
signedXml.SigningKey = Key;

// Get urls to assets with signed = true
assetUris = getAssetUris();

foreach (string assetUri in assetUris)
{
// Create a reference to be signed
Reference reference = new Reference();
reference.Uri = assetUri;

//// Add an enveloped transformation to the reference
//XmlDsigEnvelopedSignatureTransform env = new
XmlDsigEnvelopedSignatureTransform();
//reference.AddTransform(env);

// Add the reference to the SignedXml object
signedXml.AddReference(reference);
}

// This is where I would like to hash the xml element
XmlElement assetElement = Doc.GetElementsByTagName("osfm:assets")[0]
as XmlElement;

// Compute the signature
signedXml.ComputeSignature();

// Get the XML representation of the signature and save it to an
XmlElement object
XmlElement xmlDigitalSignature = signedXml.GetXml();

// Append the element to the XML document
Doc.DocumentElement.AppendChild(Doc.ImportNode(xml DigitalSignature,
true));
}
Many thanks,

Annelie
Nov 5 '08 #1
0 1106

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

7
by: Guangxi Wu | last post by:
Hi all, Happy New Year. I am using SignedXML and an X509 certificate to digitally sign a SOAP message body and put the signature in the SOAP header for a B2B business application. Can you...
5
by: John Campbell | last post by:
Hi everyone I've been doing my best to understand the specifics of implimentating XML Digital Signatures, but I seem to be missing a fundamental concept. Let me start with a description of the...
0
by: Bradley Ward | last post by:
I have been searching and searching online for code examples of using both ..net framework and also WSE 2.0 classes to digitally sign a SOAP document and then verify the document. I got a few...
0
by: dixie | last post by:
My application developed in A2k has recently been run on an Access 2003 system and when it starts up there is a message that suggests that the macros need digital signatures. How do I create...
2
by: Martin Høst Normark | last post by:
Hi everyone Has anyone got the least experience in integrating the Digital Signature with an ASP.NET Web Application? Here in Denmark, as I supose in many other countries, they're promoting...
6
by: Matt Frame | last post by:
I have a client that has asked us to get a digital signature certificate and start digitally signing all files we pass between each other. I have heard of the subject and know about the certs but...
1
by: karflips33 | last post by:
Is it possible to automate the signing of Word 2003 docs with Digital Signatures? My problem with the code approach using ActiveDocument.Signatures.Add
6
by: simon | last post by:
I created an access database and digitally signed it. I then gave a copy of this Database to a friend. A few months later he wanted me to make some changes to it so i took an up-to-date copy from...
1
by: ckpoll2 | last post by:
Hi, I have a rookie question for you. I have a database where people create a form that has to be signed. Rather than print off a hard copy, I'd like the spot for the signature to have a digital...
5
by: troy_lee | last post by:
We have an application developed by one developer. He compiled the database into an application and digitally signed the application. He doesn't know if he used selfcert of makecert to make the...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.