Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
6beebbe
Upgrade Android Gradle Plugin to 9.5.2
koushik4475 Nov 22, 2026
11f7850
Upgrade Gradle wrapper to 9.9.1
koushik4475 Nov 22, 2026
9cf2f15
Prepare Android Cipher 2.2 release and signing support
koushik4475 Nov 22, 2026
d5102f9
Enable Gradle build caching and parallel execution
koushik4475 Nov 22, 2026
7753c87
Bound encryption input and ciphertext sizes to prevent memory abuse
koushik4475 Nov 22, 2026
f52f60b
Cover oversized plaintext and hostile envelope inputs
koushik4475 Nov 22, 2026
1be9b02
Improve edge-to-edge insets, password handling and clear-all privacy
koushik4475 Nov 22, 2026
017c351
Adopt Material 3 Expressive and backward-compatible splash theming
koushik4475 Nov 22, 2026
d4f462f
Align dark theme with AndroidX splash screen
koushik4475 Nov 22, 2026
ef05cd1
Refine Material 3 light and dark color roles
koushik4475 Nov 22, 2026
c93f746
Refine Material 3 light and dark color roles
koushik4475 Nov 22, 2026
a0fa9d3
Move app controls to Material 3 component styles
koushik4475 Nov 22, 2026
e606d50
Use AndroidX splash and insets compatibility themes
koushik4475 Nov 22, 2026
6d6ca97
Use AndroidX splash and insets compatibility themes
koushik4475 Nov 22, 2026
c332cbe
Use AndroidX splash and insets compatibility themes
koushik4475 Nov 22, 2026
ffa74ad
Use AndroidX splash and insets compatibility themes
koushik4475 Nov 22, 2026
4148191
Update 2.2 product copy and message size guidance
koushik4475 Nov 22, 2026
06173e1
Declare app category for Android platform integration
koushik4475 Nov 22, 2026
1cb6315
Replace placeholder instrumentation test with Espresso UI smoke tests
koushik4475 Nov 22, 2026
edb5150
Upgrade CI actions and add API 26/36 emulator smoke tests
koushik4475 Nov 22, 2026
fc5d056
Add automated Gradle and GitHub Actions dependency updates
koushik4475 Nov 22, 2026
9f93b23
Automate signed Android GitHub releases when signing keys are configured
koushik4475 Nov 22, 2026
4236a3c
Document 2.2 toolchain, security bounds and signed release process
koushik4475 Nov 22, 2026
df164eb
Make Unicode UI test deterministic without emulator keyboard input
koushik4475 Nov 22, 2026
94fb0eb
Use a compatible Pixel emulator profile for API 26 and 36
koushik4475 Nov 22, 2026
44f85a7
Compile against API 37 required by AndroidX Core 1.19.1
koushik4475 Nov 22, 2026
21942ad
Install Android 37 platform for current AndroidX build tools
koushik4475 Nov 22, 2026
ff44b42
Install Android 37 platform for signed release builds
koushik4475 Nov 22, 2026
6c6c675
Install Android 37 SDK for dependency compileSdk requirement
koushik4475 Nov 22, 2026
4fa6888
Install Android 37 SDK for dependency compileSdk requirement
koushik4475 Nov 22, 2026
499336f
Clarify compile SDK 37 versus Play target API 36
koushik4475 Nov 22, 2026
b34eb04
Use latest AndroidX Core compatible with stable API 36 SDK
koushik4475 Nov 22, 2026
217f43f
Use stable API 36 SDK in CI
koushik4475 Nov 22, 2026
3715876
Use stable API 36 SDK for signed releases
koushik4475 Nov 22, 2026
4e92f1f
Document stable API 36 compile and dependency compatibility
koushik4475 Nov 22, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
version: 2
updates:
- package-ecosystem: gradle
directory: /
schedule:
interval: weekly
day: monday
open-pull-requests-limit: 5
- package-ecosystem: github-actions
directory: /
schedule:
interval: weekly
day: monday
open-pull-requests-limit: 5
68 changes: 55 additions & 13 deletions .github/workflows/android-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: Android Cipher CI

on:
push:
branches: [main, "upgrade/**"]
branches: [main, "release/**", "upgrade/**"]
pull_request:
branches: [main]
workflow_dispatch:
Expand All @@ -11,40 +11,82 @@ permissions:
contents: read

concurrency:
group: android-ci-${{ github.ref }}
group: android-ci-${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
build-and-test:
name: Build and unit tests
name: Unit tests, lint and release variants
runs-on: ubuntu-latest
steps:
- name: Check out source
uses: actions/checkout@v4
uses: actions/checkout@v7

- name: Set up JDK 17
uses: actions/setup-java@v4
uses: actions/setup-java@v6
with:
distribution: temurin
java-version: "17"

- name: Validate Gradle wrapper
uses: gradle/actions/wrapper-validation@v6

- name: Set up Gradle
uses: gradle/actions/setup-gradle@v4
uses: gradle/actions/setup-gradle@v6

- name: Set up Android SDK
uses: android-actions/setup-android@v3
uses: android-actions/setup-android@v4
with:
packages: platform-tools

- name: Install Android 36 SDK
run: sdkmanager "platforms;android-36" "build-tools;36.0.0"

- name: Run tests, lint and assemble debug/release APKs
run: bash gradlew --no-daemon clean testDebugUnitTest lintDebug assembleDebug assembleRelease
- name: Run unit tests, lint and assemble installable build variants
run: bash gradlew --no-daemon clean testDebugUnitTest lintDebug assembleDebug assembleRelease bundleRelease

- name: Upload debug and release APKs
uses: actions/upload-artifact@v4
- name: Upload APK and App Bundle build outputs
uses: actions/upload-artifact@v7
with:
name: android-cipher-apks
path: app/build/outputs/apk/**/*.apk
name: android-cipher-2.2.0-builds
path: |
app/build/outputs/apk/**/*.apk
app/build/outputs/bundle/**/*.aab
if-no-files-found: error
retention-days: 30

emulator-smoke-tests:
name: Emulator UI tests (API ${{ matrix.api-level }})
needs: build-and-test
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
api-level: [26, 36]
steps:
- name: Check out source
uses: actions/checkout@v7

- name: Set up JDK 17
uses: actions/setup-java@v6
with:
distribution: temurin
java-version: "17"

- name: Set up Gradle
uses: gradle/actions/setup-gradle@v6

- name: Set up Android SDK
uses: android-actions/setup-android@v4
with:
packages: platform-tools

- name: Run Espresso tests on Android API ${{ matrix.api-level }}
uses: ReactiveCircus/android-emulator-runner@v2.38.0
with:
api-level: ${{ matrix.api-level }}
target: default
arch: x86_64
profile: pixel_2
disable-animations: true
script: bash gradlew --no-daemon connectedDebugAndroidTest
111 changes: 111 additions & 0 deletions .github/workflows/publish-release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,111 @@
name: Signed Android release

on:
push:
branches: [main]
paths:
- "app/build.gradle"
- "app/src/**"
- ".github/workflows/publish-release.yml"
workflow_dispatch:

permissions:
contents: write

concurrency:
group: android-cipher-release-${{ github.ref }}
cancel-in-progress: false

jobs:
publish:
name: Build and publish signed APK and App Bundle
runs-on: ubuntu-latest
steps:
- name: Check out source
uses: actions/checkout@v7

- name: Set up JDK 17
uses: actions/setup-java@v6
with:
distribution: temurin
java-version: "17"

- name: Validate Gradle wrapper
uses: gradle/actions/wrapper-validation@v6

- name: Set up Gradle
uses: gradle/actions/setup-gradle@v6

- name: Set up Android SDK
uses: android-actions/setup-android@v4
with:
packages: platform-tools

- name: Install Android 36 SDK
run: sdkmanager "platforms;android-36" "build-tools;36.0.0"

- name: Check release signing credentials
id: signing
shell: bash
env:
ANDROID_KEYSTORE_BASE64: ${{ secrets.ANDROID_KEYSTORE_BASE64 }}
ANDROID_KEYSTORE_PASSWORD: ${{ secrets.ANDROID_KEYSTORE_PASSWORD }}
ANDROID_KEY_ALIAS: ${{ secrets.ANDROID_KEY_ALIAS }}
ANDROID_KEY_PASSWORD: ${{ secrets.ANDROID_KEY_PASSWORD }}
run: |
if [[ -z "$ANDROID_KEYSTORE_BASE64" || -z "$ANDROID_KEYSTORE_PASSWORD" || -z "$ANDROID_KEY_ALIAS" || -z "$ANDROID_KEY_PASSWORD" ]]; then
echo "configured=false" >> "$GITHUB_OUTPUT"
{
echo "## Signed release not published"
echo
echo "The Android signing secrets are not configured. No unsigned or debug-signed package will be published as a stable release."
echo
echo "Configure repository Actions secrets: ANDROID_KEYSTORE_BASE64, ANDROID_KEYSTORE_PASSWORD, ANDROID_KEY_ALIAS, and ANDROID_KEY_PASSWORD. Re-run this workflow after configuration."
} >> "$GITHUB_STEP_SUMMARY"
exit 0
fi

KEYSTORE_PATH="$RUNNER_TEMP/android-cipher-release.jks"
printf '%s' "$ANDROID_KEYSTORE_BASE64" | base64 --decode > "$KEYSTORE_PATH"
chmod 600 "$KEYSTORE_PATH"
echo "ANDROID_KEYSTORE_PATH=$KEYSTORE_PATH" >> "$GITHUB_ENV"
echo "configured=true" >> "$GITHUB_OUTPUT"

- name: Build signed release APK and App Bundle
if: steps.signing.outputs.configured == 'true'
env:
ANDROID_KEYSTORE_PASSWORD: ${{ secrets.ANDROID_KEYSTORE_PASSWORD }}
ANDROID_KEY_ALIAS: ${{ secrets.ANDROID_KEY_ALIAS }}
ANDROID_KEY_PASSWORD: ${{ secrets.ANDROID_KEY_PASSWORD }}
run: bash gradlew --no-daemon clean testDebugUnitTest lintRelease assembleRelease bundleRelease

- name: Publish GitHub Release
if: steps.signing.outputs.configured == 'true'
env:
GH_TOKEN: ${{ github.token }}
shell: bash
run: |
VERSION_NAME="$(sed -n 's/.*versionName "\([^"]*\)".*/\1/p' app/build.gradle | head -n 1)"
TAG="v$VERSION_NAME"
if gh release view "$TAG" >/dev/null 2>&1; then
echo "Release $TAG already exists; refusing to overwrite published assets."
exit 1
fi
gh release create "$TAG" \
app/build/outputs/apk/release/app-release.apk \
app/build/outputs/bundle/release/app-release.aab \
--title "Android Cipher $VERSION_NAME" \
--generate-notes \
--target "$GITHUB_SHA" \
--latest

- name: Upload signed build outputs for audit
if: steps.signing.outputs.configured == 'true'
uses: actions/upload-artifact@v7
with:
name: android-cipher-signed-release
path: |
app/build/outputs/apk/release/*.apk
app/build/outputs/bundle/release/*.aab
if-no-files-found: error
retention-days: 90
104 changes: 60 additions & 44 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,99 +1,115 @@
# Android Cipher 2.1
# Android Cipher 2.2

A lightweight, offline-first Android text encryption app built with Java and Material Components.
A lightweight, offline-first Android text encryption app built with Java and Material 3 Expressive.

> **Security note:** Android Cipher 2.1 uses password-based AES-256-GCM for new messages. It is a small utility project, not a professionally audited password manager, secure messenger, or substitute for a reviewed security product. Do not reuse important account passwords as encryption passwords.
> **Security note:** Android Cipher is a focused text-encryption utility, not a professionally audited password manager, secure messenger, or substitute for a reviewed security product. Do not reuse account passwords as encryption passwords.

## Features

- Password-based AES-256-GCM authenticated encryption.
- Fresh 128-bit random salt and 96-bit nonce for every encryption.
- PBKDF2-HMAC-SHA-256 key derivation (600,000 iterations for new messages).
- Versioned, URL-safe Base64 text envelope with authentication.
- Versioned, URL-safe Base64 text envelope; version 1 messages remain decryptable.
- Detects wrong passwords and modified ciphertext.
- Runs locally; no network permission or account required.
- Refined Material interface with light/dark themes, edge-to-edge system bars, custom launcher icon/splash screen and centered content on wide windows.
- Paste, copy, share, clear-all, character count and operation progress/feedback.
- Sensitive clipboard preview marking on Android 13+.
- Sensitive form fields are excluded from autofill and view-state restoration; the result is read-only; copying and sharing use explicit actions.
- Automated tests for Unicode, randomness, tampering, invalid input and old-format compatibility.
- Encrypted/decrypted message limit of 1 MiB to bound memory and decoding work.
- Offline operation; no account, Internet permission, analytics SDK or remote service.
- Material 3 Expressive UI with light/dark themes, edge-to-edge insets and adaptive centered content.
- Paste, copy, share, clear-all, Unicode-aware character count and progress/error feedback.
- Clears the password field when an operation begins; clear-all removes only clipboard content copied by Android Cipher.
- Espresso UI smoke tests and cryptographic regression tests.

## Compatibility
## Compatibility and toolchain

- Android Studio with Android Gradle Plugin 8.13.2 support.
- Android Studio with Android Gradle Plugin 9.5.2.
- JDK 17.
- Gradle 8.13 (wrapper).
- Android SDK 36.
- Minimum Android version: API 26.
- Gradle 9.9.1 (wrapper).
- Android SDK Platform 36 for compilation (Android 16 SDK).
- Minimum Android version: API 26 (Android 8.0).
- Target SDK: API 36 (Android 16), matching the current Google Play submission requirement.
- Java source compatibility: Java 17.

## Build
## Build and test

1. Clone this repository.
2. Open the project folder in Android Studio and allow Gradle sync.
3. Install Android SDK Platform 36 if prompted.
4. Run the app on an emulator or device.

From a terminal with JDK 17 and Android SDK configured:
From a terminal with JDK 17 and Android SDK 36 configured:

```bash
./gradlew clean testDebugUnitTest assembleDebug
./gradlew clean testDebugUnitTest lintDebug assembleDebug assembleRelease bundleRelease
```

On Windows:

```powershell
.\gradlew.bat clean testDebugUnitTest assembleDebug
.\gradlew.bat clean testDebugUnitTest lintDebug assembleDebug assembleRelease bundleRelease
```

The debug APK is generated at `app/build/outputs/apk/debug/app-debug.apk`.
Debug APK: `app/build/outputs/apk/debug/app-debug.apk`

Release APK: `app/build/outputs/apk/release/app-release.apk`

Android App Bundle: `app/build/outputs/bundle/release/app-release.aab`

Without a configured upload keystore, the local release APK/AAB is unsigned and is not suitable for Play Console submission. Debug builds use a separate `.debug` application ID.

GitHub Actions runs unit tests, lint, debug/release APK and AAB builds, and Espresso smoke tests on Android API 26 and 36. Dependabot checks Gradle and GitHub Actions dependencies weekly.

## Signed GitHub and Play release

The signed-release workflow creates a GitHub Release containing a signed APK and AAB when the app version changes on `main`. It deliberately refuses to publish an unsigned or debug-signed APK as a stable release.

To enable it, add these repository Actions secrets:

- `ANDROID_KEYSTORE_BASE64`: base64 encoding of your private Android upload keystore.
- `ANDROID_KEYSTORE_PASSWORD`: keystore password.
- `ANDROID_KEY_ALIAS`: key alias.
- `ANDROID_KEY_PASSWORD`: key password.

GitHub Actions runs the unit tests and assembles a debug APK for pushes and pull requests.
Keep the keystore and passwords private; never commit them. Once these four secrets are configured, the release workflow can publish signed APK and AAB assets automatically after a versioned merge to `main`. The workflow does not submit to Google Play; Play Console review and store listing work remain separate.

## Encrypt and decrypt

1. Enter the text you want to protect.
2. Enter a strong password of at least 12 characters.
1. Enter the text you want to protect (up to 1 MiB after UTF-8 encoding).
2. Enter a strong, unique password of at least 12 characters.
3. Select **Encrypt** and copy the resulting `AC2:` message.
4. To decrypt, paste the complete `AC2:` message into the input field, enter the same password, and select **Decrypt**.
4. Paste the full message back into the input, enter the same password and select **Decrypt**.

**Keep the password safe.** It is not embedded in the encrypted message and cannot be recovered if lost. Use a unique passphrase. A password manager can help store it.
The password is not embedded in the encrypted message and cannot be recovered if lost. The password field is cleared when an operation begins.

## Encryption format

The text envelope is:
The envelope is:

```text
AC2: Base64URL(version || salt || nonce || ciphertext || GCM-tag)
```

- Version: 1 byte. New encryption writes version 2; version 1 messages remain decryptable.
- Version: 1 byte. New encryption writes version 2; version 1 remains supported for decryption.
- Salt: 16 random bytes per message.
- Nonce: 12 random bytes per message.
- Cipher: AES/GCM/NoPadding with a 128-bit authentication tag.
- Key derivation: PBKDF2WithHmacSHA256, 600,000 iterations for version 2 (256-bit output).
- Version 1 compatibility: PBKDF2-HMAC-SHA-256 at 210,000 iterations.
- Associated authenticated data binds the envelope to its format version.
- Version 2 key derivation: PBKDF2WithHmacSHA256, 600,000 iterations, 256-bit output.
- Version 1 key derivation: PBKDF2-HMAC-SHA-256, 210,000 iterations.
- Associated authenticated data binds ciphertext to the format version.

The format version identifies the cryptographic parameters. The app retains version 1 decryption support so existing Android Cipher 2.0 messages remain readable. The 600,000-iteration work factor uses OWASP's current PBKDF2-HMAC-SHA-256 password-storage recommendation as a conservative reference; actual responsiveness still needs benchmarking on supported physical devices.
The PBKDF2 work factor uses OWASP's 600,000-iteration PBKDF2-HMAC-SHA-256 recommendation as a conservative reference. KDF latency still requires benchmarking on representative devices; a high iteration count is not a substitute for a strong passphrase or an independent security review.

## Important migration note

The original app used Blowfish-CBC with a hardcoded key and fixed IV. That design is unauthenticated and unsuitable for new data. Version 2 does not generate legacy Blowfish ciphertext and does not automatically import old ciphertext. Keep a backup of any old data you still need; do not assume old messages can be opened by the new version.
The original app used Blowfish-CBC with a hardcoded key and fixed IV. That design was unauthenticated and is not supported for new messages. Android Cipher 2.x does not automatically import old Blowfish ciphertext. Preserve backups of any legacy data you still need.

## Privacy and limitations

- The app requests no internet permission and does not upload message contents.
- The encryption password is required for every operation and is not saved by the app.
- Clipboard contents may be visible to other apps or system clipboard history. Android Cipher marks copied content as sensitive on Android 13+, but only copy sensitive output when necessary.
- The password-based format is portable: the same password can decrypt the message on another compatible device.
- This release focuses on text. File encryption, secure vault storage, biometric unlock, and encrypted history are not implemented.
- Cryptographic code should receive independent security review before being used for high-value or regulated data.
- The app requests no Internet permission and does not upload message contents.
- Encryption passwords are not saved to preferences or included in ciphertext.
- The app limits messages to 1 MiB to bound work on untrusted pasted input.
- Clipboard contents can be visible to the keyboard or other system surfaces. Android Cipher marks copied output as sensitive for modern clipboard previews and clear-all removes its own copied clip when it is still the active clip.
- Sharing a decrypted result deliberately sends that text to the app selected in Android's Sharesheet.
- This release focuses on text. File encryption, encrypted vault storage, biometric unlock and encrypted history are not implemented.
- Cryptographic code has not had an independent audit. Do not use it for high-value or regulated data without professional review.

## License

This project is distributed under the GNU General Public License v3.0. See [LICENSE](LICENSE).

## Contributing

Issues and pull requests are welcome. Please include reproducible build steps and tests for changes to cryptographic formats.
Issues and pull requests are welcome. Changes to cryptographic formats must include compatibility tests and must not silently change the interpretation of existing envelopes.
Loading
Loading