1616
1717public class SettingsActivity extends ImisActivity {
1818
19- Button btnSaveRarPwd , btnDefaultRarPassword ;
20- EditText etRarPassword ;
19+ Button btnSaveZipPwd , btnDefaultZipPassword ;
20+ EditText etZipPassword ;
2121 private String salt , password ;
2222 public static String generatedSalt ;
2323 Global global ;
@@ -29,27 +29,27 @@ protected void onCreate(Bundle savedInstanceState) {
2929
3030 actionBar .setTitle ("Settings" );
3131
32- btnSaveRarPwd = (Button )findViewById (R .id .btnSaveRarPwd );
33- etRarPassword = (EditText )findViewById (R .id .rarPassword );
34- btnDefaultRarPassword = (Button ) findViewById (R .id .btnDefaultRarPassword );
32+ btnSaveZipPwd = (Button )findViewById (R .id .btnSaveZipPwd );
33+ etZipPassword = (EditText )findViewById (R .id .zipPassword );
34+ btnDefaultZipPassword = (Button ) findViewById (R .id .btnDefaultZipPassword );
3535
36- btnSaveRarPwd .setOnClickListener (view -> {
37- if (etRarPassword .getText ().length () == 0 ){
38- ShowDialog ("Rar password required" );
36+ btnSaveZipPwd .setOnClickListener (view -> {
37+ if (etZipPassword .getText ().length () == 0 ){
38+ ShowDialog ("Zip password required" );
3939 }
4040 else {
41- password = etRarPassword .getText ().toString ();
42- saveRarPassword (password );
41+ password = etZipPassword .getText ().toString ();
42+ saveZipPassword (password );
4343 ShowDialog ("Password has been changed" );
44- etRarPassword .setText ("" );
44+ etZipPassword .setText ("" );
4545 }
4646
4747 });
4848
49- btnDefaultRarPassword .setOnClickListener (view -> {
50- password = global .getDefaultRarPassword ();
51- saveRarPassword (password );
52- ShowDialog ("Password has been changed to the default rar password" );
49+ btnDefaultZipPassword .setOnClickListener (view -> {
50+ password = global .getDefaultZipPassword ();
51+ saveZipPassword (password );
52+ ShowDialog ("Password has been changed to the default zip password" );
5353 });
5454
5555 }
@@ -67,7 +67,7 @@ private SecretKeySpec generateKey(String encPassword) throws Exception {
6767 return secretKeySpec ;
6868 }
6969
70- public String encryptRarPwd (String dataToEncrypt , String encPassword ) throws Exception {
70+ public String encryptZipPwd (String dataToEncrypt , String encPassword ) throws Exception {
7171 SecretKeySpec key = generateKey (encPassword );
7272 Cipher c = Cipher .getInstance ("AES" );
7373 c .init (Cipher .ENCRYPT_MODE , key );
@@ -76,7 +76,7 @@ public String encryptRarPwd(String dataToEncrypt, String encPassword) throws Exc
7676 return encryptedValue ;
7777 }
7878
79- public String decryptRarPwd (String dataToDecrypt , String decPassword ) throws Exception {
79+ public String decryptZipPwd (String dataToDecrypt , String decPassword ) throws Exception {
8080 SecretKeySpec key = generateKey (decPassword );
8181 Cipher c = Cipher .getInstance ("AES" );
8282 c .init (Cipher .DECRYPT_MODE , key );
@@ -96,15 +96,15 @@ public String generateSalt(){
9696 return encodedSalt ;
9797 }
9898
99- public void saveRarPassword (String password ){
99+ public void saveZipPassword (String password ){
100100 try {
101101 SharedPreferences sharedPreferences = global .getDefaultSharedPreferences ();
102102 SharedPreferences .Editor editor = sharedPreferences .edit ();
103103 salt = generateSalt ();
104104 String trimSalt = salt .trim ();
105- String encryptedPassword = encryptRarPwd (password , trimSalt );
105+ String encryptedPassword = encryptZipPwd (password , trimSalt );
106106 String trimEncryptedPassword = encryptedPassword .trim ();
107- editor .putString ("rarPwd " , trimEncryptedPassword );
107+ editor .putString ("zipPwd " , trimEncryptedPassword );
108108 editor .putString ("salt" , trimSalt );
109109 editor .apply ();
110110 }
0 commit comments