A comprehensive, modular, and production-ready security toolkit for Android apps. Includes encryption, hashing, biometric authentication, keychain management, root/debugger/simulator/reverse engineering detection, app integrity checks, network security, random data generation, and screen shield features.
- Encryption: AES-128, AES-256
- Hashing: MD5, SHA-1, SHA-256, SHA-512, HMAC-SHA256, HMAC-SHA512
- Biometric Authentication: Face ID, Touch ID, fallback to device passcode
- Keychain Management: Securely store, retrieve, update, and delete sensitive data
- Root, Debugger, Simulator, Reverse Engineering Detection
- App Integrity Checks: Code signing, file hashes, tampering
- Network Security: Proxy/VPN detection, certificate pinning, SSL validation
- Random Data Generation: Secure random strings, passwords, UUIDs, tokens
- Screen Shield: Prevent screenshots, prevent screen recording, blur on background
- Kotlin Coroutines: Async/await support for all major operations
- Jetpack Compose compatible
Add the dependency to your build.gradle
:
implementation("com.yourorg:android-security-toolkit:latest-version")
val appSecurity = AppSecurity.initialize(context)
val activity = context as? FragmentActivity
if (appSecurity.isBiometricAvailable(activity)) {
val biometricUtils = appSecurity.createBiometricUtils(
config = appSecurity.config.biometric,
activity = activity,
authCallback = object : BiometricUtils.AuthCallback {
override fun onAuthSuccessful(promptType: BiometricUtils.PromptType) {
// Handle success
}
override fun onAuthError(promptType: BiometricUtils.PromptType, errorCode: Int, errString: CharSequence) {
// Handle error
}
override fun onAuthFailed(promptType: BiometricUtils.PromptType) {
// Handle failure
}
}
)
biometricUtils.displayBiometricPrompt(BiometricUtils.PromptType.ENABLE_BIOMETRIC_LOGIN)
}
val encrypted = appSecurity.encrypt("secret".toByteArray(), EncryptionAlgorithm.AES_256, "password")
val decrypted = appSecurity.decrypt(encrypted, EncryptionAlgorithm.AES_256, "password")
val hash = appSecurity.hash("my data", HashingAlgorithm.SHA_256)
appSecurity.storeStringInKeychain("mySecret", "keyAlias")
val value = appSecurity.retrieveStringFromKeychain("keyAlias")
val isValid = appSecurity.verifyAppIntegrity()
val isSecure = appSecurity.checkNetworkSecurity()
appSecurity.enableScreenShield(activity)
Add your screenshots to the screenshots/
folder and reference them here:
Contributions are welcome! Please open issues and pull requests.
MIT License. See LICENSE for details.
Maintained by Muhammad Ahmad