[SOLVED] LAMW and openssl lazarus / 43-Android ---------------------------------------------------------------------- Mrbeam · 2019-09-23 08:39 I'm trying to port a working desktop app that needs openssll support to android. I'm using fphttpclient but when I try to access eg. https://www.google.com I get error "Cannot create a X509 certificate without SLL support" I've added libcrypto.so and libssl.so to libs folder next to libcontrols.so (libcrypto.so and libssl.so tested and working with qt for android) but I get same error message. ---------------------------------------------------------------------- svd71 · 2019-09-23 09:07 Under Android Strudio did I with the import of two libraries: jgss.jar and jsch(http://www.jcraft.com/jsch/). It work fine. You need to do the only couple of wrapper classes from jsch. ---------------------------------------------------------------------- jmpessoa · 2019-09-23 21:28 Hi, svd71! Can you put in some online drive a simple "Android Studio" [project] example? I can try implement a LAMW component wrapper..... Thank you! ---------------------------------------------------------------------- Mrbeam · 2019-09-24 11:01 I did more tests and the problem is not ssl library, it's not working with "http" either. App cannot create socket handler even though is has internet access permission. If you want to try just create a new LAMW Gui project, drop a button and: procedure TAndroidModule1.HttpClientGetSocketHandler(Sender: TObject;     const UseSSL: Boolean; out AHandler: TSocketHandler); begin   If UseSSL then begin     AHandler:=TSSLSocketHandler.Create;     TSSLSocketHandler(AHandler).SSLType:=stTLSv1_2;   end else     AHandler:=TSocketHandler.Create; end; procedure TAndroidModule1.jButton1Click(Sender: TObject); var s:string;     http: TFPHttpClient; begin     if (InitSSLInterface) then         ShowMessage('SSL libs ok!')     else         ShowMessage('No SSL libs!');     http:=TFPHttpClient.Create(nil);     http.OnGetSocketHandler := @HttpClientGetSocketHandler;     http.AllowRedirect:=True;     http.AddHeader('User-Agent','Mozilla');     try         s:=http.Get('https://www.google.com');     except         on E: Exception do             ShowMessage(E.Message);     end; end; ---------------------------------------------------------------------- svd71 · 2019-09-24 12:56 Download link ---------------------------------------------------------------------- jmpessoa · 2019-09-24 16:38 @Mrbeam Quotehttp.OnGetSocketHandler := @HttpClientGetSocketHandler; In "mode delphi" change to: Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i http.OnGetSocketHandler := HttpClientGetSocketHandler;  What you need? A ftp client? a http client? etc...? @svd71 I will try your code! [curiosity: you can try LAMW "jcMikrotikRouterOS" component, demo "AppJCenterMikrotikRouterOSDemo1"] Thank you! ---------------------------------------------------------------------- Mrbeam · 2019-09-25 07:33 Thank you! I need http(s) only. My original project was in QT c++, with qt widgets on desktop and qml on android for gui, but both versions were sharing the same logic code in c++. Now I ported desktop version to fpc Lazarus and I need cross platform http requests and multithreading. Multithreading tested and working cross platform but I can't make http client to work. I only need LAMW for gui and keep all logic in native fpc, project is big and I can't keep it updated on all platforms if they don't share the same logic code. I'm on Ubuntu 18.04, I don't have Android Studio installed, and I have 0 experience with java. ---------------------------------------------------------------------- jmpessoa · 2019-09-25 15:10 QuoteI've added libcrypto.so and libssl.so to libs folder next to libcontrols.so (libcrypto.so and libssl.so tested and working with qt for android) but I get same error message. Do you have "libcrypto.so" and "libssl.so"  compiled for "arm-android" [32 bits] and "aarch64-android"? If yes, please, put its in some open/online drive... I will try some tests.... Thank you! ---------------------------------------------------------------------- Mrbeam · 2019-09-26 08:54 32bit https://www.dropbox.com/s/8bnotyqug42pghi/OpensslLibs.zip ---------------------------------------------------------------------- Thaddy · 2019-09-26 08:59 Aren't those 32 bit INTEL? ---------------------------------------------------------------------- Josh · 2019-09-26 15:31 followin has .so for 1.1.1 https://github.com/KDAB/android_openssl ---------------------------------------------------------------------- jmpessoa · 2019-09-26 16:01 NEW! jSFTPClient  [LAMW] component! [based on java/jsch library] NEW!  demo "AppSFTPClientDemo1" Thanks to All! ---------------------------------------------------------------------- svd71 · 2019-09-26 16:17 thank. But I think, that SFTP isn't a target. SSH.Execute() is better as some thnig other. PS: A brange from hier:      https://github.com/jmpessoa/lazandroidmodulewizard and   oficial update from Lazarus (over menu Package->Online Package Manager) have many diffrent methods which skipped on github. It is ok? ---------------------------------------------------------------------- Mrbeam · 2019-09-27 08:17 Solved! I tried THTTPSend from synapse and everything working on both desktop and mobile without any changes. Thank you all! ---------------------------------------------------------------------- jmpessoa · 2019-09-27 14:56 QuoteI tried THTTPSend from synapse and everything working on both desktop and mobile without any changes. Great!! Please,  put a simple LAMW example in some open/online drive... So,  I will commit it to the LAMW github! Thank you!! ---------------------------------------------------------------------- schumi · 2019-09-27 16:01 Quote from: Mrbeam on September 27, 2019, 10:17:56 amSolved! I tried THTTPSend from synapse and everything working on both desktop and mobile without any changes. Thank you all! I am interestet too thanks ---------------------------------------------------------------------- Mrbeam · 2019-09-28 08:52 Demo https://www.dropbox.com/s/5k5cvfxlgumrb69/AppDemoHttpGet.zip Already compiled project for arm7, has OpenSSL libs compiled by me. If you need 64bit or newer versions download OpenSSL libs from @josh link. EDIT: There are some problems with the demo. After http.UserAgent := UserAgent; add line Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i http.Headers.Append('content-type: text/html; charset=UTF-8'); After ShowMessage('Too many redirects!'); add Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i l.Free;http.Free; Replace jTextView1.Append(Utf8EscapeControlChars(response)); with Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i jTextView1.Append(response);