Recent

Author Topic: lNet (n.-v.) active Connection, unencr. to SSL (TLS1.0)  (Read 2052 times)

mark332

  • Newbie
  • Posts: 3
lNet (n.-v.) active Connection, unencr. to SSL (TLS1.0)
« on: February 01, 2015, 10:51:16 am »
Hello,

I'm working on a server application, which needs to upgrade an existing (unencrypted) connection
to TLS1.0-encrypted.

I also would like to have one unique password for each encrypted connection.

Sadly, I'm doing something wrong (of course  :-[ )

I'm getting SIGSEGV, when I try to activate "SSLActive"

This is about, what I tried so far:
Code: [Select]
procedure THWServer.Elevate(aSock: TLSocket; PassWd: String);
var
  lSess: TLSSLSession;
  lrespObj: TJSONObject;
  lArr: TJSONArray;
begin
  try
    WriteLn(aSock.Session.ClassName); // "TLSSLSession"
    WriteLn(TLSSLSession(aSock.Session).CAFile); "settings/cert"
    WriteLn(TLSSLSession(aSock.Session).KeyFile); "settings/pkey"
 
    lrespObj := TJSONObject.Create;
    lrespObj.Add('sender', 'server');
    lrespObj.Add('type', 'command');
    lrespObj.Add('command', 'elevate');
 
    lArr := TJSONArray.Create;
    lArr.Add(TJSONObject.Create.Add('protocol', 'TLS_1.0'));
 
    lrespObj.Add('parameters', lArr);
    FConnection.SendMessage(JSONToString(lrespObj), aSock);
    //lrespObj.Free;
    //lArr.Clear;
 
    TLSSLSession(aSock.Session).Password := PassWd;
    //aSock.SetState( ssSSLActive ); //won't work, SIGSEGV
    TLSSLSession(aSock.Session).SSLActive := True; //won't work: SIGSEGV (at "ssl_set_decrypt_key" just in case, it helps ...)
  except
  end;
end;


I would enjoy, if you can help me out a little bit, 'cause I'm still learning.

Also, I know, there is a topic about something similar, but it didn't help me out, 'cause it uses the visual-component and sets the SSL-Session globally, which would encrypt/decrypt every connection opened by the server and that's not what I'm trying to do. :S

Greets,

mark332

PS: Please excuse possible misspellings, I'm still learning english, too. ;)

 

TinyPortal © 2005-2018