diff --git a/ReadAppSignature/.idea/ReadAppSignature.iml b/ReadAppSignature/.idea/ReadAppSignature.iml
new file mode 100644
index 0000000..d6ebd48
--- /dev/null
+++ b/ReadAppSignature/.idea/ReadAppSignature.iml
@@ -0,0 +1,9 @@
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/ReadAppSignature/.idea/codeStyles/Project.xml b/ReadAppSignature/.idea/codeStyles/Project.xml
new file mode 100644
index 0000000..30aa626
--- /dev/null
+++ b/ReadAppSignature/.idea/codeStyles/Project.xml
@@ -0,0 +1,29 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/ReadAppSignature/.idea/copyright/aura.xml b/ReadAppSignature/.idea/copyright/aura.xml
new file mode 100644
index 0000000..93a062e
--- /dev/null
+++ b/ReadAppSignature/.idea/copyright/aura.xml
@@ -0,0 +1,6 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/ReadAppSignature/.idea/misc.xml b/ReadAppSignature/.idea/misc.xml
new file mode 100644
index 0000000..a47fa70
--- /dev/null
+++ b/ReadAppSignature/.idea/misc.xml
@@ -0,0 +1,29 @@
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/ReadAppSignature/.idea/modules.xml b/ReadAppSignature/.idea/modules.xml
new file mode 100644
index 0000000..cb4c229
--- /dev/null
+++ b/ReadAppSignature/.idea/modules.xml
@@ -0,0 +1,8 @@
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/ReadAppSignature/.idea/workspace.xml b/ReadAppSignature/.idea/workspace.xml
new file mode 100644
index 0000000..d35e3c5
--- /dev/null
+++ b/ReadAppSignature/.idea/workspace.xml
@@ -0,0 +1,313 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 1531404384570
+
+
+ 1531404384570
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ aura
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/ReadAppSignature/package.json b/ReadAppSignature/package.json
new file mode 100644
index 0000000..4521859
--- /dev/null
+++ b/ReadAppSignature/package.json
@@ -0,0 +1,25 @@
+{
+ "name": "cordova-plugin-get-app-signature",
+ "version": "0.1.0",
+ "description": "This plugin is used to get application signature",
+ "cordova": {
+ "id": "cordova-plugin-get-app-signature",
+ "platforms": [
+ "android"
+ ]
+ },
+ "repository": {
+ "type": "git",
+ "url": "git+https://github.com/iamshajeer/CordovaReadApplicationSignature.git"
+ },
+ "keywords": [
+ "ecosystem:cordova",
+ "cordova-android"
+ ],
+ "author": "Shajeer Ahamed",
+ "license": "MIT",
+ "bugs": {
+ "url": "https://github.com/iamshajeer/CordovaReadApplicationSignature/issues"
+ },
+ "homepage": "https://github.com/iamshajeer/CordovaReadApplicationSignature#readme"
+}
diff --git a/ReadAppSignature/plugin.xml b/ReadAppSignature/plugin.xml
new file mode 100644
index 0000000..17f1f05
--- /dev/null
+++ b/ReadAppSignature/plugin.xml
@@ -0,0 +1,17 @@
+
+
+ ReadAppSignature
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/ReadAppSignature/src/android/ReadAppSignature.java b/ReadAppSignature/src/android/ReadAppSignature.java
new file mode 100644
index 0000000..6c06011
--- /dev/null
+++ b/ReadAppSignature/src/android/ReadAppSignature.java
@@ -0,0 +1,92 @@
+package cordova.plugin.appSignature;
+
+import org.apache.cordova.CordovaPlugin;
+import org.apache.cordova.CallbackContext;
+import org.apache.cordova.PluginResult;
+
+import org.json.JSONArray;
+import org.json.JSONException;
+import org.json.JSONObject;
+
+import android.annotation.SuppressLint;
+import android.content.pm.PackageInfo;
+import android.content.pm.PackageManager;
+import android.content.pm.Signature;
+
+import java.security.MessageDigest;
+import java.security.NoSuchAlgorithmException;
+import java.security.NoSuchProviderException;
+
+
+/**
+ * This class echoes a string called from JavaScript.
+ */
+public class ReadAppSignature extends CordovaPlugin {
+
+ @Override
+ public boolean execute(String action, JSONArray args, CallbackContext callbackContext) throws JSONException {
+ if (action.equals(Actions.GET_SIGNATURE)) {
+ this.getAppSignature(callbackContext);
+ return true;
+ }
+ return false;
+ }
+
+ private void getAppSignature(CallbackContext callbackContext) {
+ PluginResult pluginResult = new PluginResult(PluginResult.Status.OK, getAppSignature());
+ callbackContext.sendPluginResult(pluginResult);
+ }
+
+ @SuppressLint("PackageManagerGetSignatures")
+ public String getAppSignature() {
+
+ PackageInfo packageInfo;
+ try {
+ packageInfo = cordova.getActivity().getPackageManager().getPackageInfo(
+ cordova.getActivity().getPackageName(), PackageManager.GET_SIGNATURES);
+
+ //note sample just checks the first signature
+ for (Signature signature : packageInfo.signatures) {
+ // SHA1 the signature
+ LogUtils.LOGD(TAG, "getAppSignature() called : " + getSHA1(signature.toByteArray()));
+ return getSHA1(signature.toByteArray());
+ }
+ } catch (PackageManager.NameNotFoundException e) {
+ e.printStackTrace();
+ }
+ return "";
+ }
+
+ //computed the sha1 hash of the signature
+ public static String getSHA1(byte[] sig) {
+ MessageDigest digest = null;
+ try {
+ digest = MessageDigest.getInstance("SHA1", "BC");
+ } catch (NoSuchAlgorithmException e) {
+ e.printStackTrace();
+ } catch (NoSuchProviderException e) {
+ e.printStackTrace();
+ }
+ digest.update(sig);
+ byte[] hashtext = digest.digest();
+ return bytesToHex(hashtext);
+ }
+
+ //util method to convert byte array to hex string
+ public static String bytesToHex(byte[] bytes) {
+ final char[] hexArray = {'0', '1', '2', '3', '4', '5', '6', '7', '8',
+ '9', 'A', 'B', 'C', 'D', 'E', 'F'};
+ char[] hexChars = new char[bytes.length * 2];
+ int v;
+ for (int j = 0; j < bytes.length; j++) {
+ v = bytes[j] & 0xFF;
+ hexChars[j * 2] = hexArray[v >>> 4];
+ hexChars[j * 2 + 1] = hexArray[v & 0x0F];
+ }
+ return new String(hexChars);
+ }
+
+ interface Actions {
+ String GET_SIGNATURE = "getSignature";
+ }
+}
diff --git a/ReadAppSignature/www/ReadAppSignature.js b/ReadAppSignature/www/ReadAppSignature.js
new file mode 100644
index 0000000..895f29e
--- /dev/null
+++ b/ReadAppSignature/www/ReadAppSignature.js
@@ -0,0 +1,5 @@
+var exec = require('cordova/exec');
+
+exports.coolMethod = function (arg0, success, error) {
+ exec(success, error, 'ReadAppSignature', 'getAppSignature', [arg0]);
+};