Encrypt your keys at build time using the Bangcle WhiteCrypto tools.
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
buildSrc
example
generated_files_examples
gradle/wrapper
lib-exported
.gitignore
LICENSE
README.md
build.gradle
gradle.properties
gradlew
gradlew.bat
settings.gradle

README.md

This project mainly does the following things:

  • Integrate the java and so files generated by Bangcle WhiteCrypto System
  • Generate the CryptoUtils.java and Keys.java files automatically
    • The CryptoUtils.java is a simplified wrapper of Bangcle's crypto tools
    • The Keys.java contains the encrypted keys which are encrypted at build time

Starting

After you clone this repostory, you need to copy the java and so files generated by Bangcle WhiteCrypto System into the corresponding directory in lib-exported module. And then you need to configure the generator-plugin in the lib-exported/build.gradle.

apply plugin: 'bangcle'
bangcle {
    aesKeyHex = ... // Hex string of your AES key
    ivHex = ... // Hex string of your AES iv
    bangcleKey1 = ... // WhiteCrypto encryption key
    bangcleKey2 = ... // WhiteCrypto decryption key
    genPackage = ... // Target package of the generated java files

    keys {
        // key ConstantFiledName, SecretKeyValue
        key ..., ...
    }
}

Note that the generator-plugin will use AES/ECB/PKCS5Padding encryption algorithm to encrypt the keys if you don't provide the ivHex. Otherwise will use AES/CBC/PKCS5Padding encryption algorithm. You can generate random AES keys and ivs at https://asecuritysite.com/encryption/keygen.