0

我正在尝试使用 python2 版本 o XAdes 和 XMLSIG 签署文档。我不想用 Xades-BES 标准签署所述文件。

我正在做的是以下

def get_signature(self, root, cert_file, xml_file):
    roots = etree.parse(xml_file).getroot()
    signature = xmlsig.template.create(c14n_method=xmlsig.constants.TransformInclC14N, sign_method=xmlsig.constants.TransformRsaSha256, name="EmitterPartySignatureId")
    signature_id = self.iud
    xmlsig.template.add_reference(signature, xmlsig.constants.TransformSha256, uri="#"+ signature_id,name="DataReferenceId")
    ref = xmlsig.template.add_reference(signature, xmlsig.constants.TransformSha256, uri="#SignedPropertiesId", uri_type="http://uri.etsi.org/01903#SignedProperties")
    xmlsig.template.add_transform(ref, xmlsig.constants.TransformInclC14N)
    ki = xmlsig.template.ensure_key_info(signature)
    data = xmlsig.template.add_x509_data(ki)
    xmlsig.template.x509_data_add_certificate(data)
    qualifying = template.create_qualifying_properties(signature, etsi="xades")
    props = template.create_signed_properties(qualifying,name="SignedPropertiesId")
    template.add_production_place(props, city="Praia", state="Santiago", postal_code="7952", country="Cabo Verde")
    sdop = template.ensure_signed_data_object_properties(props)
    template.add_data_object_format(sdop, reference="#DataReferenceId", mime_type="text/xml")
    roots.append(signature)

    pw = "R6d1WSpo"
    with open(cert_file, "rb") as key_file:
        certificate = load_pkcs12(key_file.read(),passphrase=pw.encode('utf-8'))
    
    policy = ImpliedPolicy(hash_method=xmlsig.constants.TransformSha256)
    ctx=XAdESContext(policy)
    ctx.load_pkcs12(certificate)
    ctx.sign(signature)
    print(roots.nsmap)
    roots.append(signature)
    print(roots.nsmap)
    et = etree.ElementTree(roots)
    return et

生成的 XML 如下:

<Dfe DocumentTypeCode="1" Id="CV2211027266341047000040120210000111938531271" Version="1.0">
  <Invoice>
    <LedCode>00004</LedCode>
    <Serie>123456789</Serie>
    <DocumentNumber>202100001</DocumentNumber>
    <IssueDate>2021-10-27</IssueDate>
    <IssueTime>10:58:29</IssueTime>
    <EmitterParty>
      <TaxId CountryCode="CV">266341047</TaxId>
      <Name>
        BMP, Importação, Comercialização e Produção P.Q S. Unipessoal, Lda.
      </Name>
      <Address CountryCode="CV">
<AddressDetail>N/A</AddressDetail>
</Address>
      <Contacts>
        <Telephone>2385307075</Telephone>
        <Email>info@imporquimica.cv</Email>
      </Contacts>
    </EmitterParty>
    <ReceiverParty>
      <TaxId CountryCode="CV">252953819</TaxId>
      <Name>
        2J - Import - Export, Lda - Peças e Acessórios Auto
      </Name>
      <Address CountryCode="CV">
<AddressDetail>N/A</AddressDetail>
</Address>
      <Contacts>
        <Telephone>2382321434</Telephone>
        <Email>geral2jcv@hotmail.com</Email>
      </Contacts>
    </ReceiverParty>
    <Lines>
      <Line LineTypeCode="N">
        <Id>17094</Id>
        <Quantity IsStandardUnitCode="false" UnitCode="UN">1</Quantity>
        <Price>670</Price>
        <PriceExtension>670</PriceExtension>
        <NetTotal>670</NetTotal>
        <Tax TaxTypeCode="IVA">
          <TaxPercentage>15</TaxPercentage>
        </Tax>
        <Item>
          <Description>N/A</Description>
          <EmitterIdentification>CV266341047</EmitterIdentification>
        </Item>
      </Line>
    </Lines>
    <Totals>
      <PriceExtensionTotalAmount>670</PriceExtensionTotalAmount>
      <NetTotalAmount>670</NetTotalAmount>
      <TaxTotalAmount>101</TaxTotalAmount>
      <PayableAmount>771</PayableAmount>
    </Totals>
  </Invoice>
  <Transmission>
    <IssueMode>1</IssueMode>
    <TransmitterTaxId CountryCode="CV">588064793</TransmitterTaxId>
    <Software>
      <Code>ICSCV</Code>
      <Name>ICS CV</Name>
      <Version>Odoo 10.0+e (Edição Empresarial)</Version>
    </Software>
  </Transmission>
  <RepositoryCode>2</RepositoryCode>
  <ds:Signature Id="EmitterPartySignatureId">
    <ds:SignedInfo>
      <ds:CanonicalizationMethod Algorithm="http://www.w3.org/TR/2001/REC-xml-c14n-20010315" />
      <ds:SignatureMethod Algorithm="http://www.w3.org/2001/04/xmldsig-more#rsa-sha256" />
      <ds:Reference Id="DataReferenceId" URI="#CV2211027266341047000040120210000111938531271">
        <ds:DigestMethod Algorithm="http://www.w3.org/2001/04/xmlenc#sha256" />
        <ds:DigestValue>LeezlRrg3Xtej4rk1juXSFJ8tXcG5qcBXxACNg8ZJd4=</ds:DigestValue>
      </ds:Reference>
      <ds:Reference URI="#SignedPropertiesId" Type="http://uri.etsi.org/01903#SignedProperties">
        <ds:Transforms>
          <ds:Transform Algorithm="http://www.w3.org/TR/2001/REC-xml-c14n-20010315" />
        </ds:Transforms>
        <ds:DigestMethod Algorithm="http://www.w3.org/2001/04/xmlenc#sha256" />
        <ds:DigestValue>UAj6hXl1actMqt+Zoh/6T8ujCXJekcrOO+PcqUkePmA=</ds:DigestValue>
      </ds:Reference>
    </ds:SignedInfo>
    <ds:SignatureValue>
      Z8K7b6gnXflRh5C9YiD5oZij+yUr1TDOGemifBAm9kK6ULyJGZpXwU6FhA4qcNGH UhJ0EQwkCbXe1axy17NBuA49rejKwWL3bkhwHNuhGPmTXU7a9ZYtOkrzZzMbzFwq nB+IctdJFkldzTA4AVSLkNU2T5V15NrZhdCMSO+y20s+yfyITlkvGBUephMFpsVW Yg2LYMUEd4LIPNIE/CanUJuXZbHfxzrjGXFY6/OSEjjoMdw9cC0ENjnvxxLGyrSS
      qwH4mp+SW8KtBnhU4OPa61AXqA+Lhshcj2u92U7fyLE+XsWntgyGAnwyyzFaI3mZ NQTxJUqnqjvPiPieYJY348k0fmxsp0WjLCaN5Rx7JG3h05hYrquQS0nHdb+UMHuh W8LiZiA40XKTvbXpXS4//9TrWRBGXyd/jKMM3wQXtXt4YmJ7nxGO3GNAiAD0cu8j 5MfUwAZVEPlJftZn7gNXALMRyjoGIci93y8WRDkN3MM6xIdq1NWF6WxTWNNFOgCo
      8mKd46Xftm0E1gP4ch2FeDeqJm6wZIsXgDWKOn9OyXMszHL1p7bgwi44EI+2UCNu SKii7t6Pc1XUmp8UpuaKoJS4snszymXnGLCcSmFfa7L7ctFmcyzSjArhBIgfn3xB eJZm1SdmuMS/hTlAFLpABfCi14bc+ea0tiIFU7YY5nI=
    </ds:SignatureValue>
    <ds:KeyInfo>
      <ds:X509Data>
        <ds:X509Certificate>
          MIIHGjCCBQKgAwIBAgIIZH8+yrKsSUUwDQYJKoZIhvcNAQELBQAwFjEUMBIGA1UE AwwLVGVzdGVTaXNwQ0EwHhcNMjEwODI3MTcwNjI2WhcNMjMwODI3MTcwNjI2WjCB 6DEeMBwGCSqGSIb3DQEJARYPY2VvQGJtcGdyb3VwLmN2MR0wGwYDVQQDDBRCTVAg SW1wb3J0YcOnw6NvIExkYTEaMBgGA1UECwwRRmF0dXJhIEVsZXRyb25pY2ExFTAT
          BgNVBGEMDENWLTI2NjM0MTA0NzFnMGUGA1UECgxeQm1wIEltcG9ydGHDp8OjbyBD b21lcmNpYWxpemHDp8OjbyBFIFByb2R1w6fDo28gRGUgUHJvZHV0b3MgUXXDrW1p Y29zIFNvY2llZGFkZSBVbmlwZXNzb2FsIExkYTELMAkGA1UEBhMCQ1YwggIiMA0G CSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQCXY95Bq2ZiD8wbFZ9nf75zB0e9XVg5
          J0MTC8xbYioEBRcQVCCJ981iGritOS3zt5O9oA/qlJKDJbmzWeGBVB9/XgYsaRKI avRAn8mrxlSyns0SoZmEL4eRlaLvBwc3tfohbqbWoINDKk5UgmUE5+J/XIqaiMY9 OeKN1q0YrRmnxG34rhcMKfsInrySjWtDPebkvoQDhODZCHX1BpidfdEocLYfFCwX cE1+2Y+Yh2tLsRGs0eQwp4e5wevVDuiKfABkKn1ba7YS4MYk9btOK42M0mxcUy8h
          qB2RX3BB2qYkOXoCouPvIv4akYKwi0tFqoC9BeG0eYxWHGqmxV9kLbwptif1luao 6biOxS7L7s5FUB2YMkbpOMnxpeU48JkUxyCgKgG0EuqBFPBEJHVObCMg/BKR5smP QMzpIDT+WNhpgUxgPkNwzejMmdVjvr/X///hTzLyXoRXJOHq8u+x5z+rTUyj6TYm WCU6nFdhhUZxBIA2ugyMm+LYWPVtCgHX+VyTk56ufOjGvUFgodhOXWzCnBZVjHLM
          9c/iYLJE1lPATZFbt+Gh2SoRZw0i2F/UKAp81Dxa94HE+3M0nWLJFG50vBkyD/fd JaukzHh6guLQCqphKAyXYaS6vi3HwwFTOttgZxm+mhVkucv8BXmtzuD4lgmt21Eh mtJX0y9pt9SB1QIDAQABo4IBlzCCAZMwLwYIKwYBBQUHAQEEIzAhMB8GCCsGAQUF BzABhhNodHRwOi8vb2NzcC5zaXNwLmN2MB0GA1UdDgQWBBRZdN3XX0rM58ONgAyv
          A8/wFrs8YzAMBgNVHRMBAf8EAjAAMB8GA1UdIwQYMBaAFC/0lETawp0ZTS8eSI00 87eDbnjUMDcGCCsGAQUFBwEDBCswKTAIBgYEAI5GAQEwCAYGBACORgEEMBMGBgQA jkYBBjAJBgcEAI5GAQYCMIGDBgNVHSAEfDB6MDsGCGCBBAECAgMCMC8wLQYIKwYB BQUHAgEWIWh0dHA6Ly9wa2kuc2lzcC5jdi9wb2wvaW5kZXguaHRtbDA7BghggQQB
          AwIDAjAvMC0GCCsGAQUFBwIBFiFodHRwOi8vcGtpLnNpc3AuY3YvcG9sL2luZGV4 Lmh0bWwwLgYDVR0fBCcwJTAjoCGgH4YdaHR0cDovL2NybC5zaXNwLmN2L3Npc3Bj YS5jcmwwDgYDVR0PAQH/BAQDAgVgMBMGA1UdJQQMMAoGCCsGAQUFBwMEMA0GCSqG SIb3DQEBCwUAA4ICAQB0IInKAhWqPLm9iflAx7MNbg4ipq2iGcD0f4mxPWE0WNN7
          Kz5d/43+M1H4SqgLndXGoRtPJRFjRgc8KPYYtRsfgON9LZeiiHQArrXwKy9X2NU+ AnOXYrmifwhHeiPoAyXBl4pg+use7gadMiIsov527LiKegw7r9tfIPFxxOh4Xy4B ih1O9wWLZib9RNP33CDdH6AvWe9y0BA7M6QMB/pluN3pdop9OTPPkZe229oJD8sX 720PPEJqdyGkAAN6XrL2zXPaSVOEJi395fYi4WFelgFftv4FQzvAvjoU+C3YigvW
          3y9ttELmKCYq9lV2V9BENa7uh2hrbvbrqQEy4j22fiWP+mzMoo4gjLwzvADJZd+n 0dmw5IT9V7MIOcZifiTKA0GByyq05Wy/6UAMc+BFLX1JQbOojc3Tbx3BFbO0FYsT duAgtMaFFj4/+7J6c8eTB3PmJOGiJqv6M68xJHWmUmar2XBeJSzO9eJTVNQJn5v6 XDWHN/zq+VPfWpCZVpD9D5QU375Wgh9mxGuVLKQBxAPvCUW1GQMr33dPRd7VQp+Q
          HbougQbD5uiV0RYiqkWQNzYFImHhZcBiSPeDFZbMAxRmGdJ0o504l8/x2B35ZX0B oAiNynopsjlFhTN0dXOsSr0o90OMLwVxlMUgNkSz+g7ivEb1yjdi1i5vqADZBw==
        </ds:X509Certificate>
      </ds:X509Data>
    </ds:KeyInfo>
    <ds:Object>
      <xades:QualifyingProperties Target="#EmitterPartySignatureId">
        <xades:SignedProperties Id="SignedPropertiesId">
          <xades:SignedSignatureProperties>
            <xades:SigningTime>2021-10-27T10:58:34+00:00</xades:SigningTime>
            <xades:SigningCertificate>
              <xades:Cert>
                <xades:CertDigest>
                  <ds:DigestMethod Algorithm="http://www.w3.org/2001/04/xmlenc#sha256" />
                  <ds:DigestValue>zRcxtyydUUFvAeuYsGtgMInR/NLQMVhLhX5yYOiO5DM=</ds:DigestValue>
                </xades:CertDigest>
                <xades:IssuerSerial>
                  <ds:X509IssuerName>CN=TesteSispCA</ds:X509IssuerName>
                  <ds:X509SerialNumber>7241575766136998213</ds:X509SerialNumber>
                </xades:IssuerSerial>
              </xades:Cert>
            </xades:SigningCertificate>
            <xades:SignaturePolicyIdentifier>
              <xades:SignaturePolicyImplied/>
            </xades:SignaturePolicyIdentifier>
            <xades:SignatureProductionPlace>
              <xades:City>Praia</xades:City>
              <xades:StateOrProvince>Santiago</xades:StateOrProvince>
              <xades:PostalCode>7952</xades:PostalCode>
              <xades:CountryName>Cabo Verde</xades:CountryName>
            </xades:SignatureProductionPlace>
          </xades:SignedSignatureProperties>
          <xades:SignedDataObjectProperties>
            <xades:DataObjectFormat ObjectReference="#DataReferenceId">
              <xades:MimeType>text/xml</xades:MimeType>
            </xades:DataObjectFormat>
          </xades:SignedDataObjectProperties>
        </xades:SignedProperties>
      </xades:QualifyingProperties>
    </ds:Object>
  </ds:Signature>
</Dfe>

目前,我在验证步骤中收到的错误消息是:

    Traceback (most recent call last):
  File "/home/stef/.eclipse/360744286_linux_gtk_x86_64/plugins/org.python.pydev.core_8.3.0.202104101217/pysrc/_pydevd_bundle/pydevd_exec.py", line 3, in Exec
    exec exp in global_vars, local_vars
  File "<console>", line 1, in <module>
  File "/usr/local/lib/python2.7/dist-packages/xades/xades_context.py", line 91, in verify
    res = super(XAdESContext, self).verify(node)
  File "/usr/local/lib/python2.7/dist-packages/xmlsig/signature_context.py", line 170, in verify
    'Reference with URI:"' + reference.get("URI", "") + '" failed'
Exception: Reference with URI:"#CV2211027266341047000040120210000152157718025"     failed

我不完全确定出了什么问题,因为该文件似乎与我作为示例给出的文件相似,但策略部分除外,因为在 Python2 中,XAdes 库使用 SHA1 作为摘要证书和示例文件使用 SHA256。

这是示例文件:

<Dfe Version="1.0" Id="CV1200520123456789000112345678901112345678904" DocumentTypeCode="1" xsi:schemaLocation="urn:cv:efatura:xsd:v1.0 EnvelopedSignature.xsd">
  <Invoice>
    <!-- Identificação do DFE -->
    <LedCode>1</LedCode>
    <Serie>A2020</Serie>
    <DocumentNumber>1234567</DocumentNumber>
    <!--

            DE     = Data de Emissão.
            DT     = Data de Transmissão para a DNRE.
            TR     = Tempo de Resposta.
            TT_MAX = Tempo de Transmissão Máximo. TT_MAX = 1 minuto.
            TR_MAX = Tempo de Resposta Máximo. TR_MAX = 5 segundos.
            
            TR        > TT_MAX => Contingência
            (DT - DE) > TT_MAX => Contingência
        
-->
    <IssueDate>2020-11-06</IssueDate>
    <IssueTime>11:01:02</IssueTime>
    <DueDate>2020-11-30</DueDate>
    <OrderReference>
      <Id>12345</Id>
    </OrderReference>
    <TaxPointDate>2020-01-01</TaxPointDate>
    <!--
 Incluir campo para indicar o user do sistema do contribunite 
-->
    <!--

        TransportIndicator
        InvoiceTypeCode
        LineCountNumeric
        InvoicePeriod
        
        DespatchDocumentReference
        ContractDocumentReference
        ProjectReference
        
        PrepaidPayment
        PayeeParty
        TaxRepresentativeParty
        
-->
    <!-- Emissor (AccountingSupplierParty) -->
    <EmitterParty>
      <TaxId CountryCode="CV">123456789</TaxId>
      <Name>Nome do Emissor</Name>
      <Address CountryCode="CV">
<AddressDetail>Ao lado da padaria</AddressDetail>
<AddressCode>CV774741741037410321</AddressCode>
</Address>
      <Contacts>
        <Telephone>1234567</Telephone>
        <Mobilephone>9123456</Mobilephone>
        <Telefax>3123456</Telefax>
        <Email>email@empresa.cv</Email>
        <Website>https://www.empresa.cv/a/b/c?a=b#abc</Website>
      </Contacts>
    </EmitterParty>
    <!-- Recetor/Destinatário (AccountingCustomerParty) -->
    <ReceiverParty>
      <TaxId CountryCode="BR">123456789</TaxId>
      <Name>Nome do Destinatário</Name>
      <Address CountryCode="CV">
<AddressDetail>Perto da farmcia universal</AddressDetail>
<AddressCode>CV774741741037410321</AddressCode>
</Address>
      <Contacts>
        <Telephone>1234567</Telephone>
        <Mobilephone>9123456</Mobilephone>
        <Telefax>3123456</Telefax>
        <Email>email@empresa.cv</Email>
        <Website>www.exemplo.cv</Website>
      </Contacts>
    </ReceiverParty>
    <!--
 Criar estrutura do fornecedor para DGA (SellerSupplierParty) 
-->
    <!-- Produtos/Serviços -->
    <Lines>
      <!-- Linha de tipo normal -->
      <Line LineTypeCode="N">
        <Id>1</Id>
        <Quantity UnitCode="EA" IsStandardUnitCode="true">1.12345</Quantity>
        <Price>30000</Price>
        <PriceExtension>30000</PriceExtension>
        <Discount ValueType="A">100</Discount>
        <NetTotal>30000</NetTotal>
        <Tax TaxTypeCode="NA">
          <TaxExemptionReasonCode>1</TaxExemptionReasonCode>
        </Tax>
        <!-- TaxPointDate -->
        <Item>
          <Description>Produto 1</Description>
          <EmitterIdentification>P1</EmitterIdentification>
          <HazardousRiskIndicator>false</HazardousRiskIndicator>
          <ExtraProperties>
            <Property Name="Cor">Preto</Property>
            <Property Name="Peso">12</Property>
          </ExtraProperties>
        </Item>
      </Line>
      <!-- Linha de tipo encargo -->
      <Line LineTypeCode="C">
        <Id>2</Id>
        <LineReferenceId>1</LineReferenceId>
        <Quantity UnitCode="EA">1</Quantity>
        <Price>150</Price>
        <PriceExtension>150</PriceExtension>
        <NetTotal>150</NetTotal>
        <Tax TaxTypeCode="IS">
          <StampTaxCode>2</StampTaxCode>
          <TaxPercentage>3.5</TaxPercentage>
        </Tax>
        <Item>
          <Description>Juros Mensal</Description>
          <EmitterIdentification>JM</EmitterIdentification>
        </Item>
      </Line>
    </Lines>
    <!-- Totais -->
    <Totals>
      <PriceExtensionTotalAmount>1000</PriceExtensionTotalAmount>
      <ChargeTotalAmount>0</ChargeTotalAmount>
      <DiscountTotalAmount>180</DiscountTotalAmount>
      <NetTotalAmount>3000</NetTotalAmount>
      <Discount>10</Discount>
      <TaxTotalAmount>450</TaxTotalAmount>
      <PayableRoundingAmount>-10</PayableRoundingAmount>
      <!-- GrossTotal no SAFT -->
      <PayableAmount>5000</PayableAmount>
      <PayableAlternativeAmount CurrencyCode="USD" ExchangeRate="93.15">53.67</PayableAlternativeAmount>
      <PayableAlternativeAmount CurrencyCode="EUR" ExchangeRate="110">29.65</PayableAlternativeAmount>
    </Totals>
    <!-- Meio de Pagamento -->
    <Payments>
      <PaymentDueDate>2020-11-30</PaymentDueDate>
      <PaymentTerms>
        <Note>Juros de 10% a partir da data de vencimento</Note>
      </PaymentTerms>
      <PayeeFinancialAccount>
        <NIB>123456789012345678901</NIB>
        <Name>Opção de conta de pagamento 1</Name>
      </PayeeFinancialAccount>
      <PayeeFinancialAccount>
        <NIB>123456789012345678902</NIB>
        <Name>Opção de conta de pagamento 2</Name>
      </PayeeFinancialAccount>
    </Payments>
    <!-- Entrega -->
    <Delivery>
      <DeliveryDate>2020-01-05</DeliveryDate>
      <Address CountryCode="CV">
<City>Praia</City>
<Region>Região</Region>
<Street>Rua XPTO</Street>
<StreetDetail>Ao lado Bar X</StreetDetail>
<BuildingNumber>12345</BuildingNumber>
<PostalCode>12345</PostalCode>
<AddressDetail>Ao lado da padaria</AddressDetail>
<AddressCode>CV774741741037410321</AddressCode>
</Address>
    </Delivery>
    <Note>Notas/Observações opcionais</Note>
    <!-- Campos Extras -->
    <ExtraFields>
      <QualquerCampo QualquerAtributo="Qualquer Valor"> Campo com quarquer estrutura </QualquerCampo>
      <Segredo>Valor encriptado...</Segredo>
    </ExtraFields>
  </Invoice>
  <Transmission>
  </Transmission>
  <RepositoryCode>1</RepositoryCode>
  <ds:Signature Id="EmitterPartySignatureId">
    <ds:SignedInfo>
      <ds:CanonicalizationMethod Algorithm="http://www.w3.org/TR/2001/REC-xml-c14n-20010315" />
      <ds:SignatureMethod Algorithm="http://www.w3.org/2001/04/xmldsig-more#rsa-sha256" />
      <ds:Reference Id="DataReferenceId" URI="#CV1200520123456789000112345678901112345678904">
        <ds:DigestMethod Algorithm="http://www.w3.org/2001/04/xmlenc#sha256" />
        <ds:DigestValue>ozcoAydr6KqHP+OtogQTxJIByzCzzWm8gNAOkpwBLMs=</ds:DigestValue>
      </ds:Reference>
      <ds:Reference URI="#SignedPropertiesId" Type="http://uri.etsi.org/01903#SignedProperties">
        <ds:Transforms>
          <ds:Transform Algorithm="http://www.w3.org/TR/2001/REC-xml-c14n-20010315" />
        </ds:Transforms>
        <ds:DigestMethod Algorithm="http://www.w3.org/2001/04/xmlenc#sha256" />
        <ds:DigestValue>xtFg15YLHtpf7KIhN0naU80wzSr99+17PXcVobbqEjc=</ds:DigestValue>
      </ds:Reference>
    </ds:SignedInfo>
    <ds:SignatureValue>U2lnbmF0dXJlVmFsdWU=</ds:SignatureValue>
    <ds:KeyInfo>
      <ds:X509Data>
        <ds:X509Certificate>WDUwOUNlcnRpZmljYXRl</ds:X509Certificate>
      </ds:X509Data>
    </ds:KeyInfo>
    <ds:Object>
      <xades:QualifyingProperties Target="#EmitterPartySignatureId">
        <xades:SignedProperties Id="SignedPropertiesId">
          <xades:SignedSignatureProperties>
            <xades:SigningTime>2020-11-06T11:01:02</xades:SigningTime>
            <xades:SigningCertificate>
              <xades:Cert>
                <xades:CertDigest>
                  <ds:DigestMethod Algorithm="http://www.w3.org/2001/04/xmlenc#sha256" />
                  <ds:DigestValue>RGlnZXN0VmFsdWU=</ds:DigestValue>
                </xades:CertDigest>
                <xades:IssuerSerial>
                  <ds:X509IssuerName>Emitter Party Name</ds:X509IssuerName>
                  <ds:X509SerialNumber>1234567890</ds:X509SerialNumber>
                </xades:IssuerSerial>
              </xades:Cert>
            </xades:SigningCertificate>
            <xades:SignatureProductionPlace>
              <xades:City>Praia</xades:City>
              <xades:StateOrProvince>Santiago</xades:StateOrProvince>
              <xades:PostalCode>7600</xades:PostalCode>
              <xades:CountryName>Cabo Verde</xades:CountryName>
            </xades:SignatureProductionPlace>
          </xades:SignedSignatureProperties>
          <xades:SignedDataObjectProperties>
            <xades:DataObjectFormat ObjectReference="#DataReferenceId">
              <xades:MimeType>text/xml</xades:MimeType>
            </xades:DataObjectFormat>
          </xades:SignedDataObjectProperties>
        </xades:SignedProperties>
      </xades:QualifyingProperties>
    </ds:Object>
  </ds:Signature>
</Dfe>

我想知道是否 1:有一个 python2 库负责 XAdes 签名和 2:我在这里做错了什么

4

0 回答 0