Skip to content

A comprehensive, modular Android security library with biometrics, encryption, integrity, and Compose demo.

Notifications You must be signed in to change notification settings

programmer443/android-security-toolkit

Repository files navigation

Android Security Toolkit

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.

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

Installation

Add the dependency to your build.gradle:

implementation("com.yourorg:android-security-toolkit:latest-version")

Usage

Initialization

val appSecurity = AppSecurity.initialize(context)

Biometric Authentication (Jetpack Compose)

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)
}

Encryption

val encrypted = appSecurity.encrypt("secret".toByteArray(), EncryptionAlgorithm.AES_256, "password")
val decrypted = appSecurity.decrypt(encrypted, EncryptionAlgorithm.AES_256, "password")

Hashing

val hash = appSecurity.hash("my data", HashingAlgorithm.SHA_256)

Keychain Management

appSecurity.storeStringInKeychain("mySecret", "keyAlias")
val value = appSecurity.retrieveStringFromKeychain("keyAlias")

App Integrity Check

val isValid = appSecurity.verifyAppIntegrity()

Network Security

val isSecure = appSecurity.checkNetworkSecurity()

Screen Shield (Screenshot Restriction)

appSecurity.enableScreenShield(activity)

Screenshots

Add your screenshots to the screenshots/ folder and reference them here:

Biometric Prompt

Security Dashboard

Contributing

Contributions are welcome! Please open issues and pull requests.

License

MIT License. See LICENSE for details.

Author

Maintained by Muhammad Ahmad

About

A comprehensive, modular Android security library with biometrics, encryption, integrity, and Compose demo.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages