A simple way to encrypt your secure data like passwords into a native .so library.

Overview

PLEASE NOTE, THIS PROJECT IS NO LONGER BEING MAINTAINED

Cipher.so

Providing a simple way to keep your secure info safe for android app development.

GitHub license Android Weekly Recommend

Wiki


About

How it works?

All the key-values will be auto package into a native library during the compile time. Then your can obtain them from the Java interface generated by Cipher.so.

Features

  • Encrypt secure info in a native library via easy configs
  • Reflection free

Usages

Installation

Step 1. in the root build.gradle:

Add maven { url 'https://jitpack.io' } resposity and classpath 'com.github.MEiDIK:Cipher.so:dev-SNAPSHOT' dependency into the buildscript:

buildscript {
    repositories {
        google()
        maven { url 'https://jitpack.io' }
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.0.1'
        classpath 'com.github.MEiDIK:Cipher.so:dev-SNAPSHOT'
    }
}
Step 2. in the app module build.gradle:

Add apply plugin:'cipher.so' before(VERY IMPORTANT) apply plugin: 'com.android.application'

apply plugin: 'cipher.so'
apply plugin: 'com.android.application'

That's all, Cipher.so is ready to GO.

Configuration

In your app module build.gradle, add the follow-like configs to save key-values.

cipher.so {
    keys {
        hello {
            value = 'Hello From Cipher.so😊'
        }
        httpsKey {
            value = 'htkdjfkj@https2017now'
        }
        数据库密码 {
            value = '今天天气不错😂😂'
        }
        ...
    }
    encryptSeed = 'HelloSecretKey' //Secret key used for encryption
}

Then Rebuild to generate the Java Interface.

3. Call In Java/Kotlin

String hello = CipherClient.hello();
String httpsKey = CipherClient.httpsKey();
String dbKey = CipherClient.数据库密码();

Sample: HelloCipherSo

Contribute?

I am very glad for your contributes. Let's make this job awesome.

Here is the contribute workflow from github: Contribute Guide

Todos

  • Encrypt data in .so-lib
  • Prevent dynamic attacks
    • Check Signature
    • More
  • Support different Application varients

References

Great Thanks to


关于

原理?

在编译期,通过gradle配置将Key-value加密打包进native so库,然后通过自动生成的Java接口可以获取相应的数据。

特性

  • 通过简单的配置把隐私信息加密进native库
  • 没有使用反射

用法

安装

Step 1. 在root project的build.gradle中:

在buildscript中添加仓库maven { url 'https://jitpack.io' },添加依赖classpath 'com.github.MEiDIK:Cipher.so:dev-SNAPSHOT':

buildscript {
    repositories {
        google()
        maven { url 'https://jitpack.io' }
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.0.1'
        classpath 'com.github.MEiDIK:Cipher.so:dev-SNAPSHOT'
    }
}
Step 2. 在目标模块的build.gradle中:

apply plugin: 'com.android.application'(十分重要)添加apply plugin:'cipher.so'

apply plugin: 'cipher.so'
apply plugin: 'com.android.application'

至此,Cipher.so已经就绪。

配置

在app模块的build.gradle中,通过以下的配置保存key-value值。

cipher.so {
    keys {
        hello {
            value = 'Hello From Cipher.so😊'
        }
        httpsKey {
            value = 'htkdjfkj@https2017now'
        }
        数据库密码 {
            value = '今天天气不错😂😂'
        }
        ...
    }
    encryptSeed = 'HelloSecretKey' //用于加密的密钥
}

然后Rebuild一下,自动生产Java的调用接口。

3. 在Java/Kotlin中调用

String hello = CipherClient.hello();
String httpsKey = CipherClient.httpsKey();
String dbKey = CipherClient.数据库密码();

例子: HelloCipherSo

贡献代码?

十分欢迎你的贡献,让我们一起把这个做得更好。

这是Github的贡献指南: Contribute Guide

Todos

  • 在.so-lib中加密数据
  • 防止动态攻击
    • 检查应用 签名
    • 更多
  • 支持Multi Application varients

相关资料

万分感谢


License

Copyright 2017 认真的帅斌

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.
Comments
  • Move CmakeList.txt generation after clean task

    Move CmakeList.txt generation after clean task

    Thank you for the nice plugin! 👍

    While trying to replace my own implementation with this, I ran in to a somewhat a problem, so maybe some one else is also experiencing this.

    I like to sometimes run a clean task before building my project (mostly when deploying), and with that task in place the compiler game me an error that the file specified in the externalNativeJsonGenerator.makefile property does not exist. Some investigation revealed that the CMakeLists.txt is generated in the afterEvaluate callback witch is executed before the clean task, so on the clean task the file is deleted. So I was wondering if it is plausible of moving the generation after the clean task? Maybe it can be hooked to after/before preBuild task?

    The issue can be simulated with the sample projects by running a clean when building ./gradlew sample:clean sample:assemble

    A problem was found with the configuration of task ':sample:generateJsonModelDebug'.
    > File '/Users/darius/workspace/android/Cipher.so/sample/build/cipher.so/cmake/CMakeLists.txt' specified for property 'externalNativeJsonGenerator.makefile' does not exist.
    
    bug 
    opened by darius-janusauskas 15
  • Could not find com.github.MEiDIK:Cipher.so:dev-SNAPSHOT.

    Could not find com.github.MEiDIK:Cipher.so:dev-SNAPSHOT.

    Using this lib from last few years but today facing issue "Could not find com.github.MEiDIK:Cipher.so:dev-SNAPSHOT." (Jul 12, 2021)

    is this library moved? Or Any update?

    opened by MayurAmipara4778 5
  • I made follow guide, but there is issue. I don't know how to solve, please help me

    I made follow guide, but there is issue. I don't know how to solve, please help me

    External Native Build Issues Build command failed. Error while executing process C:\Users\DavidSonNguyen\AppData\Local\Android\Sdk\cmake\3.6.4111459\bin\cmake.exe with arguments {-HC:\Users\DavidSonNguyen\Desktop\TestCipher\app\build\cipher.so\cmake -BC:\Users\DavidSonNguyen\Desktop\TestCipher\app\outputs\cmake\cmake\debug\armeabi-v7a -DANDROID_ABI=armeabi-v7a -DANDROID_PLATFORM=android-15 -DCMAKE_LIBRARY_OUTPUT_DIRECTORY=C:\Users\DavidSonNguyen\Desktop\TestCipher\app\build\intermediates\cmake\debug\obj\armeabi-v7a -DCMAKE_BUILD_TYPE=Debug -DANDROID_NDK=C:\Users\DavidSonNguyen\AppData\Local\Android\Sdk\ndk-bundle -DCMAKE_CXX_FLAGS= -DCMAKE_TOOLCHAIN_FILE=C:\Users\DavidSonNguyen\AppData\Local\Android\Sdk\ndk-bundle\build\cmake\android.toolchain.cmake -DCMAKE_MAKE_PROGRAM=C:\Users\DavidSonNguyen\AppData\Local\Android\Sdk\cmake\3.6.4111459\bin\ninja.exe -GAndroid Gradle - Ninja} -- Check for working C compiler: C:/Users/DavidSonNguyen/AppData/Local/Android/Sdk/ndk-bundle/toolchains/llvm/prebuilt/windows-x86_64/bin/clang.exe -- Check for working C compiler: C:/Users/DavidSonNguyen/AppData/Local/Android/Sdk/ndk-bundle/toolchains/llvm/prebuilt/windows-x86_64/bin/clang.exe -- works -- Detecting C compiler ABI info -- Detecting C compiler ABI info - done -- Detecting C compile features -- Detecting C compile features - done -- Check for working CXX compiler: C:/Users/DavidSonNguyen/AppData/Local/Android/Sdk/ndk-bundle/toolchains/llvm/prebuilt/windows-x86_64/bin/clang++.exe -- Check for working CXX compiler: C:/Users/DavidSonNguyen/AppData/Local/Android/Sdk/ndk-bundle/toolchains/llvm/prebuilt/windows-x86_64/bin/clang++.exe -- works -- Detecting CXX compiler ABI info -- Detecting CXX compiler ABI info - done -- Detecting CXX compile features -- Detecting CXX compile features - done CMake Error at CMakeLists.txt:5 (add_subdirectory): C:/Users/DavidSonNguyen/Desktop/TestCipher/app/build/cipher.so/cmake/CMakeLists.txt:5 when parsing string C:\Users\DavidSonNguyen\Desktop\TestCipher\app\build\cipher.so Invalid character escape '\U'. -- Configuring incomplete, errors occurred! See also "C:/Users/DavidSonNguyen/Desktop/TestCipher/app/outputs/cmake/cmake/debug/armeabi-v7a/CMakeFiles/CMakeOutput.log". Build command failed. Error while executing process C:\Users\DavidSonNguyen\AppData\Local\Android\Sdk\cmake\3.6.4111459\bin\cmake.exe with arguments {-HC:\Users\DavidSonNguyen\Desktop\TestCipher\app\build\cipher.so\cmake -BC:\Users\DavidSonNguyen\Desktop\TestCipher\app\outputs\cmake\cmake\release\armeabi-v7a -DANDROID_ABI=armeabi-v7a -DANDROID_PLATFORM=android-15 -DCMAKE_LIBRARY_OUTPUT_DIRECTORY=C:\Users\DavidSonNguyen\Desktop\TestCipher\app\build\intermediates\cmake\release\obj\armeabi-v7a -DCMAKE_BUILD_TYPE=Release -DANDROID_NDK=C:\Users\DavidSonNguyen\AppData\Local\Android\Sdk\ndk-bundle -DCMAKE_CXX_FLAGS= -DCMAKE_TOOLCHAIN_FILE=C:\Users\DavidSonNguyen\AppData\Local\Android\Sdk\ndk-bundle\build\cmake\android.toolchain.cmake -DCMAKE_MAKE_PROGRAM=C:\Users\DavidSonNguyen\AppData\Local\Android\Sdk\cmake\3.6.4111459\bin\ninja.exe -GAndroid Gradle - Ninja} -- Check for working C compiler: C:/Users/DavidSonNguyen/AppData/Local/Android/Sdk/ndk-bundle/toolchains/llvm/prebuilt/windows-x86_64/bin/clang.exe -- Check for working C compiler: C:/Users/DavidSonNguyen/AppData/Local/Android/Sdk/ndk-bundle/toolchains/llvm/prebuilt/windows-x86_64/bin/clang.exe -- works -- Detecting C compiler ABI info -- Detecting C compiler ABI info - done -- Detecting C compile features -- Detecting C compile features - done -- Check for working CXX compiler: C:/Users/DavidSonNguyen/AppData/Local/Android/Sdk/ndk-bundle/toolchains/llvm/prebuilt/windows-x86_64/bin/clang++.exe -- Check for working CXX compiler: C:/Users/DavidSonNguyen/AppData/Local/Android/Sdk/ndk-bundle/toolchains/llvm/prebuilt/windows-x86_64/bin/clang++.exe -- works -- Detecting CXX compiler ABI info -- Detecting CXX compiler ABI info - done -- Detecting CXX compile features -- Detecting CXX compile features - done CMake Error at CMakeLists.txt:5 (add_subdirectory): C:/Users/DavidSonNguyen/Desktop/TestCipher/app/build/cipher.so/cmake/CMakeLists.txt:5 when parsing string C:\Users\DavidSonNguyen\Desktop\TestCipher\app\build\cipher.so Invalid character escape '\U'. -- Configuring incomplete, errors occurred! See also "C:/Users/DavidSonNguyen/Desktop/TestCipher/app/outputs/cmake/cmake/release/armeabi-v7a/CMakeFiles/CMakeOutput.log". C:\Users\DavidSonNguyen\AppData\Local\Android\sdk\ndk-bundle\build\cmake\android.toolchain.cmake Warning:(63, 98) (include) CMakeLists.txt Warning:(63, 98) (include) CMakeLists.txt

    bug 
    opened by DavidSonNguyen 3
  • Read time out

    Read time out

    Could not resolve com.github.MEiDIK:Cipher.so:dev-SNAPSHOT

    Could not get resource 'https://jitpack.io/com/github/MEiDIK/Cipher.so/dev-SNAPSHOT/Cipher.so-dev-v0.0.4-g8581777-15.pom'. Could not HEAD 'https://jitpack.io/com/github/MEiDIK/Cipher.so/dev-SNAPSHOT/Cipher.so-dev-v0.0.4-g8581777-15.pom'. Read timed out

    opened by RainyJiang22 2
  • Snaphots please :)

    Snaphots please :)

    can we have a snapshot channel please?

    atm i'm having issues on bitrise/ci with the latest version because of #9

    tried to use https://jitpack.io/#MEiDIK/Cipher.so/-SNAPSHOT but didn't work for some reason

    cheers, jan

    opened by kibotu 2
  • Message new items added to project always show

    Message new items added to project always show

    I try install the dependency follow the instructions but Android Studio present allways the message: "External build files have changed since last project sync. A project sync may be necessary for the IDE work properly." If rebuild project this error prints:

    A problem was found with the configuration of task ':app:generateJsonModelRelease'.

    File '/app/build/cipher.so/cmake/CMakeLists.txt' specified for property 'externalNativeJsonGenerator.makefile' does not exist.

    opened by victorcs85 1
  • Error :  Android tasks have already been created.

    Error : Android tasks have already been created.

    Error:Android tasks have already been created. This happens when calling android.applicationVariants, android.libraryVariants or android.testVariants. Once these methods are called, it is not possible to continue configuring the model.

    opened by kagile 1
  • Support for Android libraries?

    Support for Android libraries?

    Hello,

    I would like to use your library in one of my Android library module. Is-it possible? Right now I have this error when I include the apply plugin line in the module:

    Error:Cannot get property 'externalNativeBuild' on null object

    Thanks

    opened by g123k 1
  • com.github.linisme:Cipher.so:0.0.4 -

    com.github.linisme:Cipher.so:0.0.4 -

    Getting below error while trying to use below version of library. Please let me know any issues with this version. repositories { maven { url 'https://jitpack.io' } } dependencies { classpath 'com.github.linisme:Cipher.so:0.0.4' }

    Logs:

    • What went wrong: A problem occurred evaluating project ':app'.

    Could not set unknown property 'encryptSeed' for SoExt{keys=[KeyExt{name='ek', value='-----BEGIN RSA PRIVATE KEY----- Proc-Type: 4,ENCRYPTED DEK-Info: DES-EDE3-CBC,CA588D9290D69EBB

    opened by JeevanandhamRaja 1
  • Can not Add Cipher.so to my project

    Can not Add Cipher.so to my project

    Hi guys. i'm trying to add this in my project. but i get error. all link has 404 error.

    `A problem occurred configuring root project 'HamrahBankAnsarV3'.

    Could not resolve all artifacts for configuration ':classpath'. Could not find com.github.MEiDIK:Cipher.so:dev-SNAPSHOT. Searched in the following locations: - https://dl.google.com/dl/android/maven2/com/github/MEiDIK/Cipher.so/dev-SNAPSHOT/maven-metadata.xml - https://dl.google.com/dl/android/maven2/com/github/MEiDIK/Cipher.so/dev-SNAPSHOT/Cipher.so-dev-SNAPSHOT.pom - https://dl.google.com/dl/android/maven2/com/github/MEiDIK/Cipher.so/dev-SNAPSHOT/Cipher.so-dev-SNAPSHOT.jar - https://jitpack.io/com/github/MEiDIK/Cipher.so/dev-SNAPSHOT/maven-metadata.xml - https://jitpack.io/com/github/MEiDIK/Cipher.so/dev-SNAPSHOT/Cipher.so-dev-SNAPSHOT.pom - https://jitpack.io/com/github/MEiDIK/Cipher.so/dev-SNAPSHOT/Cipher.so-dev-SNAPSHOT.jar - https://plugins.gradle.org/m2/com/github/MEiDIK/Cipher.so/dev-SNAPSHOT/maven-metadata.xml - https://plugins.gradle.org/m2/com/github/MEiDIK/Cipher.so/dev-SNAPSHOT/Cipher.so-dev-SNAPSHOT.pom - https://plugins.gradle.org/m2/com/github/MEiDIK/Cipher.so/dev-SNAPSHOT/Cipher.so-dev-SNAPSHOT.jar Required by: project :

    Possible solution:

    • Declare repository providing the artifact, see the documentation at https://docs.gradle.org/current/userguide/declaring_repositories.html

    `

    opened by HoseinGhadiri 17
  • Cipher.so in an Android Library

    Cipher.so in an Android Library

    Can this library be used in an android library?

    I have placed the apply plugin: 'cipher.so' but I am unable to build the project. I keep getting the error, cannot read 'externalNativeBuild' on a null object

    opened by ebi-igweze 3
Owner
lin
lin
A plugin for Jetbrains IDE, Your code is powerful, unleash it like playing osu!

Osu! Mode A plugin for Jetbrains IDE, Your code is powerful, unleash it like playing osu! Demo 2021-10-15.18-50-30.mp4 Bilibili Feature open project /

Nthily 8 Sep 8, 2022
CKlib is a gradle plugin that will build and package C/C++/Objective-C code for Kotlin/Native.

C Klib CKlib is a gradle plugin that will build and package C/C++/Objective-C code for Kotlin/Native. The Problem When you want to access C-etc code f

Touchlab 73 Nov 8, 2022
Kotlin Native's Clang Compiler Plugin

Kotlin Native's Clang Compiler Plugin This plugin makes possible to use konon clang compiler. Support targets: Target Name Host compatibility linux_x6

null 3 May 8, 2022
A Gradle plugin for providing your secrets to your Android project.

Secrets Gradle Plugin for Android A Gradle plugin for providing your secrets securely to your Android project. This Gradle plugin reads secrets from a

Google 560 Jan 8, 2023
Dokka plugin to render Mermaid graphics, from your code comments to your Dokka documentation.

Dokka plugin to render Mermaid graphics, from your code comments to your Dokka documentation.

Grégory Lureau 24 Jan 7, 2023
Gradle Replace In Place (GRIP): a gradle plugin to update your documentation or any file with a simple gradle task

GRIP (Gradle Replace In-Place) A gradle tool to update some values in your (documentation) files by running a task. (inspired by Knit) Directives Inse

Grégory Lureau 2 Oct 18, 2022
GPP is Android's unofficial release automation Gradle Plugin. It can do anything from building, uploading, and then promoting your App Bundle or APK to publishing app listings and other metadata.

Gradle Play Publisher Gradle Play Publisher is Android's unofficial release automation Gradle Plugin. It can do anything from building, uploading, and

null 3.9k Dec 30, 2022
A Gradle plugin to report the number of method references in your APK on every build.

Dexcount Gradle Plugin A Gradle plugin to report the number of method references in your APK, AAR, or java module. This helps you keep tabs on the gro

Keepsafe 3k Dec 29, 2022
This plugin help you to set material design icon to your project.

Android Material Design Icon Generator Plugin This plugin help you to set material design icons to your Android project. Installation Manually Downloa

Yusuke Konishi 2.4k Dec 30, 2022
A plugin for Android Studio and Intellij IDEA that speeds up your day to day android development.

ADB Idea A plugin for Android Studio and Intellij IDEA that speeds up your day to day android development. The following commands are provided: Uninst

Philippe Breault 2k Dec 28, 2022
Gradle plugin which downloads and manages your Android SDK.

DEPRECATED This plugin is deprecated and is no longer being developed. Tools and dependencies are automatically downloaded using version 2.2.0 of the

Jake Wharton 1.4k Dec 29, 2022
Add a different ribbon to each of your Android app variants using this gradle plugin. Of course, configure it as you will

Easylauncher gradle plugin for Android Modify the launcher icon of each of your app-variants using simple gradle rules. Add ribbons of any color, over

Mikel 960 Dec 18, 2022
An Android Studio / IntelliJ plug-in help you upload your apk or listing to Google Play.

DroidLane An Android Studio / IntelliJ plug-in help you upload your apk or listing to Google Play. Installation Open Android Studio or IntelliJ IDEA O

Jintin 24 Jul 26, 2021
Gradle plugin which validates the licenses of your dependency graph match what you expect

Licensee ?? ?? A Gradle plugin which validates the licenses of your dependency graph match what you expect, or it fails your build! Jump to: Introduct

Cash App 506 Jan 8, 2023
Gradle plugin which helps you analyze the size of your Android apps.

Ruler Ruler is a Gradle plugin which helps you analyze the size of your Android apps. Motivation App size is an important metric which directly correl

Spotify 913 Dec 28, 2022
Audio notifications for your Gradle build status

Let me serenade you ?? View Releases and Changelogs ?? Currently only functional on Mac OSX ?? Serenador is a Gradle plugin that utilizes text-to-spee

Thanos Psaridis 7 Jun 27, 2022
Manage pull requests and conduct code reviews in your IDE with full source-tree context.

String Manipulation IntelliJ plugin - https://plugins.jetbrains.com/plugin/2162 Sponsored by Manage pull requests and conduct code reviews in your IDE

Vojtěch Krása 582 Dec 22, 2022
K6-intellij-plugin - IntelliJ-based Plugin to run k6 tests locally or in the k6 Cloud from your IntelliJ IDE

IntelliJ-based Plugin to run k6 tests locally or in the k6 Cloud from your Intel

Mikhail Bolotov 8 Jan 2, 2023
A plugin for Android Studio that speeds up your day-to-day flutter development.

Flutter-Toolkit 中文文档 A plugin for Android Studio that speeds up your day-to-day flutter development. Flutter ToolKit(Flutter Build Runner Helper), to

苏晟 4 Oct 19, 2022