簡體   English   中英

在iOS上通過X509證書對xml節點進行數字簽名

[英]Make digital sign of xml-nodes by X509 certificate on iOS

我在iOS上的鑰匙串中有X509證書。 我如何制作(和書寫)xml的數字簽名,如xml。 不作為字符串。 我只需要通過數字簽名來保護XML文檔的各個節點的安全。 如何在Objective-C上做到這一點?

    <eps:Document xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:eps="urn-zaoeps-schemas-docmanagement">
  <eps:DocumentData Id="{2c477639-f9ef-4955-91fb-ca8713ae8e31}">
    <eps:DocumentNumber>19</eps:DocumentNumber>
    <eps:Customer>Coca-Cola</eps:Customer>
    <eps:Topic>5</eps:Topic>
    <eps:Vendor>Peroni</eps:Vendor>
    <eps:Subject>Glass</eps:Subject>
    <eps:SignedAttachments>
      <eps:Attachment Name="Brif" DbId="{540880e7-96cd-4173-a76b-e42653f11af1}" IsApproved="false" Extension="doc">
        <eps:RelativePath>/540880e796cd4173a76be42653f11af1/Brif.doc</eps:RelativePath>
        <eps:Hash>1QBSw0+kbRbVGcHSbJIMuyQF8OA=</eps:Hash>
      </eps:Attachment>
    </eps:SignedAttachments>
  </eps:DocumentData>
  <eps:SignatureContainer>
    <eps:Signatures>
      <Signature Id="{82116185-ac2a-4af4-9d9d-ac304b4c20ed}" xmlns="http://www.w3.org/2000/09/xmldsig#">
        <SignedInfo>
          <CanonicalizationMethod Algorithm="http://www.w3.org/TR/2001/REC-xml-c14n-20010315" />
          <SignatureMethod Algorithm="http://www.w3.org/2000/09/xmldsig#rsa-sha1" />
          <Reference URI="#{2c477639-f9ef-4955-91fb-ca8713ae8e31}">
            <DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1" />
            <DigestValue>EmL07BOUnxW6QNgo5iTmKUtq2RQ=</DigestValue>
          </Reference>
          <Reference URI="#{e138da73-a971-4de2-b3a2-d050e53bfcdc}">
            <DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1" />
            <DigestValue>0Ivb7ArrzbEQ/QqC0f3isk9bf9c=</DigestValue>
          </Reference>
        </SignedInfo>
        <SignatureValue>oa3dYTM8yvrNUFytNWWLtSwoeRNhGe5R8DU/wVrx2nP2yxyxXOy5oHlnfkPkbBy4OWahm914QaShfpnVQVjvf1emYLgTG8swECVYDulyH97/vgJ+IUe8uMjyFnZWpTt2xBVoqprUSWRBUriXr5pAxqDLMYzgHazOB8LOJ3wIf5k=</SignatureValue>
        <KeyInfo>
......

我不知道您需要做什么,但是這里有一些庫參考可能對您有所幫助。

GDataXML是Google的XML解析器和創建者。

OAuth Obj-c具有一些有用的類,例如OAHMAC_SHA1SignatureProvider。

蘋果的加密指南

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM