Skip to content

jdgeier/SSLCertificateChecker-PhoneGap-Plugin

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

67 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

PhoneGap SSL Certificate Checker plugin (iOS, Android, Windows Universal)

by Eddy Verbruggen for PhoneGap 3.0.0 and up.

  1. Description
  2. Installation 2. Automatically (CLI / Plugman) 2. Manually 2. PhoneGap Build
  3. Usage
  4. Credits
  5. License
Need SSL Pinning? If checking the certificate manually isn't sufficient for your needs and you want to be absolutely positive each and every HTTPS request is sent to your server, then take a look at the Secure HTTP plugin.

1. Description

This plugin can be used to add an extra layer of security by preventing 'Man in the Middle' attacks. When correctly used, it will be very hard for hackers to intercept communication between your app and your server, because you can actively verify the SSL certificate of the server by comparing actual and expected fingerprints.

You may want to check the connection when the app is started, but you can choose to invoke this plugin everytime you communicate with the server. In either case, you can add your logic to the success and error callbacks.

2. Installation

Automatically (CLI / Plugman)

SSLCertificateChecker is compatible with Cordova Plugman and compatible with PhoneGap 3.0 CLI, here's how it works with the CLI:

$ phonegap local plugin add https://github.com/EddyVerbruggen/SSLCertificateChecker-PhoneGap-Plugin.git

or

$ cordova plugin add https://github.com/EddyVerbruggen/SSLCertificateChecker-PhoneGap-Plugin.git

Run cordova prepare or cordova build afterwards.

Manually

1. Add the following xml to your config.xml:

<!-- for iOS -->
<feature name="SSLCertificateChecker">
	<param name="ios-package" value="SSLCertificateChecker" />
</feature>
<!-- for Android -->
<feature name="SSLCertificateChecker">
  <param name="android-package" value="nl.xservices.plugins.SSLCertificateChecker" />
</feature>

2. Grab a copy of SSLCertificateChecker.js, add it to your project and reference it in index.html:

<script type="text/javascript" src="js/SSLCertificateChecker.js"></script>

3. Download the source files for iOS and/or Android and copy them to your project.

Android:

  • Copy SSLCertificateChecker.java to platforms/android/src/nl/xservices/plugins (create the folders)

iOS:

  • Add a dependency to Security.framework: Go to Your project > Build Phases > Link binaries with libraries > Click + > Security.framework.
  • Copy SSLCertificateChecker.* to platforms/ios/<ProjectName>/Plugins.

PhoneGap Build

Using SSLCertificateChecker with PhoneGap Build requires these simple steps:

1. Add the follow