Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 88956ce3 authored by Bo Zhu's avatar Bo Zhu Committed by Android (Google) Code Review
Browse files

Merge "Remove the hard-coded counterId in VaultParams" into pi-dev

parents c6bd1855 f23c203e
Loading
Loading
Loading
Loading
+0 −3
Original line number Original line Diff line number Diff line
@@ -255,9 +255,6 @@ public class KeySyncTask implements Runnable {
            }
            }
        }
        }


        // TODO: make sure the same counter id is used during recovery and remove temporary fix.
        counterId = 1L;

        byte[] vaultParams = KeySyncUtils.packVaultParams(
        byte[] vaultParams = KeySyncUtils.packVaultParams(
                publicKey,
                publicKey,
                counterId,
                counterId,
+3 −2
Original line number Original line Diff line number Diff line
@@ -416,8 +416,8 @@ public class RecoverableKeyStoreManager {
     * @param vaultChallenge Challenge issued by vault service.
     * @param vaultChallenge Challenge issued by vault service.
     * @param secrets Lock-screen hashes. For now only a single secret is supported.
     * @param secrets Lock-screen hashes. For now only a single secret is supported.
     * @return Encrypted bytes of recovery claim. This can then be issued to the vault service.
     * @return Encrypted bytes of recovery claim. This can then be issued to the vault service.
     * @deprecated Use {@link #startRecoverySessionWithCertPath(String, RecoveryCertPath, byte[],
     * @deprecated Use {@link #startRecoverySessionWithCertPath(String, String, RecoveryCertPath,
     *         byte[], List)} instead.
     *         byte[], byte[], List)} instead.
     *
     *
     * @hide
     * @hide
     */
     */
@@ -457,6 +457,7 @@ public class RecoverableKeyStoreManager {
                uid,
                uid,
                new RecoverySessionStorage.Entry(sessionId, kfHash, keyClaimant, vaultParams));
                new RecoverySessionStorage.Entry(sessionId, kfHash, keyClaimant, vaultParams));


        Log.i(TAG, "Received VaultParams for recovery: " + HexDump.toHexString(vaultParams));
        try {
        try {
            byte[] thmKfHash = KeySyncUtils.calculateThmKfHash(kfHash);
            byte[] thmKfHash = KeySyncUtils.calculateThmKfHash(kfHash);
            return KeySyncUtils.encryptRecoveryClaim(
            return KeySyncUtils.encryptRecoveryClaim(
+0 −1
Original line number Original line Diff line number Diff line
@@ -296,7 +296,6 @@ public class KeySyncTaskTest {
                keyDerivationParams.getSalt(),
                keyDerivationParams.getSalt(),
                TEST_CREDENTIAL);
                TEST_CREDENTIAL);
        Long counterId = mRecoverableKeyStoreDb.getCounterId(TEST_USER_ID, TEST_RECOVERY_AGENT_UID);
        Long counterId = mRecoverableKeyStoreDb.getCounterId(TEST_USER_ID, TEST_RECOVERY_AGENT_UID);
        counterId = 1L; // TODO: use value from the database.
        assertThat(counterId).isNotNull();
        assertThat(counterId).isNotNull();
        byte[] recoveryKey = decryptThmEncryptedKey(
        byte[] recoveryKey = decryptThmEncryptedKey(
                lockScreenHash,
                lockScreenHash,