Created
August 1, 2017 01:28
-
-
Save d0nutptr/493771425dd65c7a3b1f188aa4fcf4f4 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//transforms into PBKDF2-HMAC-SHA-256. | |
AndroidConceal.get().nativeLibrary.ensureCryptoLoaded(); | |
PBKDF2Hybrid encryptionKeyGenerator = new PBKDF2Hybrid(); | |
encryptionKeyGenerator.setIterations(KEY_DERIVATION_ROUNDS); | |
encryptionKeyGenerator.setSalt(encryptionSalt, 0, encryptionSalt.length); | |
encryptionKeyGenerator.setKeyLengthInBytes(ENC_KEY_SIZE); | |
encryptionKeyGenerator.setPassword(passwordBytes, 0, passwordBytes.length); | |
encryptionKeySecret = encryptionKeyGenerator.generate(); | |
PBKDF2Hybrid authenticationKeyGenerator = new PBKDF2Hybrid(); | |
authenticationKeyGenerator.setIterations(KEY_DERIVATION_ROUNDS); | |
authenticationKeyGenerator.setSalt(authenticationSalt, 0, authenticationSalt.length); | |
authenticationKeyGenerator.setKeyLengthInBytes(ENC_KEY_SIZE); | |
authenticationKeyGenerator.setPassword(encryptionKeySecret, 0, encryptionKeySecret.length); | |
authenticationKeySecret = authenticationKeyGenerator.generate(); | |
SecretKey encKey = new SecretKeySpec(encryptionKeySecret, 0, encryptionKeySecret.length, "AES"); | |
SecretKey authKey = new SecretKeySpec(authenticationKeySecret, 0, authenticationKeySecret.length, "AES"); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment