Код: Выделить всё
EBIXQUAL
234AB2340FD2C23035764578FF3091C1
2015-11-13T10:32:30.123Z
AD598
EF056
HPB
DZHNN
0000
authenticate="true"
Чтобы подписать документ на C#, я написал этот код:
Код: Выделить всё
XmlDocument xmlDoc = new XmlDocument();
xmlDoc.PreserveWhitespace = false;
xmlDoc.Load("hpbtest.xml");
RSA Key = new GestionCertificat("CN=XML_ENC_TEST_CERT4").getClePrivee();
// Create a SignedXml object.
SignedXml signedXml = new SignedXml(xmlDoc);
// Add the key to the SignedXml document.
signedXml.SigningKey = Key;
// Create a reference to be signed.
Reference reference = new Reference();
reference.Uri = "#xpointer(//*[@authenticate='true'])";
// Add an enveloped transformation to the reference.
XmlDsigExcC14NTransform env = new XmlDsigExcC14NTransform();
reference.AddTransform(env);
// Add the reference to the SignedXml object.
signedXml.AddReference(reference);
// 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.
xmlDoc.DocumentElement.AppendChild(xmlDoc.ImportNode(xmlDigitalSignature, true));
xmlDoc.Save("hpbtest.xml");
signedXml.ComputeSignature()
:
Неверный элемент ссылки
Не могли бы вы помочь мне решить мою проблему, пожалуйста?
Заранее спасибо!
Томас!
Подробнее здесь: https://stackoverflow.com/questions/336 ... ml-c-sharp
Мобильная версия