Am Weitesten scheint mir das Sample unter Synapse\source\demo\httpsserv zu gehen, es ist aber für Delphi und der Code läuft bei mir nicht ohne Weiteres:
Code: Alles auswählen
procedure TTCPHttpThrd.Execute;
var
timeout: integer;
s: string;
method, uri, protocol: string;
size: integer;
x, n: integer;
resultcode: integer;
begin
timeout := 1000;
// Note: There's no need for installing a client certificate in the
// webbrowser. The server asks the webbrowser to send a certificate but
// if nothing is installed the software will work because the server
// doesn't check to see if a client certificate was supplied. If you
// want you can install:
//
// file: c_cacert.p12
// password: c_cakey
//
Sock.SSL.CertCAFile := ExtractFilePath(ParamStr(0)) + 's_cabundle.pem';
Sock.SSL.CertificateFile := ExtractFilePath(ParamStr(0)) + 's_cacert.pem';
Sock.SSL.PrivateKeyFile := ExtractFilePath(ParamStr(0)) + 's_cakey.pem';
Sock.SSL.KeyPassword := 's_cakey';
Sock.SSL.verifyCert := True;
try
if (not Sock.SSLAcceptConnection) or
(Sock.SSL.LastError <> 0) then
begin
MessageDlg('Error while accepting SSL connection: ' + Sock.SSL.LastErrorDesc, mtError, [mbAbort], 0);
Exit;
end;
except
MessageDlg('Exception while accepting SSL connection', mtError, [mbAbort], 0);
Exit;
end;
...
Ich würde - wenns sonst nichts direkt ausgereift Verwertbares gibt - das Beispiel nach Lazarus übersetzen, unter WIndows und Linux testen, und den Code dann ins Wiki einpflegen, da klafft meiner Meinung nach ein Loch.
https://wiki.freepascal.org/Networking# ... er_example
zeigt einen HTTP Server, der im Inhaltsverzeichnis versprochene HTTPS Teil fehlt, es ist nur ein bisschen was da zum Thema HTTPS Client. Ich kann jedenfalls sagen, dass das Einhängen der SSL Units per uses keinesfalls ausreicht, um SSL Support ans Laufen zu bekommen.
Armin.