Step 1. Add the JitPack repository to your build file
Add it in your root settings.gradle at the end of repositories:
dependencyResolutionManagement {
repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
repositories {
mavenCentral()
maven { url 'https://jitpack.io' }
}
}
Add it in your settings.gradle.kts at the end of repositories:
dependencyResolutionManagement {
repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
repositories {
mavenCentral()
maven { url = uri("https://jitpack.io") }
}
}
Add to pom.xml
<repositories>
<repository>
<id>jitpack.io</id>
<url>https://jitpack.io</url>
</repository>
</repositories>
Add it in your build.sbt at the end of resolvers:
resolvers += "jitpack" at "https://jitpack.io"
Add it in your project.clj at the end of repositories:
:repositories [["jitpack" "https://jitpack.io"]]
Step 2. Add the dependency
dependencies {
implementation 'com.github.worldline-spain:t21-crypter-android:v_1.0.4'
}
dependencies {
implementation("com.github.worldline-spain:t21-crypter-android:v_1.0.4")
}
<dependency>
<groupId>com.github.worldline-spain</groupId>
<artifactId>t21-crypter-android</artifactId>
<version>v_1.0.4</version>
</dependency>
libraryDependencies += "com.github.worldline-spain" % "t21-crypter-android" % "v_1.0.4"
:dependencies [[com.github.worldline-spain/t21-crypter-android "v_1.0.4"]]
This library allows to encrypt and decrypt sensible data in your applications. Tipically used for token encryption, if you want to secure your application and ensure anyone can steal the token of your users, you should use this library.
dependency>
<groupId>com.tempos21.t21crypt</groupId>
<artifactId>t21_crypter_android</artifactId>
<version>1.0.5</version>
<type>pom</type>
</dependency>
compile 'com.tempos21.t21crypt:t21_crypter_android:1.0.5'
<dependency org='com.tempos21.t21crypt' name='t21_crypter_android' rev='1.0.5'>
<artifact name='$AID' ext='pom'></artifact>
</dependency>
Encryption:
/**
* This key should be dynamic
*/
private static final String KEY_TOKEN = "RANDOM_STRING";
String textToEncrypt = "whatIWantToCrypt1234";
final Crypter crypter = CrypterFactory.buildCrypter(CryptMethod.AES, KEY_TOKEN);
String encryptedText = crypter.encrypt(textToEncrypt);
Decryption:
/**
* This key should be dynamic
*/
private static final String KEY_TOKEN = "RANDOM_STRING";
String textToDecrypt = "rAvceqEKRR3uG7jltp7EccfMobmipUgvp142pnmQB2g=";
final Crypter crypter = CrypterFactory.buildCrypter(CryptMethod.AES, KEY_TOKEN);
String decryptedText = crypter.decrypt(textToDecrypt);
Feel free to report any issues or suggest new features.
Copyright 2016 Worldline Iberia
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.