├── .gitignore ├── .idea ├── codeStyles │ └── Project.xml ├── compiler.xml ├── copyright │ └── profiles_settings.xml ├── encodings.xml ├── gradle.xml ├── runConfigurations.xml └── vcs.xml ├── LICENSE ├── README.md ├── android-sample-app ├── .gitignore ├── build.gradle ├── proguard-rules.pro ├── signing_confs │ └── sample_conf.gradle └── src │ ├── androidTest │ └── java │ │ └── com │ │ └── mobapphome │ │ └── simpleencryptorlib │ │ └── ApplicationTest.java │ ├── main │ ├── AndroidManifest.xml │ ├── java │ │ └── com │ │ │ └── mobapphome │ │ │ └── simpleencryptorlib │ │ │ └── sample │ │ │ ├── SampleActivityJava.java │ │ │ └── SampleActivityKotlin.kt │ └── res │ │ ├── drawable-hdpi │ │ ├── ic_keyboard_arrow_down_black_24dp.png │ │ └── ic_keyboard_arrow_up_black_24dp.png │ │ ├── drawable-mdpi │ │ ├── ic_arrow_downward_black_48dp.png │ │ ├── ic_arrow_upward_black_48dp.png │ │ ├── ic_keyboard_arrow_down_black_24dp.png │ │ └── ic_keyboard_arrow_up_black_24dp.png │ │ ├── drawable-xhdpi │ │ ├── ic_arrow_downward_black_48dp.png │ │ ├── ic_arrow_upward_black_48dp.png │ │ ├── ic_keyboard_arrow_down_black_24dp.png │ │ └── ic_keyboard_arrow_up_black_24dp.png │ │ ├── drawable-xxhdpi │ │ ├── ic_arrow_downward_black_48dp.png │ │ ├── ic_arrow_upward_black_48dp.png │ │ ├── ic_keyboard_arrow_down_black_24dp.png │ │ └── ic_keyboard_arrow_up_black_24dp.png │ │ ├── drawable-xxxhdpi │ │ ├── ic_arrow_downward_black_48dp.png │ │ ├── ic_arrow_upward_black_48dp.png │ │ ├── ic_keyboard_arrow_down_black_24dp.png │ │ └── ic_keyboard_arrow_up_black_24dp.png │ │ ├── drawable │ │ └── forkme_green.png │ │ ├── layout │ │ └── activity_main.xml │ │ ├── mipmap-hdpi │ │ └── ic_launcher.png │ │ ├── mipmap-mdpi │ │ └── ic_launcher.png │ │ ├── mipmap-xhdpi │ │ └── ic_launcher.png │ │ ├── mipmap-xxhdpi │ │ └── ic_launcher.png │ │ ├── mipmap-xxxhdpi │ │ └── ic_launcher.png │ │ ├── values-w820dp │ │ └── dimens.xml │ │ └── values │ │ ├── colors.xml │ │ ├── dimens.xml │ │ ├── strings.xml │ │ └── styles.xml │ └── test │ └── java │ └── com │ └── mobapphome │ └── simpleencryptorlib │ └── ExampleUnitTest.java ├── build.gradle ├── gradle.properties ├── gradle └── wrapper │ ├── gradle-wrapper.jar │ └── gradle-wrapper.properties ├── gradlew ├── gradlew.bat ├── imgs ├── google-play-badge.png ├── green_star.png ├── img_create │ ├── ic_launcher │ │ ├── res │ │ │ ├── mipmap-hdpi │ │ │ │ └── ic_launcher.png │ │ │ ├── mipmap-mdpi │ │ │ │ └── ic_launcher.png │ │ │ ├── mipmap-xhdpi │ │ │ │ └── ic_launcher.png │ │ │ ├── mipmap-xxhdpi │ │ │ │ └── ic_launcher.png │ │ │ └── mipmap-xxxhdpi │ │ │ │ └── ic_launcher.png │ │ └── web_hi_res_512.png │ ├── mah_android_updater_head_img.jpg │ ├── mah_android_updater_head_img.psd │ ├── mah_android_updater_logo.ai │ ├── mah_android_updater_logo.png │ └── screenshots │ │ ├── Screenshot_2016-09-08-17-01-59.png │ │ └── Screenshot_2016-09-08-17-02-03.png ├── mahencryptor_google_play_url_qr_code.jpg ├── main_activity.png ├── main_activity_small.png └── yellow_star.png ├── java-sample-app ├── .gitignore ├── build.gradle └── src │ └── main │ └── java │ └── com │ └── mobapphome │ └── simpleencryptorlib_javasample │ ├── SampleEncryptorJavaSample.java │ └── SampleEncryptorKotlinSample.kt ├── key └── .gitignore ├── projectFilesBackup └── .idea │ └── workspace.xml ├── settings.gradle └── simple-encryptor-lib ├── .gitignore ├── build.gradle ├── conf_for_maven ├── bintrayv1.gradle └── installv1.gradle └── src └── main └── java └── com └── mobapphome └── simpleencryptorlib ├── Base64.java ├── Constants.java └── SimpleEncryptor.java /.gitignore: -------------------------------------------------------------------------------- 1 | *.iml 2 | .gradle 3 | /local.properties 4 | /.idea/workspace.xml 5 | /.idea/libraries 6 | /.idea/misc.xml 7 | /.idea/modules.xml 8 | /.idea/caches 9 | .DS_Store 10 | /build 11 | /captures 12 | 13 | /android-sample-app/signing_confs/conf.gradle 14 | -------------------------------------------------------------------------------- /.idea/codeStyles/Project.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 15 | 16 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | -------------------------------------------------------------------------------- /.idea/compiler.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | -------------------------------------------------------------------------------- /.idea/copyright/profiles_settings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | -------------------------------------------------------------------------------- /.idea/encodings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /.idea/gradle.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 19 | 20 | -------------------------------------------------------------------------------- /.idea/runConfigurations.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 11 | 12 | -------------------------------------------------------------------------------- /.idea/vcs.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Apache License 2 | Version 2.0, January 2004 3 | http://www.apache.org/licenses/ 4 | 5 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 6 | 7 | 1. Definitions. 8 | 9 | "License" shall mean the terms and conditions for use, reproduction, 10 | and distribution as defined by Sections 1 through 9 of this document. 11 | 12 | "Licensor" shall mean the copyright owner or entity authorized by 13 | the copyright owner that is granting the License. 14 | 15 | "Legal Entity" shall mean the union of the acting entity and all 16 | other entities that control, are controlled by, or are under common 17 | control with that entity. For the purposes of this definition, 18 | "control" means (i) the power, direct or indirect, to cause the 19 | direction or management of such entity, whether by contract or 20 | otherwise, or (ii) ownership of fifty percent (50%) or more of the 21 | outstanding shares, or (iii) beneficial ownership of such entity. 22 | 23 | "You" (or "Your") shall mean an individual or Legal Entity 24 | exercising permissions granted by this License. 25 | 26 | "Source" form shall mean the preferred form for making modifications, 27 | including but not limited to software source code, documentation 28 | source, and configuration files. 29 | 30 | "Object" form shall mean any form resulting from mechanical 31 | transformation or translation of a Source form, including but 32 | not limited to compiled object code, generated documentation, 33 | and conversions to other media types. 34 | 35 | "Work" shall mean the work of authorship, whether in Source or 36 | Object form, made available under the License, as indicated by a 37 | copyright notice that is included in or attached to the work 38 | (an example is provided in the Appendix below). 39 | 40 | "Derivative Works" shall mean any work, whether in Source or Object 41 | form, that is based on (or derived from) the Work and for which the 42 | editorial revisions, annotations, elaborations, or other modifications 43 | represent, as a whole, an original work of authorship. For the purposes 44 | of this License, Derivative Works shall not include works that remain 45 | separable from, or merely link (or bind by name) to the interfaces of, 46 | the Work and Derivative Works thereof. 47 | 48 | "Contribution" shall mean any work of authorship, including 49 | the original version of the Work and any modifications or additions 50 | to that Work or Derivative Works thereof, that is intentionally 51 | submitted to Licensor for inclusion in the Work by the copyright owner 52 | or by an individual or Legal Entity authorized to submit on behalf of 53 | the copyright owner. For the purposes of this definition, "submitted" 54 | means any form of electronic, verbal, or written communication sent 55 | to the Licensor or its representatives, including but not limited to 56 | communication on electronic mailing lists, source code control systems, 57 | and issue tracking systems that are managed by, or on behalf of, the 58 | Licensor for the purpose of discussing and improving the Work, but 59 | excluding communication that is conspicuously marked or otherwise 60 | designated in writing by the copyright owner as "Not a Contribution." 61 | 62 | "Contributor" shall mean Licensor and any individual or Legal Entity 63 | on behalf of whom a Contribution has been received by Licensor and 64 | subsequently incorporated within the Work. 65 | 66 | 2. Grant of Copyright License. Subject to the terms and conditions of 67 | this License, each Contributor hereby grants to You a perpetual, 68 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 69 | copyright license to reproduce, prepare Derivative Works of, 70 | publicly display, publicly perform, sublicense, and distribute the 71 | Work and such Derivative Works in Source or Object form. 72 | 73 | 3. Grant of Patent License. Subject to the terms and conditions of 74 | this License, each Contributor hereby grants to You a perpetual, 75 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 76 | (except as stated in this section) patent license to make, have made, 77 | use, offer to sell, sell, import, and otherwise transfer the Work, 78 | where such license applies only to those patent claims licensable 79 | by such Contributor that are necessarily infringed by their 80 | Contribution(s) alone or by combination of their Contribution(s) 81 | with the Work to which such Contribution(s) was submitted. If You 82 | institute patent litigation against any entity (including a 83 | cross-claim or counterclaim in a lawsuit) alleging that the Work 84 | or a Contribution incorporated within the Work constitutes direct 85 | or contributory patent infringement, then any patent licenses 86 | granted to You under this License for that Work shall terminate 87 | as of the date such litigation is filed. 88 | 89 | 4. Redistribution. You may reproduce and distribute copies of the 90 | Work or Derivative Works thereof in any medium, with or without 91 | modifications, and in Source or Object form, provided that You 92 | meet the following conditions: 93 | 94 | (a) You must give any other recipients of the Work or 95 | Derivative Works a copy of this License; and 96 | 97 | (b) You must cause any modified files to carry prominent notices 98 | stating that You changed the files; and 99 | 100 | (c) You must retain, in the Source form of any Derivative Works 101 | that You distribute, all copyright, patent, trademark, and 102 | attribution notices from the Source form of the Work, 103 | excluding those notices that do not pertain to any part of 104 | the Derivative Works; and 105 | 106 | (d) If the Work includes a "NOTICE" text file as part of its 107 | distribution, then any Derivative Works that You distribute must 108 | include a readable copy of the attribution notices contained 109 | within such NOTICE file, excluding those notices that do not 110 | pertain to any part of the Derivative Works, in at least one 111 | of the following places: within a NOTICE text file distributed 112 | as part of the Derivative Works; within the Source form or 113 | documentation, if provided along with the Derivative Works; or, 114 | within a display generated by the Derivative Works, if and 115 | wherever such third-party notices normally appear. The contents 116 | of the NOTICE file are for informational purposes only and 117 | do not modify the License. You may add Your own attribution 118 | notices within Derivative Works that You distribute, alongside 119 | or as an addendum to the NOTICE text from the Work, provided 120 | that such additional attribution notices cannot be construed 121 | as modifying the License. 122 | 123 | You may add Your own copyright statement to Your modifications and 124 | may provide additional or different license terms and conditions 125 | for use, reproduction, or distribution of Your modifications, or 126 | for any such Derivative Works as a whole, provided Your use, 127 | reproduction, and distribution of the Work otherwise complies with 128 | the conditions stated in this License. 129 | 130 | 5. Submission of Contributions. Unless You explicitly state otherwise, 131 | any Contribution intentionally submitted for inclusion in the Work 132 | by You to the Licensor shall be under the terms and conditions of 133 | this License, without any additional terms or conditions. 134 | Notwithstanding the above, nothing herein shall supersede or modify 135 | the terms of any separate license agreement you may have executed 136 | with Licensor regarding such Contributions. 137 | 138 | 6. Trademarks. This License does not grant permission to use the trade 139 | names, trademarks, service marks, or product names of the Licensor, 140 | except as required for reasonable and customary use in describing the 141 | origin of the Work and reproducing the content of the NOTICE file. 142 | 143 | 7. Disclaimer of Warranty. Unless required by applicable law or 144 | agreed to in writing, Licensor provides the Work (and each 145 | Contributor provides its Contributions) on an "AS IS" BASIS, 146 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 147 | implied, including, without limitation, any warranties or conditions 148 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A 149 | PARTICULAR PURPOSE. You are solely responsible for determining the 150 | appropriateness of using or redistributing the Work and assume any 151 | risks associated with Your exercise of permissions under this License. 152 | 153 | 8. Limitation of Liability. In no event and under no legal theory, 154 | whether in tort (including negligence), contract, or otherwise, 155 | unless required by applicable law (such as deliberate and grossly 156 | negligent acts) or agreed to in writing, shall any Contributor be 157 | liable to You for damages, including any direct, indirect, special, 158 | incidental, or consequential damages of any character arising as a 159 | result of this License or out of the use or inability to use the 160 | Work (including but not limited to damages for loss of goodwill, 161 | work stoppage, computer failure or malfunction, or any and all 162 | other commercial damages or losses), even if such Contributor 163 | has been advised of the possibility of such damages. 164 | 165 | 9. Accepting Warranty or Additional Liability. While redistributing 166 | the Work or Derivative Works thereof, You may choose to offer, 167 | and charge a fee for, acceptance of support, warranty, indemnity, 168 | or other liability obligations and/or rights consistent with this 169 | License. However, in accepting such obligations, You may act only 170 | on Your own behalf and on Your sole responsibility, not on behalf 171 | of any other Contributor, and only if You agree to indemnify, 172 | defend, and hold each Contributor harmless for any liability 173 | incurred by, or claims asserted against, such Contributor by reason 174 | of your accepting any such warranty or additional liability. 175 | 176 | END OF TERMS AND CONDITIONS 177 | 178 | APPENDIX: How to apply the Apache License to your work. 179 | 180 | To apply the Apache License to your work, attach the following 181 | boilerplate notice, with the fields enclosed by brackets "{}" 182 | replaced with your own identifying information. (Don't include 183 | the brackets!) The text should be enclosed in the appropriate 184 | comment syntax for the file format. We also recommend that a 185 | file or class name and description of purpose be included on the 186 | same "printed page" as the copyright notice for easier 187 | identification within third-party archives. 188 | 189 | Copyright {yyyy} {name of copyright owner} 190 | 191 | Licensed under the Apache License, Version 2.0 (the "License"); 192 | you may not use this file except in compliance with the License. 193 | You may obtain a copy of the License at 194 | 195 | http://www.apache.org/licenses/LICENSE-2.0 196 | 197 | Unless required by applicable law or agreed to in writing, software 198 | distributed under the License is distributed on an "AS IS" BASIS, 199 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 200 | See the License for the specific language governing permissions and 201 | limitations under the License. 202 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 |

SimpleEncryptorLib

2 |

Android Library

3 | 4 |

5 | 6 | 7 | 8 | 9 |

10 | 11 |

Free, open source, third party Android library and PC library for encryption and decryption strings on Android apps and pc Java applications. Library is 100% compatible with Kotlin and Java applications. Contains sample in both Kotlin and Java. Check out the wiki. To support, Buy Me A Coffee

12 | 13 |

14 | 15 |

16 | 18 | 19 | Library for encryption and decryption strings on Android apps and pc Java applications. `Library is 100% compatible with Kotlin and Java applications`. Contains sample in both `Kotlin` and `Java`. Created by Java language in Android Studio. 20 | 21 | Library has build on IDE `Android Studio` and binaries have added to `jcenter()` `maven` repository. 22 |
You can check [jCenter() download statistics](https://bintray.com/hummatli/maven/simple-encryptor-lib#statistics) on this [link](https://bintray.com/hummatli/maven/simple-encryptor-lib#statistics) 23 | 24 | * [jCenter() download statistics](https://bintray.com/hummatli/maven/simple-encryptor-lib#statistics) 25 | 26 | _**Don't forget to star the protect to support us**_ 27 | 28 | ### Problem It Solves 29 | I haven't used special algorithm here, 30 | 31 | There is a problem [(Look here)](https://stackoverflow.com/questions/32935783/java-different-results-when-decoding-base64-string-with-java-util-base64-vs-and) with Base64 class in Android and (Oracle)Java SDK. They have both this class but has some little differences in methods and different packages. 32 | 33 | I have taken Oracle's version and has created this lib. Buy the help of it you can use Oracle's Base64 in Android application. It eases your encryption and decryption process with the same function in Android application and in pure Java application. 34 | 35 | #### Package differences 36 | * `In Oracle's SDK` - **java.util.Base64** 37 | * `In Android SDK` - **android.util.Base64** 38 | * `In this Lib` - **com.mobapphome.simpleencryptorlib.Base64** - This is like Oracle's version but works in Android and in pure Java(Oracle SDK) 39 | 40 | ### Demo App 41 | Download the demo app from this link - Demo App. You can easly test the lib's functionality. 42 | 43 | ### Library structure and sample 44 | Library has `SimpleEncryptor` class. It has three main static methods: 45 | * `SimpleEncryptor.newInstance("key")` 46 | * `SimpleEncryptor.encode("str for encrytion")` 47 | * `SimpleEncryptor.decode("str for decrytion")` 48 | 49 | Look following sample how to use library: 50 | > Encryption in Kotlin: 51 | ```kotlin 52 | val simpleEncryptor = SimpleEncryptor.newInstanceOrRetunNull("Sample SecretKeyPhrase") 53 | val encrypted = simpleEncryptor!!.encodeOrReturnNull("Text to encode") 54 | ``` 55 | > Encryption in Java: 56 | ```java 57 | SimpleEncryptor simpleEncryptor = SimpleEncryptor.newInstance("Sample SecretKeyPhrase"); 58 | String encrypted = simpleEncryptor.encode("Text to encode"); 59 | ``` 60 | 61 | > Decryption in Kotlin: 62 | ```kotlin 63 | val simpleEncryptor = SimpleEncryptor.newInstanceOrRetunNull("Sample SecretKeyPhrase") 64 | val decrypted = simpleEncryptor.decode("Vm1hSLhhDsCMJTyd4A==") 65 | ``` 66 | > Decryption in Java: 67 | ```java 68 | SimpleEncryptor simpleEncryptor = SimpleEncryptor.newInstance("Sample SecretKeyPhrase"); 69 | String decrypted = simpleEncryptor.decode("Vm1hSLhhDsCMJTyd4A=="); 70 | ``` 71 | 72 | ### Installation manual 73 | To import library to you project add following lines to project's `build.gradle` file. The last stable version is `1.1.3` 74 | 75 | ```gradle 76 | repositories { 77 | maven { url 'https://dl.bintray.com/hummatli/maven/' } 78 | } 79 | 80 | dependencies { 81 | compile 'com.mobapphome.library:simple-encryptor-lib:1.1.3' 82 | } 83 | ``` 84 | 85 | 86 | ### End 87 | Thats all. If you have any probelm with setting library please let me know. Write to settarxan@gmail.com. I will help. 88 | 89 | 90 | ### Contribution 91 | * Fork it 92 | * Create your feature branch (git checkout -b my-new-feature) 93 | * Commit your changes (git commit -am 'Added some feature') 94 | * Push to the branch (git push origin my-new-feature) 95 | * Create new Pull Request 96 | * Star it 97 | 98 | 99 | ### Developed By 100 | [Sattar Hummatli](https://www.linkedin.com/in/hummatli) - settarxan@gmail.com 101 | 102 | ### Other libraries by developer 103 | * [![AndroidAppUpdater](https://img.shields.io/badge/GitHUB-AndroidAppUpdater-green.svg)](https://github.com/hummatli/AndroidAppUpdater) - Android update checker library. Library for notifing update information to installed android apps on android device. 104 | * [![AppCrossPromoter](https://img.shields.io/badge/GitHUB-AppCrossPromoter-green.svg)](https://github.com/hummatli/AppCrossPromoter) - Library for advertisement own apps through your other apps. 105 | 106 | ### License 107 | Copyright 2017 - Sattar Hummatli 108 | 109 | Licensed under the Apache License, Version 2.0 (the "License"); 110 | you may not use this file except in compliance with the License. 111 | You may obtain a copy of the License at 112 | 113 | http://www.apache.org/licenses/LICENSE-2.0 114 | 115 | Unless required by applicable law or agreed to in writing, software 116 | distributed under the License is distributed on an "AS IS" BASIS, 117 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 118 | See the License for the specific language governing permissions and 119 | limitations under the License. 120 | -------------------------------------------------------------------------------- /android-sample-app/.gitignore: -------------------------------------------------------------------------------- 1 | /build 2 | -------------------------------------------------------------------------------- /android-sample-app/build.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: 'com.android.application' 2 | apply plugin: 'kotlin-android' 3 | apply plugin: 'kotlin-android-extensions' 4 | apply from: 'signing_confs/conf.gradle' 5 | 6 | 7 | android { 8 | compileSdkVersion 28 9 | 10 | defaultConfig { 11 | applicationId "com.mobapphome.mahencryptorlib" 12 | minSdkVersion 16 13 | targetSdkVersion 28 14 | versionCode 6 15 | versionName "1.3.0" 16 | } 17 | 18 | buildTypes { 19 | release { 20 | minifyEnabled true 21 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' 22 | signingConfig signingConfigs.defaultSigningConf 23 | } 24 | 25 | debug { 26 | minifyEnabled false 27 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' 28 | signingConfig signingConfigs.defaultSigningConf 29 | } 30 | } 31 | 32 | } 33 | 34 | dependencies { 35 | implementation fileTree(include: ['*.jar'], dir: 'libs') 36 | testImplementation 'junit:junit:4.12' 37 | implementation 'com.android.support:appcompat-v7:28.0.0' 38 | implementation project(':simple-encryptor-lib') 39 | implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version" 40 | } 41 | repositories { 42 | mavenCentral() 43 | } 44 | -------------------------------------------------------------------------------- /android-sample-app/proguard-rules.pro: -------------------------------------------------------------------------------- 1 | # Add project specific ProGuard rules here. 2 | # By default, the flags in this file are appended to flags specified 3 | # in /Volumes/Disk_2/softs/Android/AndroidSDK/sdk/tools/proguard/proguard-android.txt 4 | # You can edit the include path and order by changing the proguardFiles 5 | # directive in build.gradle. 6 | # 7 | # For more details, see 8 | # http://developer.android.com/guide/developing/tools/proguard.html 9 | 10 | # Add any project specific keep options here: 11 | 12 | # If your project uses WebView with JS, uncomment the following 13 | # and specify the fully qualified class name to the JavaScript interface 14 | # class: 15 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview { 16 | # public *; 17 | #} 18 | -------------------------------------------------------------------------------- /android-sample-app/signing_confs/sample_conf.gradle: -------------------------------------------------------------------------------- 1 | //Create conf.grdale file from this sample and write correct data in their places 2 | 3 | android { 4 | signingConfigs { 5 | defaultSigningConf { 6 | storeFile file("") 7 | storePassword "" 8 | keyAlias "" 9 | keyPassword "" 10 | } 11 | } 12 | } 13 | 14 | s -------------------------------------------------------------------------------- /android-sample-app/src/androidTest/java/com/mobapphome/simpleencryptorlib/ApplicationTest.java: -------------------------------------------------------------------------------- 1 | package com.mobapphome.simpleencryptorlib; 2 | 3 | import android.app.Application; 4 | import android.test.ApplicationTestCase; 5 | 6 | /** 7 | * Testing Fundamentals 8 | */ 9 | public class ApplicationTest extends ApplicationTestCase { 10 | public ApplicationTest() { 11 | super(Application.class); 12 | } 13 | } -------------------------------------------------------------------------------- /android-sample-app/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /android-sample-app/src/main/java/com/mobapphome/simpleencryptorlib/sample/SampleActivityJava.java: -------------------------------------------------------------------------------- 1 | package com.mobapphome.simpleencryptorlib.sample; 2 | 3 | import android.content.Intent; 4 | import android.graphics.drawable.Drawable; 5 | import android.net.Uri; 6 | import android.support.v7.app.AlertDialog; 7 | import android.support.v7.app.AppCompatActivity; 8 | import android.os.Bundle; 9 | import android.view.View; 10 | import android.widget.EditText; 11 | import android.widget.ImageView; 12 | 13 | import com.mobapphome.simpleencryptorlib.Constants; 14 | import com.mobapphome.simpleencryptorlib.SimpleEncryptor; 15 | import com.mobapphome.simpleencryptorlib.R; 16 | 17 | public class SampleActivityJava extends AppCompatActivity implements View.OnClickListener { 18 | 19 | EditText editTextOriginal; 20 | EditText editTextEnchrypted; 21 | EditText editTextKeyPhrase; 22 | 23 | @Override 24 | protected void onCreate(Bundle savedInstanceState) { 25 | super.onCreate(savedInstanceState); 26 | setContentView(R.layout.activity_main); 27 | 28 | //This block is only in Java sample--------------- 29 | { 30 | findViewById(R.id.btnOpenJavaSample).setVisibility(View.GONE); 31 | setTitle(getString(R.string.title_java_sample)); 32 | } 33 | 34 | editTextKeyPhrase = (EditText) findViewById(R.id.etKeyPhrase); 35 | editTextOriginal = (EditText) findViewById(R.id.etOriginalTxt); 36 | editTextEnchrypted = (EditText) findViewById(R.id.etEnchryptedTxt); 37 | 38 | 39 | ImageView imageView = (ImageView) findViewById(R.id.ivForkMeOnGithub); 40 | Drawable forkMeImg = getResources().getDrawable(R.drawable.forkme_green); 41 | // setting the opacity (alpha) 42 | forkMeImg.setAlpha(180); 43 | // setting the images on the ImageViews 44 | imageView.setImageDrawable(forkMeImg); 45 | 46 | imageView.setOnClickListener(this); 47 | findViewById(R.id.btnDechrypt).setOnClickListener(this); 48 | findViewById(R.id.btnEnchrypt).setOnClickListener(this); 49 | } 50 | 51 | @Override 52 | public void onClick(View view) { 53 | 54 | if (view.getId() == R.id.ivForkMeOnGithub) { 55 | Intent browserIntent = new Intent(Intent.ACTION_VIEW, Uri.parse(Constants.MAH_ENCHRIPTOR_GITHUB_LINK)); 56 | startActivity(browserIntent); 57 | } else if (view.getId() == R.id.btnEnchrypt 58 | || view.getId() == R.id.btnDechrypt) { 59 | 60 | try { 61 | String keyPhraseTxt = editTextKeyPhrase.getText().toString().trim(); 62 | if (keyPhraseTxt.isEmpty()) { 63 | new AlertDialog.Builder(this) 64 | .setTitle("Caution!") 65 | .setMessage("Key phrase is empty. Fill it and continue.") 66 | .setPositiveButton("Ok", null) 67 | .setIcon(android.R.drawable.ic_dialog_alert) 68 | .show(); 69 | return; 70 | } 71 | 72 | if (view.getId() == R.id.btnEnchrypt) { 73 | SimpleEncryptor simpleEncryptor = SimpleEncryptor.newInstance(keyPhraseTxt); 74 | 75 | String originaltxt = editTextOriginal.getText().toString().trim(); 76 | if (originaltxt.isEmpty()) { 77 | new AlertDialog.Builder(this) 78 | .setTitle("Caution!") 79 | .setMessage("Original string is empty. Fill it and continue.") 80 | .setPositiveButton("Ok", null) 81 | .setIcon(android.R.drawable.ic_dialog_alert) 82 | .show(); 83 | return; 84 | } 85 | editTextEnchrypted.setText(simpleEncryptor.encode(originaltxt)); 86 | 87 | } else if (view.getId() == R.id.btnDechrypt) { 88 | SimpleEncryptor simpleEncryptor = SimpleEncryptor.newInstance(keyPhraseTxt); 89 | 90 | String enchryptedTxt = editTextEnchrypted.getText().toString().trim(); 91 | if (enchryptedTxt.isEmpty()) { 92 | new AlertDialog.Builder(this) 93 | .setTitle("Caution!") 94 | .setMessage("Enchrypted string is empty. Fill it and continue.") 95 | .setPositiveButton("Ok", null) 96 | .setIcon(android.R.drawable.ic_dialog_alert) 97 | .show(); 98 | return; 99 | } 100 | editTextOriginal.setText(simpleEncryptor.decode(enchryptedTxt)); 101 | } 102 | } catch (Exception e) { 103 | new AlertDialog.Builder(this) 104 | .setTitle("Exception") 105 | .setMessage(e.getMessage()) 106 | .setPositiveButton("Ok", null) 107 | .setIcon(android.R.drawable.ic_dialog_alert) 108 | .show(); 109 | return; 110 | } 111 | } 112 | } 113 | } 114 | -------------------------------------------------------------------------------- /android-sample-app/src/main/java/com/mobapphome/simpleencryptorlib/sample/SampleActivityKotlin.kt: -------------------------------------------------------------------------------- 1 | package com.mobapphome.simpleencryptorlib.sample 2 | 3 | import android.content.Intent 4 | import android.net.Uri 5 | import android.os.Bundle 6 | import android.support.v4.content.ContextCompat 7 | import android.support.v7.app.AlertDialog 8 | import android.support.v7.app.AppCompatActivity 9 | 10 | import com.mobapphome.simpleencryptorlib.Constants 11 | import com.mobapphome.simpleencryptorlib.SimpleEncryptor 12 | import com.mobapphome.simpleencryptorlib.R 13 | import kotlinx.android.synthetic.main.activity_main.* 14 | 15 | class SampleActivityKotlin : AppCompatActivity() { 16 | 17 | 18 | override fun onCreate(savedInstanceState: Bundle?) { 19 | super.onCreate(savedInstanceState) 20 | setContentView(R.layout.activity_main) 21 | 22 | //This block is only in Kotlin sample 23 | run { 24 | title = getString(R.string.title_kotlin_sample) 25 | btnOpenJavaSample.setOnClickListener { 26 | val intent = Intent(this, SampleActivityJava::class.java) 27 | startActivity(intent) 28 | } 29 | } 30 | 31 | 32 | val forkMeImg = ContextCompat.getDrawable(this, R.drawable.forkme_green) 33 | // setting the opacity (alpha) 34 | forkMeImg?.alpha = 180 35 | // setting the images on the ImageViews 36 | ivForkMeOnGithub.setImageDrawable(forkMeImg) 37 | 38 | ivForkMeOnGithub.setOnClickListener { 39 | val browserIntent = Intent(Intent.ACTION_VIEW, Uri.parse(Constants.MAH_ENCHRIPTOR_GITHUB_LINK)) 40 | startActivity(browserIntent) 41 | } 42 | btnDechrypt.setOnClickListener { 43 | checkKeyPhrase { k -> 44 | val mahEncryptor = SimpleEncryptor.newInstance(k) 45 | 46 | val enchryptedTxt = etEnchryptedTxt.text.toString().trim { it <= ' ' } 47 | if (enchryptedTxt.isEmpty()) { 48 | AlertDialog.Builder(this) 49 | .setTitle("Caution!") 50 | .setMessage("Enchrypted string is empty. Fill it and continue.") 51 | .setPositiveButton("Ok", null) 52 | .setIcon(android.R.drawable.ic_dialog_alert) 53 | .show() 54 | return@checkKeyPhrase 55 | } 56 | etOriginalTxt.setText(mahEncryptor.decode(enchryptedTxt)) 57 | } 58 | } 59 | 60 | 61 | btnEnchrypt.setOnClickListener { 62 | checkKeyPhrase { k -> 63 | val mahEncryptor = SimpleEncryptor.newInstance(k) 64 | 65 | val originaltxt = etOriginalTxt.text.toString().trim { it <= ' ' } 66 | if (originaltxt.isEmpty()) { 67 | AlertDialog.Builder(this) 68 | .setTitle("Caution!") 69 | .setMessage("Original string is empty. Fill it and continue.") 70 | .setPositiveButton("Ok", null) 71 | .setIcon(android.R.drawable.ic_dialog_alert) 72 | .show() 73 | return@checkKeyPhrase 74 | } 75 | etEnchryptedTxt.setText(mahEncryptor.encode(originaltxt)) 76 | } 77 | } 78 | } 79 | 80 | 81 | fun checkKeyPhrase(f: (key: String) -> Unit) { 82 | try { 83 | val keyPhraseTxt = etKeyPhrase.text.toString().trim { it <= ' ' } 84 | if (keyPhraseTxt.isEmpty()) { 85 | AlertDialog.Builder(this) 86 | .setTitle("Caution!") 87 | .setMessage("Key phrase is empty. Fill it and continue.") 88 | .setPositiveButton("Ok", null) 89 | .setIcon(android.R.drawable.ic_dialog_alert) 90 | .show() 91 | return 92 | } 93 | 94 | f(keyPhraseTxt) 95 | } catch (e: Exception) { 96 | AlertDialog.Builder(this) 97 | .setTitle("Exception") 98 | .setMessage(e.message) 99 | .setPositiveButton("Ok", null) 100 | .setIcon(android.R.drawable.ic_dialog_alert) 101 | .show() 102 | return 103 | } 104 | } 105 | } 106 | -------------------------------------------------------------------------------- /android-sample-app/src/main/res/drawable-hdpi/ic_keyboard_arrow_down_black_24dp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hummatli/SimpleEncryptionLib/e345b8b38113397f21101485cf83677b0bbb8a52/android-sample-app/src/main/res/drawable-hdpi/ic_keyboard_arrow_down_black_24dp.png -------------------------------------------------------------------------------- /android-sample-app/src/main/res/drawable-hdpi/ic_keyboard_arrow_up_black_24dp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hummatli/SimpleEncryptionLib/e345b8b38113397f21101485cf83677b0bbb8a52/android-sample-app/src/main/res/drawable-hdpi/ic_keyboard_arrow_up_black_24dp.png -------------------------------------------------------------------------------- /android-sample-app/src/main/res/drawable-mdpi/ic_arrow_downward_black_48dp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hummatli/SimpleEncryptionLib/e345b8b38113397f21101485cf83677b0bbb8a52/android-sample-app/src/main/res/drawable-mdpi/ic_arrow_downward_black_48dp.png -------------------------------------------------------------------------------- /android-sample-app/src/main/res/drawable-mdpi/ic_arrow_upward_black_48dp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hummatli/SimpleEncryptionLib/e345b8b38113397f21101485cf83677b0bbb8a52/android-sample-app/src/main/res/drawable-mdpi/ic_arrow_upward_black_48dp.png -------------------------------------------------------------------------------- /android-sample-app/src/main/res/drawable-mdpi/ic_keyboard_arrow_down_black_24dp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hummatli/SimpleEncryptionLib/e345b8b38113397f21101485cf83677b0bbb8a52/android-sample-app/src/main/res/drawable-mdpi/ic_keyboard_arrow_down_black_24dp.png -------------------------------------------------------------------------------- /android-sample-app/src/main/res/drawable-mdpi/ic_keyboard_arrow_up_black_24dp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hummatli/SimpleEncryptionLib/e345b8b38113397f21101485cf83677b0bbb8a52/android-sample-app/src/main/res/drawable-mdpi/ic_keyboard_arrow_up_black_24dp.png -------------------------------------------------------------------------------- /android-sample-app/src/main/res/drawable-xhdpi/ic_arrow_downward_black_48dp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hummatli/SimpleEncryptionLib/e345b8b38113397f21101485cf83677b0bbb8a52/android-sample-app/src/main/res/drawable-xhdpi/ic_arrow_downward_black_48dp.png -------------------------------------------------------------------------------- /android-sample-app/src/main/res/drawable-xhdpi/ic_arrow_upward_black_48dp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hummatli/SimpleEncryptionLib/e345b8b38113397f21101485cf83677b0bbb8a52/android-sample-app/src/main/res/drawable-xhdpi/ic_arrow_upward_black_48dp.png -------------------------------------------------------------------------------- /android-sample-app/src/main/res/drawable-xhdpi/ic_keyboard_arrow_down_black_24dp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hummatli/SimpleEncryptionLib/e345b8b38113397f21101485cf83677b0bbb8a52/android-sample-app/src/main/res/drawable-xhdpi/ic_keyboard_arrow_down_black_24dp.png -------------------------------------------------------------------------------- /android-sample-app/src/main/res/drawable-xhdpi/ic_keyboard_arrow_up_black_24dp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hummatli/SimpleEncryptionLib/e345b8b38113397f21101485cf83677b0bbb8a52/android-sample-app/src/main/res/drawable-xhdpi/ic_keyboard_arrow_up_black_24dp.png -------------------------------------------------------------------------------- /android-sample-app/src/main/res/drawable-xxhdpi/ic_arrow_downward_black_48dp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hummatli/SimpleEncryptionLib/e345b8b38113397f21101485cf83677b0bbb8a52/android-sample-app/src/main/res/drawable-xxhdpi/ic_arrow_downward_black_48dp.png -------------------------------------------------------------------------------- /android-sample-app/src/main/res/drawable-xxhdpi/ic_arrow_upward_black_48dp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hummatli/SimpleEncryptionLib/e345b8b38113397f21101485cf83677b0bbb8a52/android-sample-app/src/main/res/drawable-xxhdpi/ic_arrow_upward_black_48dp.png -------------------------------------------------------------------------------- /android-sample-app/src/main/res/drawable-xxhdpi/ic_keyboard_arrow_down_black_24dp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hummatli/SimpleEncryptionLib/e345b8b38113397f21101485cf83677b0bbb8a52/android-sample-app/src/main/res/drawable-xxhdpi/ic_keyboard_arrow_down_black_24dp.png -------------------------------------------------------------------------------- /android-sample-app/src/main/res/drawable-xxhdpi/ic_keyboard_arrow_up_black_24dp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hummatli/SimpleEncryptionLib/e345b8b38113397f21101485cf83677b0bbb8a52/android-sample-app/src/main/res/drawable-xxhdpi/ic_keyboard_arrow_up_black_24dp.png -------------------------------------------------------------------------------- /android-sample-app/src/main/res/drawable-xxxhdpi/ic_arrow_downward_black_48dp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hummatli/SimpleEncryptionLib/e345b8b38113397f21101485cf83677b0bbb8a52/android-sample-app/src/main/res/drawable-xxxhdpi/ic_arrow_downward_black_48dp.png -------------------------------------------------------------------------------- /android-sample-app/src/main/res/drawable-xxxhdpi/ic_arrow_upward_black_48dp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hummatli/SimpleEncryptionLib/e345b8b38113397f21101485cf83677b0bbb8a52/android-sample-app/src/main/res/drawable-xxxhdpi/ic_arrow_upward_black_48dp.png -------------------------------------------------------------------------------- /android-sample-app/src/main/res/drawable-xxxhdpi/ic_keyboard_arrow_down_black_24dp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hummatli/SimpleEncryptionLib/e345b8b38113397f21101485cf83677b0bbb8a52/android-sample-app/src/main/res/drawable-xxxhdpi/ic_keyboard_arrow_down_black_24dp.png -------------------------------------------------------------------------------- /android-sample-app/src/main/res/drawable-xxxhdpi/ic_keyboard_arrow_up_black_24dp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hummatli/SimpleEncryptionLib/e345b8b38113397f21101485cf83677b0bbb8a52/android-sample-app/src/main/res/drawable-xxxhdpi/ic_keyboard_arrow_up_black_24dp.png -------------------------------------------------------------------------------- /android-sample-app/src/main/res/drawable/forkme_green.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hummatli/SimpleEncryptionLib/e345b8b38113397f21101485cf83677b0bbb8a52/android-sample-app/src/main/res/drawable/forkme_green.png -------------------------------------------------------------------------------- /android-sample-app/src/main/res/layout/activity_main.xml: -------------------------------------------------------------------------------- 1 | 2 | 8 | 9 | 12 | 13 | 16 | 17 | 25 | 26 | 27 | 33 | 34 | 42 | 43 | 50 | 51 | 55 | 56 | 62 | 63 | 71 | 72 | 73 | 82 | 83 | 84 | 89 | 90 | 97 | 98 |