Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on Apr 24th, 2012  |  syntax: None  |  size: 1.08 KB  |  hits: 77  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. C# Signing XML documents with XAdES
  2. System.Security.Cryptography.Xml.Reference reference2;
  3. System.Security.Cryptography.Xml.SignedXml signedXml;
  4. ...
  5. reference2 = new Reference();
  6. reference2.Type = "http://uri.etsi.org/01903/v1.1.1#SignedProperties";
  7. reference2.Uri = "#SignedPropertiesId";
  8. //reference2.AddTransform(new XmlDsigExcC14NTransform()); IF I COMMENT THIS LINE IT WONT WORK
  9. signedXml.AddReference(reference2);
  10.  
  11. signedXml.ComputeSignature();
  12. XmlElement xmlDigitalSignature = signedXml.GetXml();
  13. xmlDoc.DocumentElement.AppendChild(xmlDoc.ImportNode(xmlDigitalSignature, true));
  14.  
  15. signedXml.CheckSignature(); //return false if dont use Transform in second REF
  16.  
  17. signedXml.ComputeSignature();
  18. XmlElement xmlDigitalSignature = signedXml.GetXml();
  19. xmlDoc.DocumentElement.AppendChild(xmlDoc.ImportNode(xmlDigitalSignature, true));
  20.        
  21. <ds:KeyInfo>
  22.   <ds:X509Data>
  23.     <ds:X509Certificate>cert...</ds:X509Certificate>
  24.   </ds:X509Data>
  25. </ds:KeyInfo>
  26. <ds:Object>
  27.   <xds:QualifyingProperties Target="#SignatureId">
  28.     <xds:SignedProperties Id="SignedPropertiesId">
  29.       <xds:SignedSignatureProperties>