Ver Mensaje Individual
  #11  
Antiguo 14-06-2024
Jesusggc Jesusggc is offline
Miembro
 
Registrado: may 2024
Posts: 45
Reputación: 0
Jesusggc Va por buen camino
Firma de RegistroFacturacionAlta con Autofirma

Buenas

Para el que le venga bien mi aportación.

1. Creacion de RegistroFacturacionAltaType
2. Escribir Clase RegistroFacturacionAltaType en disco XML
3. Firmar con autofirma(XADES Enveloped y Namespace=la del excel.
4. He pasado (Parse) el fichero firmado xsig de fichero fisico en disco a clase RegistroFacturacionAltaType y todo correcto. Por lo que la firma es correcta.

Codigo de Firma : (vb.net)

Código:
Public Shared Sub FirmarXmlXades(ByVal pFicheroXml As String, ByVal pAliasCertificado As String)

        Dim strFicheroXmlFirmado As String = pFicheroXml.Substring(0, pFicheroXml.Length - 4) & "_signed.xsig"

        Try

           
            Using p As New Process

                With p
                    .StartInfo.UseShellExecute = False
                    .StartInfo.FileName = "cmd.exe"
                    .StartInfo.CreateNoWindow = True
                    .StartInfo.Arguments = $"/c autofirmacommandline sign -i {pFicheroXml} -o " &
                    strFicheroXmlFirmado & " -store windows -alias """ & pAliasCertificado &
                    $""" -config " & """format=XAdES Enveloped\nxadesNamespace=:namespacedefinido en excel"""
                End With

                p.Start()
                p.WaitForExit()

            End Using


        Catch ex As Exception

            Throw

        End Try

    End Sub
PD. la Url de xadesNamespace la que aparece en el excel. Que aun el foro no me deja insertar imagenes o urls

Un saludo

Última edición por Casimiro Noteví fecha: 14-06-2024 a las 10:26:32.