EldoS | Feel safer!

Software components for data protection, secure storage and transfer

TSPHTTPServer

Also by EldoS: CallbackFilter
A component to monitor and control disk activity, track file and directory operations (create, read, write, rename etc.), alter file data, encrypt files, create virtual files.
#1167
Posted: 09/11/2006 13:18:27
by Santiago Castaño (Standard support level)
Joined: 04/16/2006
Posts: 155

Hi!,

I was wondering how can i do a TSP server (like http://ns.szikszi.hu:8080/tsa). I want to make it on kylix using synapse, or indy or whatever...

I thought if it was possible using ElFileTSPServer but thought of asking you before if you have clues, or in SBB5.0 final will be a ElHTTPTSPServer or something like that (samples, ...).

By the way, does SBB compile using Kylix 1.0 Open Edition?

Many thanks
#1168
Posted: 09/11/2006 13:35:39
by Eugene Mayevski (EldoS Corp.)

You need to build a custom HTTP server and handle the requests using FileTSPServer.

There's no and will be no HTTP server component in SecureBlackbox.

I know nothing about Kylix 1, so I can't comment. I think you can use Mono on linux. This is more reasonable than using a tool which has been abandoned 5 years ago.


Sincerely yours
Eugene Mayevski
#1175
Posted: 09/11/2006 15:06:44
by Santiago Castaño (Standard support level)
Joined: 04/16/2006
Posts: 155

Hi!,

I've made my server (by the moment on delphi with synapse). But i don't know what headers i have to set.

I put here a little bit of code:
Code
  OutputData.Clear;
  ResultCode := ProcessHttpRequest(method, uri);
  sock.SendString('HTTP/1.0 ' + IntTostr(ResultCode) + CRLF);
  if protocol <> '' then
  begin
    headers.Add('Content-length: ' + IntTostr(OutputData.Size));
    headers.Add('Connection: close');
    headers.Add('Date: ' + Rfc822DateTime(now));
    headers.Add('Server: Synapse HTTP server demo');
    headers.Add('');
    for n := 0 to headers.count - 1 do
      sock.sendstring(headers[n] + CRLF);
  end;
  if sock.lasterror <> 0 then
    Exit;
  Sock.SendBuffer(OutputData.Memory, OutputData.Size);


ProcessHttpRequest is this:
Code
  else if Request= 'POST' then
  begin
    headers.Clear;
    Fallo:=True;Resultado:=False;
    ElFileTSPServer:=TElFileTSPServer.Create(nil);
    try
      ElFileTSPServerCertificados:=TElMemoryCertStorage.Create(nil);
      try
        ElFileTSPServer.Certificates:=ElFileTSPServerCertificados;

        Certificado_TSP_file:=TFileStream.Create('c:\certificado.pfx',fmOpenRead);
        try
          ElFileTSPServerCertificados.LoadFromStreamPFX(Certificado_TSP_file,'******');
        finally
          Certificado_TSP_file.Free;
        end;
        if ElFileTSPServer.Certificates.Count>0 then
        begin
          InputData.Position:=0;
          Resultado_Carga:=ElFileTSPServer.LoadRequestFromStream(InputData);
          if Resultado_Carga=0 then
          begin

            ElFileTSPServer.TSPInfo.Time:=Now;
            ElFileTSPServer.TSPInfo.TSAName.RFC822Name:='Santi';

            Resultado:=ElFileTSPServer.SaveReplyToStream(Resultado_Servidor,Resultado_Fallo,OutputData);
          end
          else Fallo:=True;
        end;

        if Resultado then
        begin
          Fallo:=False;
          Result:=200;
        end;
      finally
        ElFileTSPServerCertificados.Free;
      end;
    finally
      ElFileTSPServer.Free;
    end;


(only a little test code, i'm working on it).So... i'll explain a little... On InputData i have the data from the client TSP, and i'm returning it on OutputData. ElFileTSPServer returns TRUE. But the client application returns: SB_TSP_ERROR_WRONG_DATA 83973 (0x14805) invalid response data .

I suppose that it's maybe a header's problem. What do i have to set?

Thanks
#1176
Posted: 09/11/2006 15:37:59
by Santiago Castaño (Standard support level)
Joined: 04/16/2006
Posts: 155

Oh, forget the previous post, i found it debuggin the code...

I have also to set:
headers.Add('Content-type: ' + 'application/timestamp-reply');

Now everything is perfect except this:

ElFileTSPServer.TSPInfo.Time:=Now;
ElFileTSPServer.TSPInfo.TSAName.RFC822Name:='Santi';
ElFileTSPServer.TSPInfo.TSANameSet:=True;

In the client side, i can't receive the RFC822Name, but i'll investigate this deeply...

Thank you anyway for a great support (once again)
#1177
Posted: 09/11/2006 15:52:52
by Santiago Castaño (Standard support level)
Joined: 04/16/2006
Posts: 155

Hi again (I hope not to bore you).

I found that if i set TSANameSet on the server, on the client side, it's always False, although i see the RFC822Name (but i was checking before this if TSANameSet was true, because of that i didn't saw what i was putting on the server side).

Is this a bug? and if not... why is this?

P.S.: at SbTSPServer.pas, line if Assigned(TElServerTSPInfo(FTSPInfo).TSAName) and FTSPInfo.TSANameSet then
it goes into that if. So everything seems to be just fine; i'll leave it till tomorow
#1178
Posted: 09/11/2006 16:04:59
by Eugene Mayevski (EldoS Corp.)

try putting a server-side logic and client-side logic to separate classes and then use both classes locally (without involving HTTP). When you have a simple project, see if it works. If it doesn't, you can try SecureBlackbox 5 beta (there were some fixes made to TSP there), and if no, post the sample to HelpDesk.


Sincerely yours
Eugene Mayevski
Also by EldoS: Callback File System
Create virtual file systems and disks, expose and manage remote data as if they were files on the local disk.

Reply

Statistics

Topic viewed 3317 times

Number of guests: 1, registered members: 0, in total hidden: 0




|

Back to top

As of July 15, 2016 EldoS Corporation will operate as a division of /n software inc. For more information, please read the announcement.

Got it!