Implement Encrypt and Decrypt in KeyStore [+more KeyStore support]
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 4.3k
- Forks
- 920
- PR merge metrics
- No merged PRs in 30d
Description
Feature description
Implement encrypt and decrypt in the termux-keystore (currently it only supports signing and verifying) via Cipher
This would enable passcodes, secrets, et cetera to be stored in the Android KeyStore, an example would be for automatic decryption of an rclone config file without storing the password in a text file (e.g. encrypted by gpg) using rclone's --password-command, and would enable easy integration with the FingerprintAPI/Biometric Authentication, which would resolve #246 and would also be more convenient than a passphrase or using pass (possibly more secure)
Reference implementation
- Using the KeyGenParameterSpec.Builder with PURPOSE_ENCRYPT | PURPOSE_DECRYPT, as well as examples of encrypting and decrypting a text with Cipher (this example would need to store the IV)
- LokileCrypt is an implemented example of Android KeyStore supporting encryption/decryption, it merges the encrypted data and a random IV header, as already supported with
cipher.getIV()which may be preferable so the IV is not stored separately. termux-keystore can also set a constant IV usingIVParameterSpecbut not preferable or derived from the alias, secret, such as what rclone does - How to get key from keystore on successful fingerprint auth
- Android Fingerprint API Encryption and Decryption
- Implement Cipher Encrypt/Decrypt
- Support Encrypt/Decrypt purposes, Termux currently uses 12 for sign+verify
- Update to API level 30 by replacing
setUserAuthenticationValidityDurationSecondswithsetUserAuthenticationParameters - Support non-Biometric
AUTH_DEVICE_CREDENTIAL(see above) - Credential/Biometric Prompt if key locked
- Option to keep key validated if Biometric enrollment changed using
setInvalidatedByBiometricEnrollment - Random IV header constructor and reader
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Review app/src/main/java/com/termux/api/apis/KeystoreAPI.java alongside FingerprintAPI.java and the termux-keystore package script. Check which of the listed Cipher, authentication, API-level, biometric, and random-IV requirements are actually present; done means the remaining requirements are implemented and the command interface supports them.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- android, java
- Domain
- api, mobile-dev, security
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100