Einzelnen Beitrag anzeigen

paresy

Registriert seit: 24. Aug 2004
Ort: Lübeck
105 Beiträge
 
Delphi 2007 Professional
 
#1

Indy HTTPServer + SSL in SVN Version kaputt

  Alt 16. Apr 2010, 11:04
r4177, Delphi 2007

Beim starten des HTTPServers wirft dieser eine Exception:
Code:
Exception class EIdOSSLLoadingRootCertError with message 'Could not load root certificate.
error:0B064071:x509 certificate routines:ADD_CERT_DIR:invalid directory'.
Das liegt an folgender Funktion:
Delphi-Quellcode:
function IndySSL_CTX_load_verify_locations(ctx: PSSL_CTX;
  const ACAFile, ACAPath: String): TIdC_INT;
begin
  Result := SSL_CTX_load_verify_locations(ctx, PAnsiChar(ACAFile),
    PAnsiChar(ACAPath));
end;
Woraround:
Delphi-Quellcode:
function IndySSL_CTX_load_verify_locations(ctx: PSSL_CTX;
  const ACAFile, ACAPath: String): TIdC_INT;
begin
  Result := SSL_CTX_load_verify_locations(ctx, PAnsiChar(ACAFile),
    nil);
end;
Wenn der ACAPath leer ist (was er immer ist), dann wird durch die PAnsiChar Konvertierung ein #0 zurückgegeben, was nicht NULL ist und dadurch überprüft OpenSSL den Pfad, der dann ungültig ist und in der o.g. Exception resultiert. Ein hardcoded NIL hilft. Ist aber nicht wirklich schön . Besser wäre eine Erkennung von Indy ob der User eine Datei oder einen Pfad angegeben hat und dann den jeweils richtigen Parameter ausfüllt und den anderen per NIL deaktiviert.

Doku: http://www.openssl.org/docs/ssl/SSL_...locations.html

paresy
  Mit Zitat antworten Zitat