DLL c# consumir em xharbour

DLL c# consumir em xharbour

Postby jair » Mon Dec 18, 2017 11:09 am

Esta función fue escrita en cSharp y, tiene el objetivo de firmar el xml con certificado digital tipo A3, mi idea y hacer la misma funcionalidad también para los certificados A1 y poder utilizar en el harbour y en el xharbour, la parte más difícil sería posibilitar la DLL se utiliza en cualquier lenguaje de programación y el DLL ya está con esta aplicación, ahora tengo un ejemplo de consumir es DLL en Delphi y me gustaría hacer esto también en xHarbour, cuento con el apoyo de los amigos.

Code: Select all  Expand view

    {$R *.dfm}
     
    uses StrUtils, Certfly;
     
    procedure TForm2.Button1Click(Sender: TObject);
    var
      Ret: Integer;
     
    function ExtraiURI(const AXML: String): String;
    var
      I, J: integer;
    begin
      Result := '';
      I := PosEx('Id=', AXML, 6);
      if I = 0 then
        I := PosEx('id=', AXML, 6);
      if I = 0 then       // XML não tem URI
        exit ;
     
      I := PosEx('"', AXML, I + 2);
      J := PosEx('"', AXML, I + 1);
     
      Result := copy(AXML, I + 1, J - I - 1);
    end;
     
    var
      URI: string;
      Xml: TStringList;
    begin
      Xml := TStringList.Create;
      try
        xml.LoadFromFile('C:\xml\R1000_N.xml');
        URI := ExtraiURI(xml.Text)
      finally
        Xml.Free
      end;
     
      * Faz a assinatura do xml
      Ret := TCertfly.Assinar('C:\xml\R1000_N.xml',   'C:\xml\R1000_ASS.xml',  'MinhaTag','0', '1ce63d4dcefb45e9', '1234');
     if Ret = 0 then
       ShowMessage('Sucesso')
     else
       ShowMessage('False');
    end;
     
    end.
jair
 
Posts: 26
Joined: Sun Aug 27, 2017 7:18 pm

Re: DLL c# consumir em xharbour

Postby hmpaquito » Mon Dec 18, 2017 11:30 am

hmpaquito
 
Posts: 1482
Joined: Thu Oct 30, 2008 2:37 pm

Re: DLL c# consumir em xharbour

Postby jair » Mon Dec 18, 2017 9:22 pm

Necesito convertir este codigo delphi a xharbour, alguien podría darme una fuerza.
jair
 
Posts: 26
Joined: Sun Aug 27, 2017 7:18 pm

Re: DLL c# consumir em xharbour

Postby Antonio Linares » Tue Dec 19, 2017 4:48 am

Necesitas el código fuente de TCertfly para poder portar ese código en Delphi

Este ejemplo puede servirte, sin necesidad de usar el código en Delphi:
viewtopic.php?f=3&t=35023
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 41286
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 15 guests