Private key public key signedXML

The signing key of the signedXML object should be the public key or the private key?

How do I use a .cer file to sign a signedXML object. How do I find the password for the files?

I should be using a .cer file correct and not a .pfx or other type of certificate?

[267 byte] By [DanScan] at [2007-12-17]
# 1

Try the following approach:

XmlDocument doc = new XmlDocument();
doc.Load("..\\..\\xmlfile1.xml");

X509Certificate2 cert = new X509Certificate2("..\\..\\test.cer");
KeyInfo keyInfo = new KeyInfo();
keyInfo.AddClause(new KeyInfoX509Data(cert));

SignedXml signedXml = new SignedXml();
signedXml.SigningKey = new RSACryptoServiceProvider();
signedXml.AddObject(new DataObject("MySample", "text/xml", "utf-8", doc.DocumentElement));
signedXml.AddReference(new Reference("#MySample"));
signedXml.KeyInfo = keyInfo;

signedXml.ComputeSignature();

ChrisLovett at 2007-9-9 > top of Msdn Tech,.NET Development,XML and the .NET Framework...
# 2
How would this be different if you wanted the signature enveloped? Thanks, this example was very helpful.
progchris at 2007-9-9 > top of Msdn Tech,.NET Development,XML and the .NET Framework...

.NET Development

Site Classified