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
@@ -28,27 +28,27 @@ protected void onCreate(Bundle savedInstanceState) {
2828
2929 actionBar .setTitle ("Settings" );
3030
31- btnSaveRarPwd = (Button )findViewById (R .id .btnSaveRarPwd );
32- etRarPassword = (EditText )findViewById (R .id .rarPassword );
33- btnDefaultRarPassword = (Button ) findViewById (R .id .btnDefaultRarPassword );
31+ btnSaveZipPwd = (Button )findViewById (R .id .btnSaveZipPwd );
32+ etZipPassword = (EditText )findViewById (R .id .zipPassword );
33+ btnDefaultZipPassword = (Button ) findViewById (R .id .btnDefaultZipPassword );
3434
35- btnSaveRarPwd .setOnClickListener (view -> {
36- if (etRarPassword .getText ().length () == 0 ){
37- ShowDialog ("Rar password required" );
35+ btnSaveZipPwd .setOnClickListener (view -> {
36+ if (etZipPassword .getText ().length () == 0 ){
37+ ShowDialog ("Zip password required" );
3838 }
3939 else {
40- password = etRarPassword .getText ().toString ();
41- saveRarPassword (password );
40+ password = etZipPassword .getText ().toString ();
41+ saveZipPassword (password );
4242 ShowDialog ("Password has been changed" );
43- etRarPassword .setText ("" );
43+ etZipPassword .setText ("" );
4444 }
4545
4646 });
4747
48- btnDefaultRarPassword .setOnClickListener (view -> {
49- password = global .getDefaultRarPassword ();
50- saveRarPassword (password );
51- ShowDialog ("Password has been changed to the default rar password" );
48+ btnDefaultZipPassword .setOnClickListener (view -> {
49+ password = global .getDefaultZipPassword ();
50+ saveZipPassword (password );
51+ ShowDialog ("Password has been changed to the default zip password" );
5252 });
5353
5454 }
@@ -66,7 +66,7 @@ private SecretKeySpec generateKey(String encPassword) throws Exception {
6666 return secretKeySpec ;
6767 }
6868
69- public String encryptRarPwd (String dataToEncrypt , String encPassword ) throws Exception {
69+ public String encryptZipPwd (String dataToEncrypt , String encPassword ) throws Exception {
7070 SecretKeySpec key = generateKey (encPassword );
7171 Cipher c = Cipher .getInstance ("AES" );
7272 c .init (Cipher .ENCRYPT_MODE , key );
@@ -75,7 +75,7 @@ public String encryptRarPwd(String dataToEncrypt, String encPassword) throws Exc
7575 return encryptedValue ;
7676 }
7777
78- public String decryptRarPwd (String dataToDecrypt , String decPassword ) throws Exception {
78+ public String decryptZipPwd (String dataToDecrypt , String decPassword ) throws Exception {
7979 SecretKeySpec key = generateKey (decPassword );
8080 Cipher c = Cipher .getInstance ("AES" );
8181 c .init (Cipher .DECRYPT_MODE , key );
@@ -95,15 +95,15 @@ public String generateSalt(){
9595 return encodedSalt ;
9696 }
9797
98- public void saveRarPassword (String password ){
98+ public void saveZipPassword (String password ){
9999 try {
100100 SharedPreferences sharedPreferences = global .getDefaultSharedPreferences ();
101101 SharedPreferences .Editor editor = sharedPreferences .edit ();
102102 salt = generateSalt ();
103103 String trimSalt = salt .trim ();
104- String encryptedPassword = encryptRarPwd (password , trimSalt );
104+ String encryptedPassword = encryptZipPwd (password , trimSalt );
105105 String trimEncryptedPassword = encryptedPassword .trim ();
106- editor .putString ("rarPwd " , trimEncryptedPassword );
106+ editor .putString ("zipPwd " , trimEncryptedPassword );
107107 editor .putString ("salt" , trimSalt );
108108 editor .apply ();
109109 }
0 commit comments