Here you con find the code to sign a XML file using MS Capicom
https://github.com/JoseQuintas/sefazcla ... assina.prg
Regards
firmar XML
Moderator: Rathinagiri
Re: firmar XML
M., Ronaldo
By: IMATECH
Imation Tecnologia
By: IMATECH
Imation Tecnologia
- edufloriv
- Posts: 238
- Joined: Thu Nov 08, 2012 3:42 am
- DBs Used: DBF, MariaDB, MySQL, MSSQL, MariaDB
- Location: PERU
Re: firmar XML
Hola IMATECH,
Puse a prueba el código que gentilmente me pasaste, desafortunadamente se queda en la siguiente línea:
Parece que el problema es una incompatibilidad con Win-10
http://pctoledo.com.br/forum/viewtopic ... &start=15
¿ Hay forma de resolverlo ? - Mil gracias por su valioso tiempo.
-------------------------------------------------------------------------------------------------------------------------------------
Hi IMATECH,
I tested the code you graciously passed me, unfortunately it stays on the following line:
It seems that the problem is an incompatibility with Win-10
http://pctoledo.com.br/forum/viewtopic ... &start=15
Is there a way to solve it? - Thank you for your valuable time.
Puse a prueba el código que gentilmente me pasaste, desafortunadamente se queda en la siguiente línea:
Code: Select all
BEGIN SEQUENCE WITH __BreakBlock()
cRetorno := "Erro Assinatura: Não carregado MSXML2.MXDigitalSignature.5.0" //<--- ME LANZA ESTE ERROR
#ifdef __XHARBOUR__
xmldsig := xhb_CreateObject( "MSXML2.MXDigitalSignature.5.0" )
#else
xmldsig := win_OleCreateObject( "MSXML2.MXDigitalSignature.5.0" )
#endif
http://pctoledo.com.br/forum/viewtopic ... &start=15
¿ Hay forma de resolverlo ? - Mil gracias por su valioso tiempo.
-------------------------------------------------------------------------------------------------------------------------------------
Hi IMATECH,
I tested the code you graciously passed me, unfortunately it stays on the following line:
Code: Select all
BEGIN SEQUENCE WITH __BreakBlock()
cRetorno := "Erro Assinatura: Não carregado MSXML2.MXDigitalSignature.5.0" //<--- THROW ME THIS ERROR
#ifdef __XHARBOUR__
xmldsig := xhb_CreateObject( "MSXML2.MXDigitalSignature.5.0" )
#else
xmldsig := win_OleCreateObject( "MSXML2.MXDigitalSignature.5.0" )
#endif
http://pctoledo.com.br/forum/viewtopic ... &start=15
Is there a way to solve it? - Thank you for your valuable time.
Eduardo Flores Rivas
LIMA - PERU
Re: firmar XML
HI Eduardo !
Looks you don't have "Microsoft XML Core Services 5.0" in your machine (it's part of MS Office 2003)
Are you using "File based Key" or "USB Token" ?
*The sign process can use Open SSL or WinCrypt (no MS Office needed)
Looks you don't have "Microsoft XML Core Services 5.0" in your machine (it's part of MS Office 2003)
Are you using "File based Key" or "USB Token" ?
*The sign process can use Open SSL or WinCrypt (no MS Office needed)
MSXML 5.0 MSXML5 is a binary developed specifically for Microsoft Office. It originally shipped with Office 2003 and also ships with Office 2007. Microsoft has not released documentation for this version because Microsoft considers MSXML 5 an internal/integrated component of Office 2003. MSXML 5 is not included in Office 2010.
M., Ronaldo
By: IMATECH
Imation Tecnologia
By: IMATECH
Imation Tecnologia
- edufloriv
- Posts: 238
- Joined: Thu Nov 08, 2012 3:42 am
- DBs Used: DBF, MariaDB, MySQL, MSSQL, MariaDB
- Location: PERU
Re: firmar XML
Hi Imatech,
I am using file based key, I have got : .CRT, .KEY, .PEM and .PFX files, I have tried with all these formats without result.
I have OpenSSL instaled on my computer. I must sign all the .XML file and these must be the result:
XML before sign:
XML after sign:
I would apreciate your help.
Best regards.
I am using file based key, I have got : .CRT, .KEY, .PEM and .PFX files, I have tried with all these formats without result.
I have OpenSSL instaled on my computer. I must sign all the .XML file and these must be the result:
XML before sign:
Code: Select all
<ext:UBLExtensions>
<ext:UBLExtension>
<ext:ExtensionContent></ext:ExtensionContent>
</ext:UBLExtension>
</ext:UBLExtensions>
Code: Select all
<ext:UBLExtensions>
<ext:UBLExtension>
<ext:ExtensionContent>
<ds:Signature Id="SignIMM">
<ds:SignedInfo>
<ds:CanonicalizationMethod Algorithm="http://www.w3.org/TR/2001/REC-xml-c14n-20010315"/>
<ds:SignatureMethod Algorithm="http://www.w3.org/2000/09/xmldsig#rsa-sha1"/>
<ds:Reference URI="">
<ds:Transforms>
<ds:Transform Algorithm="http://www.w3.org/2000/09/xmldsig#enveloped-signature"/>
</ds:Transforms>
<ds:DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1"/>
<ds:DigestValue>IwJuNQGQaHmmm3iv2jj8JDv70Ow=</ds:DigestValue>
</ds:Reference>
</ds:SignedInfo>
<ds:SignatureValue>
nLaghokzMNrmrfPnbIg9b........wzZ2CgLTVjWQUAQ4wDAYDVQQIEwVNYWluZTE1UiLFwZXXXPUlf2o=
</ds:SignatureValue>
<ds:KeyInfo>
<ds:X509Data>
<ds:X509Certificate>
MIIFhzCCA3OgAwI......MIIEVDCCAzygAwIBAgIJAPTrkMJbCOr1MA0GCSqGSIb3DQEBBQUAMHkxCzAJBgNVBAYTAlVTVQQIEwVNYWluZTEgMOiRJ00nE=
</ds:X509Certificate>
</ds:X509Data>
</ds:KeyInfo>
</ds:Signature>
</ext:ExtensionContent>
</ext:UBLExtension>
</ext:UBLExtensions>
Best regards.
Eduardo Flores Rivas
LIMA - PERU
Re: firmar XML
HI Eduardo !
Can you install it and make the test again ?Looks you don't have "Microsoft XML Core Services 5.0" in your machine (it's part of MS Office 2003)
To save XML signed, file test.prg, line 341~1) ..\SefazClass\hbMk2 sefazclass
2)..\SefazClass\tests\hbMk2 Test -hbwin
3)..\SefazClass\tests\Test.exe
3.1) Option 2 - Seleciona certificado (Select Cert Key)
3.2) Option 18 - Assinatura, arquivo do usuário (Sing a XML)
3.2.1) Select a XML file then you will have a signed one (*changes needed below)
Code: Select all
CASE nOpc == OPC_ASSINA_USUARIO
oSefaz:cXmlDocumento := MemoRead( win_GetOpenFileName(, "Choose a XML file to sign", ".\", "XML", "*.XML", 1 ) )
oSefaz:AssinaXml()
hb_MemoWrit( "Respuesta.txt", oSefaz:cXmlRetorno )
hb_MemoWrit( "SignedFile.xml", oSefaz:cXmlDocumento )
Inkey(0)
- Attachments
-
- tests.7z
- sample files
- (2.55 KiB) Downloaded 203 times
M., Ronaldo
By: IMATECH
Imation Tecnologia
By: IMATECH
Imation Tecnologia