Вот данные о реализации пописи XML
1) есть реализация на JAVA от IBM Этот пакет, основанный на языке программирования Java, доступен по адресу http://www.alphaworks.ibm.com/tech/xmlsecuritysuite. XML Security Suite является средством, обеспечивающим такие элементы безопасности, как цифровая подпись, шифрование и управление доступом для документов XML. С его помощью можно добиться больших успехов, нежели используя возможности протоколов безопасности транспортного уровня (например, Secure Sockets Layer, SSL).
Этот пакет реализует три технологии:
ЭЦП основана на спецификации «XML — Signature Syntax and Processing» от W3C и IETF (и на спецификации «Canonical XML»); шифрование реализовано на основе спецификации «XML — Encryption Syntax and Processing» от W3C; управление доступом для документов XML (XML Access Control Language). XML Security Suite — это одно из лучших современных средств для защиты XML-документов. Кроме самого архива (JAR) с библиотекой классов, оно включает подробную документацию и примеры, позволяющие быстро сориентироваться в иерархии классов.
2) есть от Apache на С++ XML Security (Apache) Проект XML Security от Apache (http://xml.apache.org/security/) — это также реализация стандартов в области защиты XML. В настоящий момент он включает реализации для спецификаций «Canonical XML» и «XML — Signature Syntax and Processing». Это означает, что вы можете использовать данное программное обеспечение для создания и верификации цифровых подписей XML и подписывать и XML, и/или другие данные. Пакет, различные версии которого можно скачать по адресу http://xml.apache.org/security/dist/, кроме библиотек классов, также поставляется с документацией и примерами использования.
3) в .Net есть классы при помощи которых можно реализовать XML подпись + в MSDN есть хороший полный пример реализации
System::Security::Cryptography; System::Security::Cryptography::Xml; System::Xml;
А точнее класс SignedXml.CheckSignature Method (AsymmetricAlgorithm)
раздел MSDN ms-help://MS.MSDNQTR.2004JUL.1033/cpref/html/frlrfSystemSecurityCryptographyXmlSignedXmlClassCheckSignatureTopic2.htm
[C++]
| Код | // // This example signs a file specified by a URI // using a detached signature. It then verifies // the signed XML. //
#using <mscorlib.dll> #using <System.dll> #using <System.Xml.dll> #using <System.Security.dll>
using namespace System; using namespace System::Security::Cryptography; using namespace System::Security::Cryptography::Xml; using namespace System::Text; using namespace System::Xml;
// Sign an XML file and save the signature in a new file. This method does not // save the public key within the XML file. This file cannot be verified unless // the verifying code has the key with which it was signed. void SignDetachedResource(String* URIString, String* XmlSigFileName, RSA* Key) { // Create a SignedXml object. SignedXml* signedXml = new SignedXml();
// Assign the key to the SignedXml object. signedXml->SigningKey = Key;
// Create a reference to be signed. Reference* reference = new Reference();
// Add the passed URI to the reference object. reference->Uri = URIString;
// Add a transformation if the URI is an XML file. if (URIString->EndsWith(S"xml")) { reference->AddTransform(new XmlDsigC14NTransform()); }
// 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();
// Save the signed XML document to a file specified // using the passed string. XmlTextWriter* xmltw = new XmlTextWriter(XmlSigFileName, new UTF8Encoding(false)); xmlDigitalSignature->WriteTo(xmltw); xmltw->Close();
}
// Verify the signature of an XML file against an asymetric // algorithm and return the result. static Boolean VerifyDetachedSignature(String* XmlSigFileName, RSA* Key) { // Create a new XML document. XmlDocument* xmlDocument = new XmlDocument();
// Load the passedXML file into the document. xmlDocument->Load(XmlSigFileName);
// Create a new SignedXml object. SignedXml* signedXml = new SignedXml();
// Find the "Signature" node and create a new // XmlNodeList object. XmlNodeList* nodeList = xmlDocument->GetElementsByTagName(S"Signature");
// Load the signature node. signedXml->LoadXml(dynamic_cast<XmlElement*>(nodeList->ItemOf[0]));
// Check the signature against the passed asymetric key // and return the result. return signedXml->CheckSignature(Key); }
int main() { // The URI to sign. String* resourceToSign = S"http://www.microsoft.com";
// The name of the file to which to save the XML signature. String* XmlFileName = S"xmldsig.xml";
try {
// Generate a signing key. RSACryptoServiceProvider* Key = new RSACryptoServiceProvider();
Console::WriteLine(S"Signing: {0}", resourceToSign);
// Sign the detached resourceand save the signature in an XML file. SignDetachedResource(resourceToSign, XmlFileName, Key);
Console::WriteLine(S"XML Signature was succesfully computed and saved to {0}.", XmlFileName);
// Verify the signature of the signed XML. Console::WriteLine(S"Verifying signature...");
//Verify the XML signature in the XML file against the key. bool result = VerifyDetachedSignature(XmlFileName, Key);
// Display the results of the signature verification to // the console. if(result) { Console::WriteLine(S"The XML signature is valid."); } else { Console::WriteLine(S"The XML signature is not valid."); } } catch(CryptographicException* e) { Console::WriteLine(e->Message);
}
|
В статье MSDN приводятся также пример реализации данных задач на VBasic и C#.
4)Другие реализации
Доступны и другие реализации с различными вариантами лицензирования — как реализации спецификации электронной цифровой подписи XML-документов, так и шифрования XML-документов. Вот некоторые из них:
XML Security Library (Aleksey Sanin) — http://www.aleksey.com/xmlsec/;
KeyTools XML (Baltimore) — http://www.baltimore.com/keytools/xml/;
XML Security (Phaos) — http://phaos.com/products/category/xml.html;
XML Signature SDK (Verisign) — http://www.xmltrustcenter.org/xmlsig/developer/verisign/index.htm |