Buenos dias, foreros.
Despues de casi 7 años sin apenas tocar Delphi, vuelvo necesitar de vuestra ayuda con el dichoso Ticket BAI.
Muchas gracias a
elcharie por su código sobre la firma digital
https://www.clubdelphi.com/foros/sho...ent#post534661
me ha sido de gran ayuda pues tambien uso los componentes SecureBlackBox para firmar con FacturaE.
Mi duda es sobre el encadenamiento de las facturas, en un ejemplo he visto esto:
Código:
<EncadenamientoFacturaAnterior>
<SerieFacturaAnterior>B2022</SerieFacturaAnterior>
<NumFacturaAnterior>0100</NumFacturaAnterior>
<FechaExpedicionFacturaAnterior>30-01-2022</FechaExpedicionFacturaAnterior>
<SignatureValueFirmaFacturaAnterior>DSI1XA1ErCoqaEln++216eTQpN0qF7HQb/I3QhF54V11LEGY3ucMVH33GceRE9LtYJI7AoI0YS3q0qPOn+eTlH6ZHVXXkcVZyi2g</SignatureValueFirmaFacturaAnterior>
</EncadenamientoFacturaAnterior>
Mi duda es qué valor debo grabar en el tag SignatureValueFirmaFacturaAnterior.
Suponiendo una firma digital del xml que acabo de grabar,
Código:
<ds:Signature Id="Signature-221b390d-079e-45d2-a152-70726a44665f-Signature" xmlns:ds="http://www.w3.org/2000/09/xmldsig#">
<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="Reference-1e93a4c4-c54d-4704-aef6-815f9afa0490" Type="http://www.w3.org/2000/09/xmldsig#Object" URI="">
<ds:Transforms>
<ds:Transform Algorithm="http://www.w3.org/TR/2001/REC-xml-c14n-20010315"/>
<ds:Transform Algorithm="http://www.w3.org/2000/09/xmldsig#enveloped-signature"/>
<ds:Transform Algorithm="http://www.w3.org/TR/1999/REC-xpath-19991116">
<ds:XPath xmlns:ds="http://www.w3.org/2000/09/xmldsig#">not(ancestor-or-self::ds:Signature)</ds:XPath>
</ds:Transform>
</ds:Transforms>
<ds:DigestMethod Algorithm="http://www.w3.org/2001/04/xmlenc#sha512"/>
<ds:DigestValue>Lj/xC1Vm48GUnqm6mQVSdMWDSS7h6EpTnG/m3TWADSI+vKoehKH2u/KSKOZc6fqZ+mT4pqyxCVAwwIlISPhAGw==</ds:DigestValue>
</ds:Reference>
<ds:Reference Type="http://uri.etsi.org/01903#SignedProperties" URI="#Signature-221b390d-079e-45d2-a152-70726a44665f-SignedProperties">
<ds:DigestMethod Algorithm="http://www.w3.org/2001/04/xmlenc#sha512"/>
<ds:DigestValue>6ZLdg8WSZEcsodu/pVr6E76DL0+REsuOgrF+N1TR6xBG0QHOXFf6876kZOUBZFhZaQ+r7ncHaxRXBhZDo3aidQ==</ds:DigestValue>
</ds:Reference>
<ds:Reference URI="#Signature-221b390d-079e-45d2-a152-70726a44665f-KeyInfo">
<ds:DigestMethod Algorithm="http://www.w3.org/2001/04/xmlenc#sha512"/>
<ds:DigestValue>gkMC+2K2Q9SEhd7FbRe1oq3Rsb+FCe+UgKsvU2NJxuW3F5BVMgbKfM2B4jv9EULQfIZmOYU9sff5OxSyecL9/Q==</ds:DigestValue>
</ds:Reference>
</ds:SignedInfo>
<ds:SignatureValue Id="Signature-221b390d-079e-45d2-a152-70726a44665f-SignatureValue">JmGem1gIrDMgDBSwggrUx4wUa6OeIeYo+B11HZYYxfPlSkT1g8KOMipXQCBl4M79GF+ZfkZoaXrVFiVdXlqVg2lVtWIt8swT5/JwkemwKtNuSA0Z7J1xLIj8D9GjU1Lhc8FBly0ecYRoahsPyCKwH/b4sU29WCKgqsfaAn4HmM8KuSJ3786KKUZ5TfPyLdqyJebq4mszozxeIVcColch2tRoMxC5bWg7FctJ6CH54itfiUq3Uv2azi/AIzyMwCOCaDUftHlju9xYtIqMwb9UipOPGeovVUbe5InPItjOq+fvCXNBfMfgRcZkF6G5c3SHpBlW8fESN6zd8vVm6o1R/w==</ds:SignatureValue>
<ds:KeyInfo Id="Signature-221b390d-079e-45d2-a152-70726a44665f-KeyInfo">
¿cual seria el tag con el valor para el siguiente XML a firmar?
¿SignatureValue?
¿Alguno de los <DigestValue>?
Estoy un poco perdido...