Guest User

mAadhaar Hardcoded Password

a guest
Jan 10th, 2018
1,654
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 39.21 KB | None | 0 0
  1. package in.gov.uidai.mAadhaarPlus.util;
  2.  
  3. import android.app.Activity;
  4. import android.app.ActivityManager;
  5. import android.app.Dialog;
  6. import android.content.ComponentName;
  7. import android.content.ContentResolver;
  8. import android.content.Context;
  9. import android.content.Intent;
  10. import android.content.res.AssetManager;
  11. import android.content.res.Resources;
  12. import android.graphics.Bitmap;
  13. import android.graphics.BitmapFactory;
  14. import android.graphics.drawable.ColorDrawable;
  15. import android.graphics.drawable.Drawable;
  16. import android.net.Uri;
  17. import android.nfc.NdefRecord;
  18. import android.os.CountDownTimer;
  19. import android.os.Environment;
  20. import android.os.Parcelable;
  21. import android.support.v4.content.l;
  22. import android.support.v7.app.c;
  23. import android.telephony.TelephonyManager;
  24. import android.text.Editable;
  25. import android.text.TextUtils;
  26. import android.text.method.HideReturnsTransformationMethod;
  27. import android.text.method.PasswordTransformationMethod;
  28. import android.text.method.TransformationMethod;
  29. import android.util.Base64;
  30. import android.util.DisplayMetrics;
  31. import android.util.Log;
  32. import android.view.LayoutInflater;
  33. import android.view.View;
  34. import android.view.ViewGroup;
  35. import android.view.Window;
  36. import android.widget.Button;
  37. import android.widget.CheckBox;
  38. import android.widget.CompoundButton;
  39. import android.widget.EditText;
  40. import android.widget.ImageView;
  41. import android.widget.TextView;
  42. import android.widget.Toast;
  43. import in.gov.uidai.mAadhaarPlus.BaseApplication;
  44. import in.gov.uidai.mAadhaarPlus.b.f;
  45. import in.gov.uidai.mAadhaarPlus.beans.ResidentProfile;
  46. import in.gov.uidai.mAadhaarPlus.beans.enums.Gender;
  47. import in.gov.uidai.mAadhaarPlus.e.a;
  48. import in.gov.uidai.mAadhaarPlus.service.CountDownService;
  49. import in.gov.uidai.mAadhaarPlus.ui.activity.WebViewActivity;
  50. import in.gov.uidai.mAadhaarPlus.util.b;
  51. import in.gov.uidai.mAadhaarPlus.util.h;
  52. import in.gov.uidai.mAadhaarPlus.util.j;
  53. import java.io.ByteArrayInputStream;
  54. import java.io.File;
  55. import java.io.IOException;
  56. import java.io.InputStream;
  57. import java.io.Reader;
  58. import java.io.StringReader;
  59. import java.io.StringWriter;
  60. import java.io.Writer;
  61. import java.nio.charset.Charset;
  62. import java.security.InvalidKeyException;
  63. import java.security.Key;
  64. import java.security.MessageDigest;
  65. import java.security.NoSuchAlgorithmException;
  66. import java.text.ParseException;
  67. import java.text.SimpleDateFormat;
  68. import java.util.ArrayList;
  69. import java.util.Date;
  70. import java.util.Iterator;
  71. import java.util.List;
  72. import java.util.Locale;
  73. import java.util.Random;
  74. import java.util.StringTokenizer;
  75. import java.util.regex.Matcher;
  76. import java.util.regex.Pattern;
  77. import javax.crypto.BadPaddingException;
  78. import javax.crypto.Cipher;
  79. import javax.crypto.IllegalBlockSizeException;
  80. import javax.crypto.NoSuchPaddingException;
  81. import javax.crypto.spec.SecretKeySpec;
  82. import javax.xml.parsers.DocumentBuilder;
  83. import javax.xml.parsers.DocumentBuilderFactory;
  84. import javax.xml.parsers.ParserConfigurationException;
  85. import javax.xml.transform.Result;
  86. import javax.xml.transform.Source;
  87. import javax.xml.transform.Transformer;
  88. import javax.xml.transform.TransformerConfigurationException;
  89. import javax.xml.transform.TransformerException;
  90. import javax.xml.transform.TransformerFactory;
  91. import javax.xml.transform.dom.DOMSource;
  92. import javax.xml.transform.stream.StreamResult;
  93. import org.w3c.dom.Document;
  94. import org.w3c.dom.Node;
  95. import org.xml.sax.InputSource;
  96. import org.xml.sax.SAXException;
  97.  
  98. public class i {
  99.     private static final String ALGORITHM = "AES";
  100.     public static boolean BIO_LOCK_STATUS_FETCHED = false;
  101.     public static final String DB_KEY_BIO_LOCK_TIMEOUT;
  102.     public static final String DB_KEY_CONFIG;
  103.     public static final String DB_KEY_KI_VALUE;
  104.     public static final String DB_KEY_MPIN;
  105.     public static final String DB_KEY_NOTIFICATION;
  106.     public static CountDownTimer LOGOUT_TIMER;
  107.     public static boolean LOGOUT_TIMER_ON = false;
  108.     private static final String PASSWORD_PATTERN = "(^(?=.*[0-9])(?=.*[a-z])(?=.*[A-Z])(?=.*[@#&%*()!-])(?=\\S+$).{8,}$)";
  109.     public static final String PWD_SALT;
  110.     public static final String SIM_DIFFERENT = "1";
  111.     public static final String SIM_INACTIVE = "2";
  112.     public static final String SIM_OK = "0";
  113.     private static final String TAG;
  114.     public static EditText otpEditText;
  115.  
  116.     static {
  117.         TAG = i.class.getSimpleName();
  118.         LOGOUT_TIMER_ON = true;
  119.         BIO_LOCK_STATUS_FETCHED = false;
  120.         PWD_SALT = String.valueOf(2131296316);
  121.         DB_KEY_MPIN = String.valueOf(2131296313);
  122.         DB_KEY_KI_VALUE = String.valueOf(2131296312);
  123.         DB_KEY_CONFIG = String.valueOf(2131296311);
  124.         DB_KEY_BIO_LOCK_TIMEOUT = String.valueOf(2131296310);
  125.         DB_KEY_NOTIFICATION = String.valueOf(2131296314);
  126.     }
  127.  
  128.     public static String byteArrayToHex(byte[] arrby) {
  129.         StringBuffer stringBuffer = new StringBuffer();
  130.         for (int i2 = 0; i2 < arrby.length; ++i2) {
  131.             stringBuffer.append(Integer.toString((arrby[i2] & 255) + 256, 16).substring(1));
  132.         }
  133.         return stringBuffer.toString();
  134.     }
  135.  
  136.     public static void cancelLogOffTimer() {
  137.         if (LOGOUT_TIMER_ON) {
  138.             LOGOUT_TIMER.cancel();
  139.             LOGOUT_TIMER_ON = false;
  140.         }
  141.     }
  142.  
  143.     public static boolean checkSDcardAvailable() {
  144.         boolean bl2 = false;
  145.         if (Environment.getExternalStorageState().equals("mounted")) {
  146.             bl2 = true;
  147.         }
  148.         return bl2;
  149.     }
  150.  
  151.     public static boolean checkWhetherSIMisValid(Context context, String string2) {
  152.         return false;
  153.     }
  154.  
  155.     public static String convertPasswordHash(String string2) {
  156.         try {
  157.             string2 = i.hashPassword(string2, PWD_SALT);
  158.             return string2;
  159.         }
  160.         catch (NoSuchAlgorithmException noSuchAlgorithmException) {
  161.             Log.e((String)TAG, (String)("Error:" + noSuchAlgorithmException.getMessage()));
  162.             Log.getStackTraceString((Throwable)noSuchAlgorithmException);
  163.             return null;
  164.         }
  165.     }
  166.  
  167.     /*
  168.      * Enabled aggressive block sorting
  169.      */
  170.     public static NdefRecord createNewNdefRecord(String arrby, Locale object, boolean bl2) {
  171.         byte[] arrby2 = object.getLanguage().getBytes(Charset.forName("US-ASCII"));
  172.         object = bl2 ? Charset.forName("UTF-8") : Charset.forName("UTF-16");
  173.         arrby = arrby.getBytes((Charset)object);
  174.         int n2 = bl2 ? 0 : 128;
  175.         n2 = (char)(n2 + arrby2.length);
  176.         object = new byte[arrby2.length + 1 + arrby.length];
  177.         object[0] = (byte)n2;
  178.         System.arraycopy(arrby2, 0, object, 1, arrby2.length);
  179.         System.arraycopy(arrby, 0, object, arrby2.length + 1, arrby.length);
  180.         return new NdefRecord(1, NdefRecord.RTD_TEXT, new byte[0], (byte[])object);
  181.     }
  182.  
  183.     public static String createXmlDocument(String string2) {
  184.         try {
  185.             Object object = DocumentBuilderFactory.newInstance();
  186.             object.setNamespaceAware(true);
  187.             object = object.newDocumentBuilder().parse(new InputSource(new StringReader(string2)));
  188.             StringWriter stringWriter = new StringWriter();
  189.             TransformerFactory.newInstance().newTransformer().transform(new DOMSource((Node)object), new StreamResult(stringWriter));
  190.             object = stringWriter.getBuffer().toString();
  191.             return object;
  192.         }
  193.         catch (SAXException sAXException) {
  194.             Log.e((String)TAG, (String)("Error:" + sAXException.getMessage()));
  195.             Log.getStackTraceString((Throwable)sAXException);
  196.             return string2;
  197.         }
  198.         catch (IOException iOException) {
  199.             Log.e((String)TAG, (String)("Error:" + iOException.getMessage()));
  200.             Log.getStackTraceString((Throwable)iOException);
  201.             return string2;
  202.         }
  203.         catch (ParserConfigurationException parserConfigurationException) {
  204.             Log.e((String)TAG, (String)("Error:" + parserConfigurationException.getMessage()));
  205.             Log.getStackTraceString((Throwable)parserConfigurationException);
  206.             return string2;
  207.         }
  208.         catch (TransformerConfigurationException transformerConfigurationException) {
  209.             Log.e((String)TAG, (String)("Error:" + transformerConfigurationException.getMessage()));
  210.             Log.getStackTraceString((Throwable)transformerConfigurationException);
  211.             return string2;
  212.         }
  213.         catch (TransformerException transformerException) {
  214.             Log.e((String)TAG, (String)("Error:" + transformerException.getMessage()));
  215.             Log.getStackTraceString((Throwable)transformerException);
  216.             return string2;
  217.         }
  218.     }
  219.  
  220.     public static byte[] decodeBase64(String string2) {
  221.         return Base64.decode((byte[])string2.getBytes(), (int)2);
  222.     }
  223.  
  224.     /*
  225.      * Enabled force condition propagation
  226.      * Lifted jumps to return sites
  227.      */
  228.     public static byte[] decryptByte(byte[] arrby, String object) {
  229.         try {
  230.             object = i.generateKey(i.returnStringOfLength16((String)object).getBytes());
  231.             Cipher cipher = Cipher.getInstance("AES");
  232.             cipher.init(2, (Key)object);
  233.             return cipher.doFinal(Base64.decode((byte[])arrby, (int)2));
  234.         }
  235.         catch (BadPaddingException badPaddingException) {
  236.             do {
  237.                 return null;
  238.                 break;
  239.             } while (true);
  240.         }
  241.         catch (NoSuchAlgorithmException noSuchAlgorithmException) {
  242.             return null;
  243.         }
  244.         catch (NoSuchPaddingException noSuchPaddingException) {
  245.             return null;
  246.         }
  247.         catch (InvalidKeyException invalidKeyException) {
  248.             return null;
  249.         }
  250.         catch (IllegalBlockSizeException illegalBlockSizeException) {
  251.             return null;
  252.         }
  253.     }
  254.  
  255.     /*
  256.      * Enabled force condition propagation
  257.      * Lifted jumps to return sites
  258.      */
  259.     public static String decryptString(String string2, String object) {
  260.         try {
  261.             object = i.generateKey(i.returnStringOfLength16((String)object).getBytes());
  262.             Cipher cipher = Cipher.getInstance("AES");
  263.             cipher.init(2, (Key)object);
  264.             return new String(cipher.doFinal(i.decodeBase64(string2)));
  265.         }
  266.         catch (BadPaddingException badPaddingException) {
  267.             do {
  268.                 return null;
  269.                 break;
  270.             } while (true);
  271.         }
  272.         catch (NoSuchAlgorithmException noSuchAlgorithmException) {
  273.             return null;
  274.         }
  275.         catch (NoSuchPaddingException noSuchPaddingException) {
  276.             return null;
  277.         }
  278.         catch (InvalidKeyException invalidKeyException) {
  279.             return null;
  280.         }
  281.         catch (IllegalBlockSizeException illegalBlockSizeException) {
  282.             return null;
  283.         }
  284.     }
  285.  
  286.     public static String encodeBase64(String string2) {
  287.         return Base64.encodeToString((byte[])string2.getBytes(), (int)2);
  288.     }
  289.  
  290.     public static byte[] encryptByte(byte[] arrby, String object) {
  291.         object = i.generateKey(i.returnStringOfLength16((String)object).getBytes());
  292.         Cipher cipher = Cipher.getInstance("AES");
  293.         cipher.init(1, (Key)object);
  294.         return Base64.encode((byte[])cipher.doFinal(arrby), (int)2);
  295.     }
  296.  
  297.     public static String encryptString(String string2, String object) {
  298.         object = i.generateKey(i.returnStringOfLength16((String)object).getBytes());
  299.         Cipher cipher = Cipher.getInstance("AES");
  300.         cipher.init(1, (Key)object);
  301.         return new String(Base64.encode((byte[])cipher.doFinal(string2.getBytes()), (int)2));
  302.     }
  303.  
  304.     public static void enlargeImage(Context context, String string2, ImageView imageView) {
  305.         context = new Dialog(context);
  306.         context.setContentView(2130968649);
  307.         context.setTitle((CharSequence)string2);
  308.         context.setCancelable(true);
  309.         context.getWindow().setBackgroundDrawable((Drawable)new ColorDrawable(0));
  310.         ((ImageView)context.findViewById(2131689705)).setImageDrawable(imageView.getDrawable());
  311.         context.show();
  312.     }
  313.  
  314.     public static Bitmap fetchImageFromSDcard(String object) {
  315.         if ((object = new File((String)object)) != null && object.exists() && (object = BitmapFactory.decodeFile((String)object.getAbsolutePath())) != null) {
  316.             return object;
  317.         }
  318.         return null;
  319.     }
  320.  
  321.     public static String formatAadhaarNumber(String string2, boolean bl2) {
  322.         if (string2.length() == 12 && !bl2) {
  323.             return string2.substring(0, 4) + " " + string2.substring(4, 8) + " " + string2.substring(8, 12);
  324.         }
  325.         if (string2.length() == 12 && bl2) {
  326.             return string2.substring(0, 2) + "XX-XXXX-" + string2.substring(8, 12);
  327.         }
  328.         return "Invalid format";
  329.     }
  330.  
  331.     /*
  332.      * Enabled force condition propagation
  333.      * Lifted jumps to return sites
  334.      */
  335.     public static String formatEnrolmentNumber(String string2) {
  336.         if (TextUtils.isEmpty((CharSequence)string2)) {
  337.             return "";
  338.         }
  339.         String string3 = string2;
  340.         if (string2.length() != 14) return string3;
  341.         return string2.substring(0, 4) + "/" + string2.substring(4, 9) + "/" + string2.substring(9, 14);
  342.     }
  343.  
  344.     public static String formatISOTimeStamp(String string2) {
  345.         Object object = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss", Locale.getDefault());
  346.         SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm", Locale.getDefault());
  347.         try {
  348.             object = simpleDateFormat.format(object.parse(string2).getTime());
  349.             return object;
  350.         }
  351.         catch (ParseException parseException) {
  352.             Log.e((String)TAG, (String)("" + parseException.getMessage()));
  353.             return string2;
  354.         }
  355.     }
  356.  
  357.     public static String formatISOTimeStampNew(String string2) {
  358.         Object object = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss", Locale.getDefault());
  359.         SimpleDateFormat simpleDateFormat = new SimpleDateFormat("dd-MM-yyyy HH:mm", Locale.getDefault());
  360.         try {
  361.             object = simpleDateFormat.format(object.parse(string2).getTime());
  362.             return object;
  363.         }
  364.         catch (ParseException parseException) {
  365.             Log.e((String)TAG, (String)("" + parseException.getMessage()));
  366.             return string2;
  367.         }
  368.     }
  369.  
  370.     public static int generate3DigitRandom() {
  371.         Random random = new Random();
  372.         new StringBuffer();
  373.         return random.nextInt(900) + 100;
  374.     }
  375.  
  376.     public static String generateDBPassword() {
  377.         Object object = new Random();
  378.         object.setSeed(123456789);
  379.         int n2 = object.nextInt(10);
  380.         object = BaseApplication.getApplication().getString(2131296496);
  381.         object = i.encodeBase64((String)object + n2);
  382.         Log.d((String)TAG, (String)("Password: " + (String)object));
  383.         return object;
  384.     }
  385.  
  386.     private static Key generateKey(byte[] arrby) {
  387.         return new SecretKeySpec(arrby, "AES");
  388.     }
  389.  
  390.     public static String generateQRCodeXml(ResidentProfile residentProfile) {
  391.         return i.createXmlDocument("<PrintLetterBarcodeData  uid=\"" + h.formatString(residentProfile.getUid()) + "\"" + " name=\"" + h.formatString(residentProfile.getName()) + "\"" + " gender=\"" + h.formatString(residentProfile.getGender()) + "\"" + " yob=\"" + h.formatString(i.getYearOfBirth(residentProfile.getDob())) + "\"" + " dob=\"" + h.formatString(residentProfile.getDob()) + "\"" + " co=\"" + h.formatString(residentProfile.getCareof()) + "\"" + " house=\"" + h.formatString(residentProfile.getBuilding()) + "\"" + " street=\"" + h.formatString(residentProfile.getStreet()) + "\"" + " loc=\"" + h.formatString(residentProfile.getLocality()) + "\"" + " vtc=\"" + h.formatString(residentProfile.getVtcName()) + "\"" + " po=\"" + h.formatString(residentProfile.getPoName()) + "\"" + " dist=\"" + h.formatString(residentProfile.getDistrictName()) + "\"" + " subdist=\"" + h.formatString(residentProfile.getSubDist()) + "\"" + " state=\"" + h.formatString(residentProfile.getStateName()) + "\"" + " pc=\"" + h.formatString(residentProfile.getPincode()) + "\"" + " />");
  392.     }
  393.  
  394.     public static String getFormattedString(String string2, boolean bl2) {
  395.         if (string2 != null) {
  396.             if (!string2.isEmpty()) {
  397.                 String string3 = string2;
  398.                 if (!bl2) {
  399.                     string3 = string2 + ",\n";
  400.                 }
  401.                 return string3;
  402.             }
  403.             return "";
  404.         }
  405.         return "";
  406.     }
  407.  
  408.     /*
  409.      * Enabled force condition propagation
  410.      * Lifted jumps to return sites
  411.      */
  412.     public static String getGenderValue(String string2) {
  413.         if (string2.equalsIgnoreCase("M")) {
  414.             return Gender.M.getValue();
  415.         }
  416.         if (string2.equalsIgnoreCase("F")) {
  417.             return Gender.F.getValue();
  418.         }
  419.         String string3 = string2;
  420.         if (!string2.equalsIgnoreCase("T")) return string3;
  421.         return Gender.T.getValue();
  422.     }
  423.  
  424.     public static Bitmap getImageAsBitmapFromBase64EncodedFormat(String string2) {
  425.         return BitmapFactory.decodeStream((InputStream)new ByteArrayInputStream(i.decodeBase64(string2)));
  426.     }
  427.  
  428.     public static File getImageStorageFilePath() {
  429.         File file;
  430.         File file2 = file = new File(BaseApplication.getApplication().getFilesDir(), "images");
  431.         if (!file.exists()) {
  432.             file2 = file;
  433.             if (!file.mkdirs()) {
  434.                 Log.d((String)TAG, (String)"failed to create directory");
  435.                 file2 = null;
  436.             }
  437.         }
  438.         return file2;
  439.     }
  440.  
  441.     private static Intent getMyService(Class<?> class_, String string2) {
  442.         Iterator iterator = ((ActivityManager)BaseApplication.getApplication().getSystemService("activity")).getRunningServices(Integer.MAX_VALUE).iterator();
  443.         while (iterator.hasNext()) {
  444.             ActivityManager.RunningServiceInfo runningServiceInfo = (ActivityManager.RunningServiceInfo)iterator.next();
  445.             if (!class_.getName().equals(runningServiceInfo.service.getClassName())) continue;
  446.             Object object = runningServiceInfo.service;
  447.             runningServiceInfo = new Intent();
  448.             runningServiceInfo.setComponent((ComponentName)object);
  449.             object = runningServiceInfo.getStringExtra("bundle_key_uid");
  450.             if (object == null || !object.equals(string2)) continue;
  451.             return runningServiceInfo;
  452.         }
  453.         return null;
  454.     }
  455.  
  456.     public static String getPayloadData(String string2, boolean bl2, boolean bl3) {
  457.         return "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>\n    <UpdateRequest requestMedium=\"MOBILE\" uid=\"" + string2 + "\" xmlns=\"http://www.uidai.gov.in/coreupdateapi/1.0\">\n" + "    <client-id>123</client-id>\n" + "    <client-version>1.0</client-version>\n" + "    <pref>\n" + "    <unlockBiometrics>" + bl2 + "</unlockBiometrics>" + "    <enableBiometricsLock>" + bl3 + "</enableBiometricsLock>\n" + "    </pref>\n" + "    </UpdateRequest>";
  458.     }
  459.  
  460.     /*
  461.      * Enabled aggressive block sorting
  462.      */
  463.     public static List<Integer> getQRCodeWidthHeight(Context context) {
  464.         ArrayList<Integer> arrayList = new ArrayList<Integer>();
  465.         context = context.getResources().getDisplayMetrics();
  466.         int n2 = context.heightPixels;
  467.         int n3 = (int)((double)context.widthPixels / 1.2);
  468.         int n4 = n2 > n3 ? n3 : n2;
  469.         int n5 = n2;
  470.         if (n2 > n3) {
  471.             n5 = n2 - (n2 - n3);
  472.         }
  473.         arrayList.add(n4);
  474.         arrayList.add(n5);
  475.         return arrayList;
  476.     }
  477.  
  478.     public static String[] getTelephoneInformation(Context context) {
  479.         context = (TelephonyManager)context.getSystemService("phone");
  480.         return new String[]{context.getDeviceId(), context.getSubscriberId(), context.getLine1Number(), Integer.toString(context.getSimState())};
  481.     }
  482.  
  483.     public static String getUserPasswordHash(Context context, String string2) {
  484.         return null;
  485.     }
  486.  
  487.     private static String getYearOfBirth(String string2) {
  488.         String string3 = string2;
  489.         if (!TextUtils.isEmpty((CharSequence)string2)) {
  490.             string3 = string2;
  491.             if (string2.contains("-")) {
  492.                 string3 = string2.substring(string2.lastIndexOf("-") + 1, string2.length());
  493.             }
  494.         }
  495.         return string3;
  496.     }
  497.  
  498.     public static String hashPassword(String string2, String string3) {
  499.         if (TextUtils.isEmpty((CharSequence)string2) || TextUtils.isEmpty((CharSequence)string3)) {
  500.             return null;
  501.         }
  502.         MessageDigest messageDigest = MessageDigest.getInstance("SHA-256");
  503.         messageDigest.reset();
  504.         messageDigest.update(string3.getBytes());
  505.         return i.byteArrayToHex(messageDigest.digest(string2.getBytes()));
  506.     }
  507.  
  508.     public static String hashSaltedApiKey(String string2) {
  509.         if (TextUtils.isEmpty((CharSequence)string2)) {
  510.             return null;
  511.         }
  512.         MessageDigest messageDigest = MessageDigest.getInstance("SHA-256");
  513.         messageDigest.reset();
  514.         return i.byteArrayToHex(messageDigest.digest(string2.getBytes()));
  515.     }
  516.  
  517.     public static boolean isAadhaarNumberValid(String string2) {
  518.         if (TextUtils.isEmpty((CharSequence)string2)) {
  519.             return false;
  520.         }
  521.         return j.validateVerhoeff(string2);
  522.     }
  523.  
  524.     /*
  525.      * Enabled aggressive block sorting
  526.      */
  527.     public static boolean isEnrolmentNumberValid(String string2) {
  528.         if (TextUtils.isEmpty((CharSequence)string2) || string2.length() != 14) {
  529.             return false;
  530.         }
  531.         return true;
  532.     }
  533.  
  534.     /*
  535.      * Enabled aggressive block sorting
  536.      */
  537.     public static boolean isPhoneNumberValid(String string2) {
  538.         if (TextUtils.isEmpty((CharSequence)string2) || string2.length() != 10) {
  539.             return false;
  540.         }
  541.         return true;
  542.     }
  543.  
  544.     /*
  545.      * Enabled aggressive block sorting
  546.      */
  547.     public static boolean isPinCodeNumberValid(String string2) {
  548.         if (TextUtils.isEmpty((CharSequence)string2) || string2.length() != 6) {
  549.             return false;
  550.         }
  551.         return true;
  552.     }
  553.  
  554.     public static boolean isValidEmailAddress(String string2) {
  555.         return Pattern.compile("^[_A-Za-z0-9-\\+]+(\\.[_A-Za-z0-9-]+)*@[A-Za-z0-9-]+(\\.[A-Za-z0-9]+)*(\\.[A-Za-z]{2,})$").matcher(string2).matches();
  556.     }
  557.  
  558.     public static boolean isValidOTP(String string2) {
  559.         Context context = BaseApplication.getApplication().getApplicationContext();
  560.         Log.d((String)TAG, (String)("otp is " + string2));
  561.         if (TextUtils.isEmpty((CharSequence)string2) || string2.length() == 0) {
  562.             i.showToastMessage(context.getString(2131296379));
  563.             return false;
  564.         }
  565.         return true;
  566.     }
  567.  
  568.     public static boolean isValidPassword(String string2) {
  569.         return Pattern.compile("(^(?=.*[0-9])(?=.*[a-z])(?=.*[A-Z])(?=.*[@#&%*()!-])(?=\\S+$).{8,}$)").matcher(string2).matches();
  570.     }
  571.  
  572.     public static ResidentProfile parseEKYCData(String string2) {
  573.         ResidentProfile residentProfile = null;
  574.         if (!TextUtils.isEmpty((CharSequence)string2)) {
  575.             string2 = string2.replace("\n", "").replace("\r", "");
  576.             residentProfile = new in.gov.uidai.mAadhaarPlus.g.a().parse(string2);
  577.         }
  578.         return residentProfile;
  579.     }
  580.  
  581.     public static String parseXMLString(String object, String string2) {
  582.         object = Pattern.compile("<" + string2 + ">(.+?)</" + string2 + ">").matcher((CharSequence)object);
  583.         if (object.find()) {
  584.             return object.group(1);
  585.         }
  586.         return null;
  587.     }
  588.  
  589.     public static String readFromAsset(Context object, String arrby) {
  590.         object = object.getAssets();
  591.         try {
  592.             object = object.open((String)arrby);
  593.             arrby = new byte[object.available()];
  594.             object.read(arrby);
  595.             object.close();
  596.             object = new String(arrby).replace("\n", "").replace("\r", "");
  597.             return object;
  598.         }
  599.         catch (IOException iOException) {
  600.             Log.e((String)TAG, (String)("Error:" + iOException.getMessage()));
  601.             Log.getStackTraceString((Throwable)iOException);
  602.             return null;
  603.         }
  604.     }
  605.  
  606.     public static void removeImageFromDirectory() {
  607.         File file = i.getImageStorageFilePath();
  608.         if (file.isDirectory()) {
  609.             String[] arrstring = file.list();
  610.             for (int i2 = 0; i2 < arrstring.length; ++i2) {
  611.                 new File(file, arrstring[i2]).delete();
  612.             }
  613.             Log.d((String)TAG, (String)"delete single file");
  614.         }
  615.     }
  616.  
  617.     public static String returnStringOfLength16(String string2) {
  618.         if (string2.length() == 16) {
  619.             return string2;
  620.         }
  621.         if (string2.length() < 16) {
  622.             int n2 = string2.length();
  623.             String string3 = "";
  624.             for (int i2 = 0; i2 < 16 - n2; ++i2) {
  625.                 string3 = string3 + "#";
  626.             }
  627.             return string2 + string3;
  628.         }
  629.         if (string2.length() > 16) {
  630.             return string2.substring(0, 16);
  631.         }
  632.         return null;
  633.     }
  634.  
  635.     /*
  636.      * Exception decompiling
  637.      */
  638.     public static void saveImageToStorage(Bitmap var0, File var1_11) {
  639.         // This method has failed to decompile.  When submitting a bug report, please provide this stack trace, and (if you hold appropriate legal rights) the relevant class file.
  640.         // org.benf.cfr.reader.util.ConfusedCFRException: Tried to end blocks [11[CATCHBLOCK], 9[CATCHBLOCK]], but top level block is 19[UNCONDITIONALDOLOOP]
  641.         // org.benf.cfr.reader.bytecode.analysis.opgraph.Op04StructuredStatement.processEndingBlocks(Op04StructuredStatement.java:397)
  642.         // org.benf.cfr.reader.bytecode.analysis.opgraph.Op04StructuredStatement.buildNestedBlocks(Op04StructuredStatement.java:449)
  643.         // org.benf.cfr.reader.bytecode.analysis.opgraph.Op03SimpleStatement.createInitialStructuredBlock(Op03SimpleStatement.java:2877)
  644.         // org.benf.cfr.reader.bytecode.CodeAnalyser.getAnalysisInner(CodeAnalyser.java:825)
  645.         // org.benf.cfr.reader.bytecode.CodeAnalyser.getAnalysisOrWrapFail(CodeAnalyser.java:217)
  646.         // org.benf.cfr.reader.bytecode.CodeAnalyser.getAnalysis(CodeAnalyser.java:162)
  647.         // org.benf.cfr.reader.entities.attributes.AttributeCode.analyse(AttributeCode.java:95)
  648.         // org.benf.cfr.reader.entities.Method.analyse(Method.java:355)
  649.         // org.benf.cfr.reader.entities.ClassFile.analyseMid(ClassFile.java:769)
  650.         // org.benf.cfr.reader.entities.ClassFile.analyseTop(ClassFile.java:701)
  651.         // org.benf.cfr.reader.Main.doJar(Main.java:134)
  652.         // org.benf.cfr.reader.Main.main(Main.java:189)
  653.         throw new IllegalStateException("Decompilation failed");
  654.     }
  655.  
  656.     public static void setStringToEditText(EditText editText, String string2) {
  657.         if (!TextUtils.isEmpty((CharSequence)string2) && !string2.equalsIgnoreCase("null")) {
  658.             editText.setText((CharSequence)string2.trim());
  659.             return;
  660.         }
  661.         editText.setText((CharSequence)"");
  662.     }
  663.  
  664.     public static void setStringToTextView(TextView textView, String string2) {
  665.         if (!TextUtils.isEmpty((CharSequence)string2) && !string2.equalsIgnoreCase("null")) {
  666.             textView.setText((CharSequence)string2.trim());
  667.             return;
  668.         }
  669.         textView.setText((CharSequence)"");
  670.     }
  671.  
  672.     public static void shareApp(Context context) {
  673.         Intent intent = new Intent("android.intent.action.SEND");
  674.         intent.setType("text/plain");
  675.         intent.putExtra("android.intent.extra.SUBJECT", "mAadhaar");
  676.         intent.putExtra("android.intent.extra.TEXT", "Hi, did you try the latest app from UIDAI - m-Aadhaar? It offers you to carry Aadhaar eKYC details in your mobile which you can even share with others. To download, please click https://goo.gl/6voUxj");
  677.         context.startActivity(Intent.createChooser((Intent)intent, (CharSequence)"mAadhaar"));
  678.     }
  679.  
  680.     public static void shareEKYCData(Context context, Uri uri) {
  681.         Intent intent = new Intent("android.intent.action.SEND");
  682.         if (uri != null) {
  683.             intent.setDataAndType(uri, BaseApplication.getApplication().getContentResolver().getType(uri));
  684.         }
  685.         intent.setType("application/zip");
  686.         intent.putExtra("android.intent.extra.STREAM", (Parcelable)uri);
  687.         context.startActivity(Intent.createChooser((Intent)intent, (CharSequence)"Share e-KYC"));
  688.     }
  689.  
  690.     public static void shareQRCode(Context context, Uri uri) {
  691.         Intent intent = new Intent("android.intent.action.SEND");
  692.         if (uri != null) {
  693.             intent.setDataAndType(uri, BaseApplication.getApplication().getContentResolver().getType(uri));
  694.         }
  695.         intent.setType("image/jpeg");
  696.         intent.putExtra("android.intent.extra.STREAM", (Parcelable)uri);
  697.         context.startActivity(Intent.createChooser((Intent)intent, (CharSequence)"Share QRcode"));
  698.     }
  699.  
  700.     public static void showAlertWithOk(Context context, String string2, String string3) {
  701.         i.showToastMessage(string2, string3);
  702.     }
  703.  
  704.     public static c showCustomAlertDialog(Context context, String string2, final a a2) {
  705.         c.a a3 = new c.a(context);
  706.         a3.setCancelable(false);
  707.         View view = ((LayoutInflater)context.getSystemService("layout_inflater")).inflate(2130968630, null);
  708.         a3.setView(view);
  709.         ((TextView)view.findViewById(2131689646)).setText((CharSequence)string2);
  710.         ((Button)view.findViewById(2131689647)).setOnClickListener(new View.OnClickListener(){
  711.  
  712.             public void onClick(View view) {
  713.                 a2.onPosButtonPressed(this, null);
  714.             }
  715.         });
  716.         if (!((Activity)context).isFinishing()) {
  717.             return a3.show();
  718.         }
  719.         return null;
  720.     }
  721.  
  722.     /*
  723.      * Enabled aggressive block sorting
  724.      */
  725.     public static c showDisclaimerDialog(Context context, final a a2, boolean bl2) {
  726.         c.a a3 = new c.a(context);
  727.         a3.setCancelable(false);
  728.         View view = ((LayoutInflater)context.getSystemService("layout_inflater")).inflate(2130968632, null);
  729.         a3.setView(view);
  730.         Button button = (Button)view.findViewById(2131689647);
  731.         view = (TextView)view.findViewById(2131689646);
  732.         if (bl2) {
  733.             view.setText(2131296512);
  734.         } else {
  735.             view.setText(2131296511);
  736.         }
  737.         button.setOnClickListener(new View.OnClickListener(){
  738.  
  739.             public void onClick(View view) {
  740.                 a2.onPosButtonPressed(this, "");
  741.             }
  742.         });
  743.         if (!((Activity)context).isFinishing()) {
  744.             return a3.show();
  745.         }
  746.         return null;
  747.     }
  748.  
  749.     /*
  750.      * Enabled aggressive block sorting
  751.      */
  752.     public static c showEnterOtpDialog(final Context context, final a a2) {
  753.         c.a a3 = new c.a(context);
  754.         a3.setCancelable(false);
  755.         View view = ((LayoutInflater)context.getSystemService("layout_inflater")).inflate(2130968633, null);
  756.         a3.setView(view);
  757.         otpEditText = (EditText)view.findViewById(2131689650);
  758.         if (f.buildType_Q || f.buildType_U) {
  759.             otpEditText.setEnabled(true);
  760.         } else {
  761.             otpEditText.setEnabled(false);
  762.         }
  763.         Button button = (Button)view.findViewById(2131689649);
  764.         ((Button)view.findViewById(2131689647)).setOnClickListener(new View.OnClickListener(){
  765.  
  766.             public void onClick(View view) {
  767.                 if (TextUtils.isEmpty((CharSequence)i.otpEditText.getText().toString()) || i.otpEditText.getText().toString().length() == 0) {
  768.                     i.showToastMessage(context.getString(2131296507));
  769.                     return;
  770.                 }
  771.                 a2.onPosButtonPressed(this, i.otpEditText.getText().toString());
  772.             }
  773.         });
  774.         button.setOnClickListener(new View.OnClickListener(){
  775.  
  776.             public void onClick(View view) {
  777.                 a2.onNegButtonPressed(this);
  778.             }
  779.         });
  780.         if (!((Activity)context).isFinishing()) {
  781.             return a3.show();
  782.         }
  783.         return null;
  784.     }
  785.  
  786.     public static void showGuidlines(Context context, String string2, String string3) {
  787.         Intent intent = new Intent(context, WebViewActivity.class);
  788.         intent.putExtra("URL", string2);
  789.         intent.putExtra("bundle_key_title", string3);
  790.         intent.putExtra("calledFrom", "HA");
  791.         context.startActivity(intent);
  792.     }
  793.  
  794.     public static void showHelp(Context context, String string2, String string3) {
  795.         Intent intent = new Intent(context, WebViewActivity.class);
  796.         intent.putExtra("URL", string2);
  797.         intent.putExtra("bundle_key_title", string3);
  798.         intent.putExtra("calledFrom", "O");
  799.         context.startActivity(intent);
  800.     }
  801.  
  802.     public static c showPasswordDialog(Context context, a a2) {
  803.         return i.showPasswordDialog(null, context, a2);
  804.     }
  805.  
  806.     public static c showPasswordDialog(String string2, Context context, a a2) {
  807.         return i.showPasswordDialog(string2, context, a2, null, null);
  808.     }
  809.  
  810.     public static c showPasswordDialog(String string2, Context context, final a a2, String string3, String string4) {
  811.         c.a a3 = new c.a(context);
  812.         View view = ((LayoutInflater)context.getSystemService("layout_inflater")).inflate(2130968634, null);
  813.         a3.setView(view);
  814.         TextView textView = (TextView)view.findViewById(2131689570);
  815.         if (!TextUtils.isEmpty((CharSequence)string2)) {
  816.             textView.setText((CharSequence)string2);
  817.         }
  818.         string2 = (EditText)view.findViewById(2131689651);
  819.         textView = (Button)view.findViewById(2131689649);
  820.         Button button = (Button)view.findViewById(2131689647);
  821.         ((CheckBox)view.findViewById(2131689652)).setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener((EditText)string2){
  822.             final /* synthetic */ EditText val$editText;
  823.  
  824.             public void onCheckedChanged(CompoundButton compoundButton, boolean bl2) {
  825.                 if (!bl2) {
  826.                     int n2 = this.val$editText.getSelectionStart();
  827.                     int n3 = this.val$editText.getSelectionEnd();
  828.                     this.val$editText.setTransformationMethod((TransformationMethod)new PasswordTransformationMethod());
  829.                     this.val$editText.setSelection(n2, n3);
  830.                     return;
  831.                 }
  832.                 int n4 = this.val$editText.getSelectionStart();
  833.                 int n5 = this.val$editText.getSelectionEnd();
  834.                 this.val$editText.setTransformationMethod((TransformationMethod)new HideReturnsTransformationMethod());
  835.                 this.val$editText.setSelection(n4, n5);
  836.             }
  837.         });
  838.         if (!TextUtils.isEmpty((CharSequence)string3)) {
  839.             button.setText((CharSequence)string3);
  840.         }
  841.         if (!TextUtils.isEmpty((CharSequence)string4)) {
  842.             textView.setText((CharSequence)string4);
  843.         }
  844.         button.setOnClickListener(new View.OnClickListener((EditText)string2){
  845.             final /* synthetic */ EditText val$editText;
  846.  
  847.             public void onClick(View view) {
  848.                 a2.onPosButtonPressed(this, this.val$editText.getText().toString());
  849.             }
  850.         });
  851.         textView.setOnClickListener(new View.OnClickListener(){
  852.  
  853.             public void onClick(View view) {
  854.                 a2.onNegButtonPressed(this);
  855.             }
  856.         });
  857.         a3.setCancelable(false);
  858.         if (!((Activity)context).isFinishing()) {
  859.             return a3.show();
  860.         }
  861.         return null;
  862.     }
  863.  
  864.     public static void showToastMessage(String string2) {
  865.         i.showToastMessage(null, string2);
  866.     }
  867.  
  868.     public static void showToastMessage(String string2, String string3) {
  869.         Context context = BaseApplication.getApplication().getApplicationContext();
  870.         String string4 = string2;
  871.         if (TextUtils.isEmpty((CharSequence)string2)) {
  872.             string4 = context.getString(2131296428);
  873.         }
  874.         string2 = ((LayoutInflater)context.getSystemService("layout_inflater")).inflate(2130968677, null, false);
  875.         ((TextView)string2.findViewById(2131689757)).setText((CharSequence)string4);
  876.         ((TextView)string2.findViewById(2131689758)).setText((CharSequence)string3);
  877.         string3 = new Toast(context);
  878.         string3.setGravity(55, 0, 0);
  879.         string3.setDuration(1);
  880.         string3.setView((View)string2);
  881.         string3.show();
  882.     }
  883.  
  884.     public static void startBioLockTimer(String string2, boolean bl2, boolean bl3) {
  885.         Log.i((String)TAG, (String)("isCountDownTimerRunning::" + String.valueOf(b.getInstance().isCountDownTimerRunning(string2))));
  886.         if (b.getInstance().isCountDownTimerRunning(string2)) {
  887.             return;
  888.         }
  889.         try {
  890.             b.getInstance().setCountDownTimer(string2, "" + System.currentTimeMillis());
  891.             Log.i((String)TAG, (String)("isRemainingTimer::" + bl2));
  892.             BaseApplication baseApplication = BaseApplication.getApplication();
  893.             Intent intent = new Intent((Context)baseApplication, CountDownService.class);
  894.             intent.putExtra("bundle_key_uid", string2);
  895.             intent.putExtra("bundle_key_remaining_timer", bl2);
  896.             baseApplication.startService(intent);
  897.             return;
  898.         }
  899.         catch (Exception exception) {
  900.             exception.printStackTrace();
  901.             Log.e((String)TAG, (String)(exception.getMessage() + exception.toString()));
  902.             return;
  903.         }
  904.     }
  905.  
  906.     public static void startLogOffTimer(int n2) {
  907.         LOGOUT_TIMER = new CountDownTimer(n2, 1000){
  908.  
  909.             public void onFinish() {
  910.                 i.LOGOUT_TIMER_ON = false;
  911.             }
  912.  
  913.             public void onTick(long l2) {
  914.                 i.LOGOUT_TIMER_ON = true;
  915.                 Log.d((String)"UID", (String)("Time remaining" + l2 / 60000));
  916.             }
  917.         }.start();
  918.     }
  919.  
  920.     public static void stopBioLockTimer(String string2) {
  921.         BaseApplication baseApplication = BaseApplication.getApplication();
  922.         Intent intent = new Intent("broad_cast_action_count_down_timer");
  923.         intent.putExtra("bundle_key_uid", string2);
  924.         intent.putExtra("bundle_key_count_down_timer", -1);
  925.         l.getInstance((Context)baseApplication).sendBroadcast(intent);
  926.         intent = new Intent((Context)baseApplication, CountDownService.class);
  927.         intent.putExtra("bundle_key_uid", string2);
  928.         baseApplication.stopService(intent);
  929.         b.getInstance().removeCountDownTimer(string2);
  930.     }
  931.  
  932.     /*
  933.      * Enabled aggressive block sorting
  934.      */
  935.     public static String stringSplitter(String object, String arrstring, int n2) {
  936.         object = arrstring == null ? new StringTokenizer((String)object) : new StringTokenizer((String)object, (String)arrstring);
  937.         arrstring = new String[object.countTokens()];
  938.         int n3 = 0;
  939.         while (object.hasMoreTokens()) {
  940.             arrstring[n3] = object.nextToken();
  941.             ++n3;
  942.         }
  943.         return arrstring[n2];
  944.     }
  945.  
  946. }
Add Comment
Please, Sign In to add comment