-
Notifications
You must be signed in to change notification settings - Fork 0
Hardware Biometric Security & OAEP
hughk edited this page Oct 3, 2026
·
1 revision
Pin Vault implements hardware-enforced cryptographic security using the Android KeyStore, Trusted Execution Environment (TEE) / StrongBox, and BiometricPrompt.
The cryptographic bridge between biometric verification and memory protection is managed by BiometricKeyManager.kt:
-
Hardware-Backed Key Generation:
- An RSA 2048-bit key pair (
pin_vault_biometric_key) is generated inside the Android KeyStore. - The private key is bound to biometric authentication (
setUserAuthenticationRequired(true)). - In Android 11+ (API 30+), keys are bound with
AUTH_BIOMETRIC_STRONG(Class 3 Hardware Biometrics). - New biometric enrollments immediately invalidate the key (
setInvalidatedByBiometricEnrollment(true)), preventing unauthorized access if a new fingerprint is added.
- An RSA 2048-bit key pair (
-
Sealing Secrets with Public Key Encryption:
- The public key is accessible without biometric prompts, allowing the application to seal card hints, master tokens, and TOTP seeds at any time.
-
Hardware-Enforced Decryption:
- To decrypt secrets, Android requires an authenticated
BiometricPrompt.CryptoObjectinitialized with the KeyStore private key. - Decryption can only occur in hardware TEE/StrongBox after the user successfully passes biometric verification.
- Frida, Xposed, or runtime memory hooks cannot bypass this hardware gate: calling
cipher.doFinal()without genuine biometric authentication fails withUserNotAuthenticatedException.
- To decrypt secrets, Android requires an authenticated
In v0.997, Pin Vault migrated from legacy PKCS#1 v1.5 padding to OAEP (Optimal Asymmetric Encryption Padding) with SHA-256:
- Padding Oracle Vulnerabilities: PKCS#1 v1.5 padding is deterministic and vulnerable to chosen-ciphertext padding oracle attacks (such as Bleichenbacher's attack and ROBOT). If an adversary can observe subtle distinctions in decryption errors, they can gradually decrypt ciphertexts without knowing the private key.
- NIST & Android Security Guidelines: NIST SP 800-131A and modern Android Security Guidelines mandate deprecating PKCS#1 v1.5 and NoPadding in favor of OAEP.
const val RSA_CIPHER_MODE = "RSA/ECB/OAEPWithSHA-256AndMGF1Padding"-
Digest: SHA-256 (
KeyProperties.DIGEST_SHA256). - MGF1 Digest: SHA-1 (standard hardware default for Android KeyStore).
-
Padding:
KeyProperties.ENCRYPTION_PADDING_RSA_OAEP.
To prevent decryption errors for users upgrading from earlier releases:
-
createDecryptionCipher()interceptsInvalidKeyException, safely purging obsolete KeyStore keys and generating a fresh OAEP hardware key. -
ensureMasterToken()tracksPREF_CIPHER_MODE(biometric_cipher_mode) in SharedPreferences. Upon detecting a cipher transition, it automatically reseals the master token with OAEP.
Pin Vault — Hardware-backed visual steganography for PINs and OTP codes. Licensed under GPL-3.0.
- Home
- Visual-Steganography-Engine
- Artist-Fingerpaint-Mode
- TOTP-Authenticator
- Hardware-Biometric-Security-&-OAEP
- Data-Storage-&-Backups
Repository: hughk/PinVault
Version: 0.997 (Beta)
License: GPL-3.0