Einzelnen Beitrag anzeigen

oakley

Registriert seit: 15. Aug 2005
287 Beiträge
 
#14

AW: Android - SSL-Verschlüsselung

  Alt 19. Apr 2022, 19:18
Hallo,

sorry dass ich mich hier einklinke aber ich habe das gleiche Problem unter Android in Delphi 11.

Die libssl.so und libcrypto.so habe ich ins Android/Release Verzeichnis gepackt und stelle beide Dateien im Verzeichnis library\lib\armeabi-v7a\ bereit.

Die Prozedur initssl habe ich auf das Notwendigste für Android gekürzt. Wenn ich jetzt zur dementsprechenden https Adresse posten möchte, bekomme ich, dass die SSL Bibliothek nicht geladen werden konnte.

Delphi-Quellcode:
var help2: String;
begin
  if (not sslInited) then
  begin
    sslInited:=true;
    IdOpenSSLSetLibPath(String.Empty);
    IdSSLOpenSSLHeaders.Load();
    help2:=IdSSLOpenSSLHeaders.WhichFailedToLoad();
    if (length(help2) > 0) then
    begin
      IdOpenSSLSetLibPath(IncludeTrailingPathDelimiter(TPath.GetLibraryPath));
      IdSSLOpenSSLHeaders.Load();
      help2:=IdSSLOpenSSLHeaders.WhichFailedToLoad();
      if (length(help2) > 0) then
      begin
        IdOpenSSLSetLibPath(IncludeTrailingPathDelimiter(TPath.GetDocumentsPath));
        IdSSLOpenSSLHeaders.Load();
        help2:=IdSSLOpenSSLHeaders.WhichFailedToLoad();
      end;
    end;
  end;
end;
Delphi-Quellcode:
var H: TIdHttp;
    SS: TStringStream;
    IdSSL : TIdSSLIOHandlerSocketOpenSSL;
begin
  initssl;
  H := TIdHttp.Create(nil);
  idSSL := TIdSSLIOHandlerSocketOpenSSL.Create(H);
  idSSL.SSLOptions.Method := sslvTLSv1_2;
  idSSL.SSLOptions.SSLVersions := [sslvTLSv1_2];
  idSSL.SSLOptions.Mode := sslmUnassigned;
  idSSL.SSLOptions.VerifyMode := [];
  idSSL.SSLOptions.VerifyDepth := 0;
  H.IOHandler := IdSSL;

  try
    SS := TStringStream.Create;
    try
      H.Post(--> hier kommt die https URL,SS);
      ShowMessage(SS.DataString);
    finally SS.Free;
    end;
  finally H.Free;
  end;

Geändert von oakley (19. Apr 2022 um 20:01 Uhr)
  Mit Zitat antworten Zitat