का उपयोग कर सीधे एक ऑफिस वर्ड दस्तावेज़ पर हस्ताक्षर कर रहा हूं, मैं सी # एक्सएमएल प्रारूप में सी # का उपयोग कर एक Microsoft Office Word फ़ाइल पर हस्ताक्षर करने का प्रयास कर रहा हूं।एक्सएमएल
कुछ सवाल हैं और ambiguousness की तरह यहां उठता है:
- मैं डाइजेस्ट मूल्यों कैसे भरनी चाहिए, क्या मूल्य मैं बिल्कुल प्रत्येक संदर्भ के लिए पचाने चाहिए, और मैं प्रत्येक को बदलने के लिए क्या मूल्य पचाने चाहिए?
SignatureValue
बनाने के लिए मुझे किस मूल्य पर हस्ताक्षर करना चाहिए?- और x509 डेटा में मुझे किस प्रमाणपत्र में शामिल करना चाहिए और कैसे? (हमारे पास प्रमाण पत्र नहीं है इसलिए एक बनाने के लिए एक गाइड की सराहना की जाती है।)
अंतिम प्रश्न यह है कि मैं इसे सही तरीके से कर रहा हूं? शायद यहां कुछ गड़बड़ है और मैंने एक पैकेज खो दिया है जो अन्यथा ओपनएक्सएमएल दस्तावेज़ से बातचीत करेगा और इसे हस्ताक्षर करेगा।
लेकिन याद रखें कि मैं वास्तव में एक बाहरी टोकन के साथ डेटा पर हस्ताक्षर करने की कोशिश कर रहा हूं जिसमें एक pkcs11 इंटरफ़ेस उपलब्ध है (लेकिन कोई सीएसपी नहीं है) इसलिए मैंने इसे PKCS11 इंटरऑप लाइब्रेरी का उपयोग C# पर माइग्रेट करने के लिए किया है, लेकिन मैं अभी भी यहां थोड़ा उलझन में है।
- क्या कोई पैकेज है जिसका उपयोग मैं दस्तावेज़ दस्तावेज़ों पर हस्ताक्षर करने के लिए कर सकता हूं?
- या क्या कोई पैकेज है जो openXML इंटरैक्शन को आसान बनाता है?
- या मुझे इसे मैन्युअल रूप से करना है?
एक महत्व यहाँ नहीं माना जाना चाहिए (आप अपने कस्टम एल्गोरिथ्म के साथ यह जगह ले सकता है))
BTW XML में एक हस्ताक्षर बिल्डर इस तरह दिखता है:
<?xml version="1.0" encoding="UTF-8"?>
<Signature xmlns="http://www.w3.org/2000/09/xmldsig#" Id="idPackageSignature">
<SignedInfo>
<CanonicalizationMethod Algorithm="http://www.w3.org/TR/2001/REC-xml-c14n-20010315"/>
<SignatureMethod Algorithm="http://www.w3.org/2001/04/xmldsig-more#rsa-sha256"/>
<Reference Type="http://www.w3.org/2000/09/xmldsig#Object" URI="#idPackageObject">
<DigestMethod Algorithm="http://www.w3.org/2001/04/xmlenc#sha256"/>
<DigestValue/>
</Reference>
<Reference Type="http://www.w3.org/2000/09/xmldsig#Object" URI="#idOfficeObject">
<DigestMethod Algorithm="http://www.w3.org/2001/04/xmlenc#sha256"/>
<DigestValue/>
</Reference>
<Reference Type="http://uri.etsi.org/01903#SignedProperties" URI="#idSignedProperties">
<Transforms>
<Transform Algorithm="http://www.w3.org/TR/2001/REC-xml-c14n-20010315"/>
</Transforms>
<DigestMethod Algorithm="http://www.w3.org/2001/04/xmlenc#sha256"/>
<DigestValue/>
</Reference>
</SignedInfo>
<SignatureValue/>
<KeyInfo>
<X509Data>
<X509Certificate/>
</X509Data>
</KeyInfo>
<Object Id="idPackageObject">
<Manifest>
<Reference URI="/_rels/.rels?ContentType=application/vnd.openxmlformats-package.relationships+xml">
<Transforms>
<Transform Algorithm="http://schemas.openxmlformats.org/package/2006/RelationshipTransform">
<mdssi:RelationshipReference xmlns:mdssi="http://schemas.openxmlformats.org/package/2006/digital-signature" SourceId="rId1"/>
</Transform>
<Transform Algorithm="http://www.w3.org/TR/2001/REC-xml-c14n-20010315"/>
</Transforms>
<DigestMethod Algorithm="http://www.w3.org/2001/04/xmlenc#sha256"/>
<DigestValue/>
</Reference>
<Reference URI="/word/_rels/document.xml.rels?ContentType=application/vnd.openxmlformats-package.relationships+xml">
<Transforms>
<Transform Algorithm="http://schemas.openxmlformats.org/package/2006/RelationshipTransform">
<mdssi:RelationshipReference xmlns:mdssi="http://schemas.openxmlformats.org/package/2006/digital-signature" SourceId="rId5"/>
<mdssi:RelationshipReference xmlns:mdssi="http://schemas.openxmlformats.org/package/2006/digital-signature" SourceId="rId4"/>
<mdssi:RelationshipReference xmlns:mdssi="http://schemas.openxmlformats.org/package/2006/digital-signature" SourceId="rId3"/>
<mdssi:RelationshipReference xmlns:mdssi="http://schemas.openxmlformats.org/package/2006/digital-signature" SourceId="rId2"/>
<mdssi:RelationshipReference xmlns:mdssi="http://schemas.openxmlformats.org/package/2006/digital-signature" SourceId="rId1"/>
</Transform>
<Transform Algorithm="http://www.w3.org/TR/2001/REC-xml-c14n-20010315"/>
</Transforms>
<DigestMethod Algorithm="http://www.w3.org/2001/04/xmlenc#sha256"/>
<DigestValue/>
</Reference>
<Reference URI="/word/document.xml?ContentType=application/vnd.openxmlformats-officedocument.wordprocessingml.document.main+xml">
<DigestMethod Algorithm="http://www.w3.org/2001/04/xmlenc#sha256"/>
<DigestValue/>
</Reference>
<Reference URI="/word/fontTable.xml?ContentType=application/vnd.openxmlformats-officedocument.wordprocessingml.fontTable+xml">
<DigestMethod Algorithm="http://www.w3.org/2001/04/xmlenc#sha256"/>
<DigestValue/>
</Reference>
<Reference URI="/word/settings.xml?ContentType=application/vnd.openxmlformats-officedocument.wordprocessingml.settings+xml">
<DigestMethod Algorithm="http://www.w3.org/2001/04/xmlenc#sha256"/>
<DigestValue/>
</Reference>
<Reference URI="/word/styles.xml?ContentType=application/vnd.openxmlformats-officedocument.wordprocessingml.styles+xml">
<DigestMethod Algorithm="http://www.w3.org/2001/04/xmlenc#sha256"/>
<DigestValue/>
</Reference>
<Reference URI="/word/theme/theme1.xml?ContentType=application/vnd.openxmlformats-officedocument.theme+xml">
<DigestMethod Algorithm="http://www.w3.org/2001/04/xmlenc#sha256"/>
<DigestValue/>
</Reference>
<Reference URI="/word/webSettings.xml?ContentType=application/vnd.openxmlformats-officedocument.wordprocessingml.webSettings+xml">
<DigestMethod Algorithm="http://www.w3.org/2001/04/xmlenc#sha256"/>
<DigestValue/>
</Reference>
</Manifest>
<SignatureProperties>
<SignatureProperty Id="idSignatureTime" Target="#idPackageSignature">
<mdssi:SignatureTime xmlns:mdssi="http://schemas.openxmlformats.org/package/2006/digital-signature">
<mdssi:Format>YYYY-MM-DDThh:mm:ssTZD</mdssi:Format>
<mdssi:Value>2015-11-22T17:21:28Z</mdssi:Value>
</mdssi:SignatureTime>
</SignatureProperty>
</SignatureProperties>
</Object>
<Object Id="idOfficeObject">
<SignatureProperties>
<SignatureProperty Id="idOfficeV1Details" Target="#idPackageSignature">
<SignatureInfoV1 xmlns="http://schemas.microsoft.com/office/2006/digsig">
<SetupID/>
<SignatureText/>
<SignatureImage/>
<SignatureComments>TEST SIGNING</SignatureComments>
<WindowsVersion>10.0</WindowsVersion>
<OfficeVersion>15.0</OfficeVersion>
<ApplicationVersion>15.0</ApplicationVersion>
<Monitors>1</Monitors>
<HorizontalResolution>1920</HorizontalResolution>
<VerticalResolution>1080</VerticalResolution>
<ColorDepth>32</ColorDepth>
<SignatureProviderId>{00000000-0000-0000-0000-000000000000}</SignatureProviderId>
<SignatureProviderUrl/>
<SignatureProviderDetails>9</SignatureProviderDetails>
<SignatureType>1</SignatureType>
</SignatureInfoV1>
</SignatureProperty>
</SignatureProperties>
</Object>
<Object>
<xd:QualifyingProperties xmlns:xd="http://uri.etsi.org/01903/v1.3.2#" Target="#idPackageSignature">
<xd:SignedProperties Id="idSignedProperties">
<xd:SignedSignatureProperties>
<xd:SigningTime>2015-11-22T17:21:28Z</xd:SigningTime>
<xd:SigningCertificate>
<xd:Cert>
<xd:CertDigest>
<DigestMethod Algorithm="http://www.w3.org/2001/04/xmlenc#sha256"/>
<DigestValue/>
</xd:CertDigest>
<xd:IssuerSerial>
<X509IssuerName>[email protected], CN=ALI-PC, OU=ALI-PC, O=ALI-PC, L=ALI-PC, S=ALI-PC, C=98</X509IssuerName>
<X509SerialNumber>1</X509SerialNumber>
</xd:IssuerSerial>
</xd:Cert>
</xd:SigningCertificate>
<xd:SignaturePolicyIdentifier>
<xd:SignaturePolicyImplied/>
</xd:SignaturePolicyIdentifier>
</xd:SignedSignatureProperties>
<xd:SignedDataObjectProperties>
<xd:CommitmentTypeIndication>
<xd:CommitmentTypeId>
<xd:Identifier>http://uri.etsi.org/01903/v1.2.2#ProofOfOrigin</xd:Identifier>
<xd:Description>Created and approved this document</xd:Description>
</xd:CommitmentTypeId>
<xd:AllSignedDataObjects/>
<xd:CommitmentTypeQualifiers>
<xd:CommitmentTypeQualifier>TEST SIGNING</xd:CommitmentTypeQualifier>
</xd:CommitmentTypeQualifiers>
</xd:CommitmentTypeIndication>
</xd:SignedDataObjectProperties>
</xd:SignedProperties>
</xd:QualifyingProperties>
</Object>
</Signature>
संपादन मोड के लिए बीटीडब्ल्यू धन्यवाद :) – lkn2993
नोट: मैंने एक्सएमएल कोड को दोबारा सुधार दिया है जिसमें कई '<' वर्णों की कमी थी। मुझे नहीं पता कि एसओ संपादक का आर्टिफैक्ट रहा है या नहीं। – collapsar
अच्छी तरह से कहें कि मुझे एक परियोजना को कार्यान्वित करने की आवश्यकता है जैसे: http://www.signfiles.com/signature-library/ – lkn2993