Connect to the web server via Phonegap with SSL and certificate

As for the Phonegap app for Android and iOS on JS.

We have a server with a method: - Authorize (login, password) that return the certificate.p12 file (PKCS # 12).

The server also has methods that require authorization with this certificate. A Ruby example is as follows:

http = Net::HTTP.new(url.host, url.port) http.use_ssl = true http.verify_mode = OpenSSL::SSL::VERIFY_NONE pkcs12 = OpenSSL::PKCS12.new(File.read('<CERTIFICATE_PATH>'),'') http.cert = pkcs12.certificate http.key = pkcs12.key req = Net::HTTP::Get.new(url.path) result = http.start {|http| result = http.request(req) p result.body } 

But how to do it on JS? How to force a method to call JS from Phonegap?

The only solution I found: through plugins in Java and iOS, but I'm not sure if they will work. If so, maybe someone already made them?

+5
source share
1 answer

I use twitter finagle and akka to connect to the web service. You would need to learn scala and how to mix java with scala and install sbt, which would be an option if you had enough time to place the learning curve. scala also has a very good api for parsing xml.

The application configuration file will show your security settings. It is worth exploring.

There is a lot of research and coding, but in the end it is worth it.

0
source

Source: https://habr.com/ru/post/905038/


All Articles