Skip to content

Commit

Permalink
#49 Update to sha256 iOS & Android
Browse files Browse the repository at this point in the history
  • Loading branch information
EddyVerbruggen committed May 22, 2018
1 parent 262382c commit 16dac17
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 7 deletions.
10 changes: 6 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,11 +62,13 @@ $ cordova plugin add https://github.com/EddyVerbruggen/SSLCertificateChecker-Pho

First obtain the fingerprint of the SSL certificate of your server(s).
You can find it f.i. by opening the server URL in Chrome. Then click the green certificate in front of the URL, click 'Connection',
'Certificate details', expand the details and scroll down to the SHA1 fingerprint.
'Certificate details', expand the details and scroll down to the **SHA256** fingerprint.

> BEWARE: in plugin version < 6 you had to use SHA1, now it's SHA256 for iOS and Android (for Windows it's still SHA1 though).
```javascript
var server = "https://build.phonegap.com";
var fingerprint = "2B 24 1B E0 D0 8C A6 41 68 C2 BB E3 60 0A DF 55 1A FC A8 45";
var fingerprint = "C6 2D 93 39 C2 9F 82 8E 1E BE FD DC 2D 7B 7D 24 31 1A 59 E1 0B 4B C8 04 6E 21 F6 FA A2 37 11 45";

window.plugins.sslCertificateChecker.check(
successCallback,
Expand All @@ -82,7 +84,7 @@ You can find it f.i. by opening the server URL in Chrome. Then click the green c

function errorCallback(message) {
alert(message);
if (message == "CONNECTION_NOT_SECURE") {
if (message === "CONNECTION_NOT_SECURE") {
// There is likely a man in the middle attack going on, be careful!
} else if (message.indexOf("CONNECTION_FAILED") >- 1) {
// There was no connection (yet). Internet may be down. Try again (a few times) after a little timeout.
Expand All @@ -94,7 +96,7 @@ Need more than one fingerprint? In case your certificate is about to expire, you
Note you may want to force clients to update the app when the new certificate is activated.
```javascript
// an array of any number of fingerprints
var fingerprints = ["2B 24 1B E0 D0 8C A6 41 68 C2 BB E3 60 0A DF 55 1A FC A8 45", "SE CO ND", ..];
var fingerprints = ["C6 2D 93 39 C2 9F 82 8E 1E BE FD DC 2D 7B 7D 24 31 1A 59 E1 0B 4B C8 04 6E 21 F6 FA A2 37 11 45", "SE CO ND", ..];

window.plugins.sslCertificateChecker.check(
successCallback,
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "cordova-plugin-sslcertificatechecker",
"version": "5.1.0",
"version": "6.0.0",
"description": "This plugin allows allows you to check the SSL Certificate of the server you're connecting to. This can be useful for prevention of Man In The Middle attacks.",
"cordova": {
"id": "cordova-plugin-sslcertificatechecker",
Expand Down Expand Up @@ -37,4 +37,4 @@
"url": "https://github.com/EddyVerbruggen/SSLCertificateChecker-PhoneGap-Plugin/issues"
},
"homepage": "https://github.com/EddyVerbruggen/SSLCertificateChecker-PhoneGap-Plugin#readme"
}
}
2 changes: 1 addition & 1 deletion plugin.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<plugin xmlns="http://apache.org/cordova/ns/plugins/1.0"
xmlns:android="http://schemas.android.com/apk/res/android"
id="cordova-plugin-sslcertificatechecker"
version="5.1.0">
version="6.0.0">

<name>SSL Certificate Checker</name>

Expand Down

0 comments on commit 16dac17

Please sign in to comment.