Hola,
Me llamo Freddy Mellaerts, soy Belga y vivo en Mexico.
Perdona me mi Español por favor, porque no es muy bueno.
Hice un applicación en VB.net para crear CFD's. Uso el chilkatdotnet2.dll.
Por un mes me podría validar todos los cfd's perfecto (valido al pagina SAT).
Desde este semana, todos sellos estan invalidos. Sin cambiar codigo o cfd's.
Hoy hici un pruebo con ValidaCFD, y todos sellos estan invalido.
Cambio el codigo usando el OpenSSL, pero me genero los mismos sellos.
Tambien estan invalidos.
Si uso .cer y .key de pruebas del sat, todo funciona perfecto,
pero usando los archivos de clientes, no funciona (y estan validas).
Quel puede ser el problema ? Ayuda urgente porfavor ).
Si algien puedo ayudarme, si necesitas mi codigo, me advisas.
Muchas gracias.

DESCARGA SOFTWARE PARA FACTURA ELECTRONICA DE AQUI.
Facturacion, Validacion, Addendas, Librerias de programacion, etc.
CARTA PORTE V3.1
ECODEX TIENE ESTOS NUEVOS DATOS DE CONTACTO :
Comercializacion y Ventas - Evelia Vicke evicke@ecodex.com.mx 33-16-03-03-48
Soporte - Humberto Guerrero soporte@ecodex.com.mx 33-34-90-46-03
.
Sello Invalido
- Dado
- Mensajes: 15981
- Registrado: Mar Jul 06, 2010 7:56 pm
Re: Sello Invalido
Asegurate de dos cosas :fmellaerts escribió:Hola,
Me llamo Freddy Mellaerts, soy Belga y vivo en Mexico.
Perdona me mi Español por favor, porque no es muy bueno.
Hice un applicación en VB.net para crear CFD's. Uso el chilkatdotnet2.dll.
Por un mes me podría validar todos los cfd's perfecto (valido al pagina SAT).
Desde este semana, todos sellos estan invalidos. Sin cambiar codigo o cfd's.
Hoy hici un pruebo con ValidaCFD, y todos sellos estan invalido.
Cambio el codigo usando el OpenSSL, pero me genero los mismos sellos.
Tambien estan invalidos.
Si uso .cer y .key de pruebas del sat, todo funciona perfecto,
pero usando los archivos de clientes, no funciona (y estan validas).
Quel puede ser el problema ? Ayuda urgente porfavor ).
Si algien puedo ayudarme, si necesitas mi codigo, me advisas.
Muchas gracias.
Que hayas cambiado el hash a SHA1, revisa el chilkat, es posible que necesites actualizarlo por ahi lei que liberaron la version 2 de esa libreria.
Sube aqui un archivo XML para revisarlo, por lo que comentas que "antes si validaba y ahora no" es casi seguro que sea el hash ya que hubo ese cambio importante.
Mmmh, segui leyendo tu mensaje, talvez tambien estes usando la FIEL en lugar del CSD (Certificado de Sello Digital), tambien eso es nuevo en los validadores.
Para poder ayudarte sube aqui un XML.
ADDENDAS? VALIDACION? CODIGO PARA PROGRAMAR TU PROPIA SOLUCION? TODO LO TENEMOS EN WWW.VALIDACFD.COM VISITANOS !!
-
- Mensajes: 6
- Registrado: Jue Feb 03, 2011 8:27 pm
Re: Sello Invalido
Gracias,
Mas tarde voy a subir un archivo xml.
Tienes razon, estoy usando los ertificados' FIEL, pero tan poco functione con un certificado de SELLO (soño tengo un).
Solo con los archivos de pruebas del SAT functiona.
Pero, como puedo saver qual certificado es FIEL o SELLO ?
Quando lo abro en hex, hay un codigo para determinar que typo de archivo es ?
Porque, quiero probar este verificaci'on del VB.net.
Gracias.
Mas tarde voy a subir un archivo xml.
Tienes razon, estoy usando los ertificados' FIEL, pero tan poco functione con un certificado de SELLO (soño tengo un).
Solo con los archivos de pruebas del SAT functiona.
Pero, como puedo saver qual certificado es FIEL o SELLO ?
Quando lo abro en hex, hay un codigo para determinar que typo de archivo es ?
Porque, quiero probar este verificaci'on del VB.net.
Gracias.
- Dado
- Mensajes: 15981
- Registrado: Mar Jul 06, 2010 7:56 pm
Re: Sello Invalido
Mmmmh, me entra mucha duda que comentas "con los del SAT si funciona", no sera que estas revolviendo los certificados y las llaves?fmellaerts escribió:Gracias,
Mas tarde voy a subir un archivo xml.
Tienes razon, estoy usando los ertificados' FIEL, pero tan poco functione con un certificado de SELLO (soño tengo un).
Solo con los archivos de pruebas del SAT functiona.
Pero, como puedo saver qual certificado es FIEL o SELLO ?
Quando lo abro en hex, hay un codigo para determinar que typo de archivo es ?
Porque, quiero probar este verificaci'on del VB.net.
Gracias.
Te recomiendo descargar el ValidaCFD, ese programa tiene una herramienta que determina si un certificado es FIEL o CSD y tambien te valida que el CER y el KEY sean "pareja" es decir que corresponda uno con otro.
*sin intencion de ofender al foro y con la intencion de ayudar a este forista, veamos si mi pesimo ingles puede ayudarnos........do you speak english?, I can try help you in english if that's better for you.
ADDENDAS? VALIDACION? CODIGO PARA PROGRAMAR TU PROPIA SOLUCION? TODO LO TENEMOS EN WWW.VALIDACFD.COM VISITANOS !!
-
- Mensajes: 6
- Registrado: Jue Feb 03, 2011 8:27 pm
Re: Sello Invalido
Thanks again,
Yes I speak English, and also it's easier for me.
As I said, using the test .cer and .key files from SAT, it's working perfect.
The Sat validation page tells me the seal is valid.
I also downloaded your ValidaCFD, and also this tells me the same, valid.
Here I have a few errors, telling me that the serial no of the certificate not is in the SAT list.
But this is normal I think. Isn't it ?
Here's my code to generate the sello, please tell me it's correct ?
Public Function crearSello(ByVal selloFile As String) As Boolean
Dim cer As New Chilkat.Cert
Dim privateKey As New Chilkat.PrivateKey
Dim rsa As New Chilkat.Rsa
Dim fileAccess As New Chilkat.FileAccess
Try
'cargar cer
If cer.LoadFromFile(cerFile) = False Then Throw New Exception(cer.LastErrorText)
'cargar key
If privateKey.LoadPkcs8EncryptedFile(keyFile, pwd) = False Then Throw New Exception(privateKey.LastErrorText)
'agregar llave privada al cer
If cer.SetPrivateKey(privateKey) = False Then Throw New Exception(cer.LastErrorText)
'crear rsa y ajuste el formato
If rsa.UnlockComponent("unlockCode") = False Then Throw New Exception(rsa.LastErrorText)
rsa.EncodingMode = "base64"
rsa.LittleEndian = 0
'importar llave privada (xml) en rsa
If rsa.ImportPrivateKey(privateKey.GetXml) = False Then Throw New Exception(rsa.LastErrorText)
'leer cadenaOriginal dentro byteArray
Dim cadenaOriginalBytes() As Byte = fileAccess.ReadEntireFile(cadenaOriginalFile)
'crear sello
comprobante.sello = rsa.SignBytesENC(cadenaOriginalBytes, "SHA-1")
'guardar sello
Dim includeBOM As Boolean = False
If fileAccess.WriteEntireTextFile(selloFile, comprobante.sello, "utf-8", includeBOM) = False Then Throw New Exception(fileAccess.LastErrorText)
Return True
Catch ex As Exception
errHandler(ex)
Return False
Finally
If cer IsNot Nothing Then cer.Dispose()
If privateKey IsNot Nothing Then privateKey.Dispose()
If fileAccess IsNot Nothing Then fileAccess.Dispose()
If rsa IsNot Nothing Then rsa.Dispose()
End Try
End Function
Thanks
Yes I speak English, and also it's easier for me.
As I said, using the test .cer and .key files from SAT, it's working perfect.
The Sat validation page tells me the seal is valid.
I also downloaded your ValidaCFD, and also this tells me the same, valid.
Here I have a few errors, telling me that the serial no of the certificate not is in the SAT list.
But this is normal I think. Isn't it ?
Here's my code to generate the sello, please tell me it's correct ?
Public Function crearSello(ByVal selloFile As String) As Boolean
Dim cer As New Chilkat.Cert
Dim privateKey As New Chilkat.PrivateKey
Dim rsa As New Chilkat.Rsa
Dim fileAccess As New Chilkat.FileAccess
Try
'cargar cer
If cer.LoadFromFile(cerFile) = False Then Throw New Exception(cer.LastErrorText)
'cargar key
If privateKey.LoadPkcs8EncryptedFile(keyFile, pwd) = False Then Throw New Exception(privateKey.LastErrorText)
'agregar llave privada al cer
If cer.SetPrivateKey(privateKey) = False Then Throw New Exception(cer.LastErrorText)
'crear rsa y ajuste el formato
If rsa.UnlockComponent("unlockCode") = False Then Throw New Exception(rsa.LastErrorText)
rsa.EncodingMode = "base64"
rsa.LittleEndian = 0
'importar llave privada (xml) en rsa
If rsa.ImportPrivateKey(privateKey.GetXml) = False Then Throw New Exception(rsa.LastErrorText)
'leer cadenaOriginal dentro byteArray
Dim cadenaOriginalBytes() As Byte = fileAccess.ReadEntireFile(cadenaOriginalFile)
'crear sello
comprobante.sello = rsa.SignBytesENC(cadenaOriginalBytes, "SHA-1")
'guardar sello
Dim includeBOM As Boolean = False
If fileAccess.WriteEntireTextFile(selloFile, comprobante.sello, "utf-8", includeBOM) = False Then Throw New Exception(fileAccess.LastErrorText)
Return True
Catch ex As Exception
errHandler(ex)
Return False
Finally
If cer IsNot Nothing Then cer.Dispose()
If privateKey IsNot Nothing Then privateKey.Dispose()
If fileAccess IsNot Nothing Then fileAccess.Dispose()
If rsa IsNot Nothing Then rsa.Dispose()
End Try
End Function
Thanks
- Dado
- Mensajes: 15981
- Registrado: Mar Jul 06, 2010 7:56 pm
Re: Sello Invalido
Not quite.fmellaerts escribió:Thanks again,
Yes I speak English, and also it's easier for me.
As I said, using the test .cer and .key files from SAT, it's working perfect.
The Sat validation page tells me the seal is valid.
I also downloaded your ValidaCFD, and also this tells me the same, valid.
Here I have a few errors, telling me that the serial no of the certificate not is in the SAT list.
But this is normal I think. Isn't it ?
Use of the FIEL certificate is completely wrong, that's why it's serial number will not validate, because it's not in the CSD list*
*Almost forget, it will also be marked as invalid if it's the TEST certificate, if that's what you are using then ignore the error and continue.
In the past SAT will accept documents signed with the FIEL certificate, that of course was a BIG mistake, but it was the OFFICIAL validator so no one can argue with that. Some weeks ago they updated their system, so do I, starting version "f" of my validator using the FIEL was tagged as a mistake.
Maybe that's the reason why "in the past they will validate, but not now"
RECOMENDATION : forget the FIEL, use ALWAYS the CSD (Digital Signature Certificate)
I'm so sorry I don't know VB, I program in Delphi.fmellaerts escribió:
Here's my code to generate the sello, please tell me it's correct ?
Even though it' very straightforward, it's seem nothing can go wrong, you are using SHA-1 as requested by the new legislation.
I can think of another mistake you are doing, maybe you are mixing one Certificate with a non-matching Key, I recommend that you download ValidaCFD application, it has a tool that identifies this files, make sure you are using a matching CER and KEY and that they are CSD
ADDENDAS? VALIDACION? CODIGO PARA PROGRAMAR TU PROPIA SOLUCION? TODO LO TENEMOS EN WWW.VALIDACFD.COM VISITANOS !!
-
- Mensajes: 6
- Registrado: Jue Feb 03, 2011 8:27 pm
Re: Sello Invalido
Thanks,
And you are right ! (see attached image).
Using these files, the cfd will not be validated.
But those are the only ones I have from my customer.
What do I do ? Request new files from SAT ?
CU
And you are right ! (see attached image).
Using these files, the cfd will not be validated.
But those are the only ones I have from my customer.
What do I do ? Request new files from SAT ?
CU
- Adjuntos
-
- test.jpg (176.78 KiB) Visto 10521 veces
- Dado
- Mensajes: 15981
- Registrado: Mar Jul 06, 2010 7:56 pm
Re: Sello Invalido
Told ya!fmellaerts escribió:Thanks,
And you are right ! (see attached image).
Using these files, the cfd will not be validated.
But those are the only ones I have from my customer.
What do I do ? Request new files from SAT ?
CU
Well, if you have search even under your pillow and not found the correct key file then, yes, you have to ask for another CER and KEY pair.
Asking for another key is free and can be done from your office so it's not big deal.
ADDENDAS? VALIDACION? CODIGO PARA PROGRAMAR TU PROPIA SOLUCION? TODO LO TENEMOS EN WWW.VALIDACFD.COM VISITANOS !!