Loading keystore/java/android/security/KeyStore.java +1 −1 Original line number Original line Diff line number Diff line Loading @@ -243,7 +243,7 @@ public class KeyStore { */ */ public long getmtime(String key) { public long getmtime(String key) { try { try { return mBinder.getmtime(key); return mBinder.getmtime(key) * 1000L; } catch (RemoteException e) { } catch (RemoteException e) { Log.w(TAG, "Cannot connect to keystore", e); Log.w(TAG, "Cannot connect to keystore", e); return -1L; return -1L; Loading keystore/tests/src/android/security/AndroidKeyStoreTest.java +6 −12 Original line number Original line Diff line number Diff line Loading @@ -577,17 +577,14 @@ public class AndroidKeyStoreTest extends AndroidTestCase { assertAliases(new String[] { }); assertAliases(new String[] { }); } } public void testKeyStore_DeleteEntry_EmptyStore_Failure() throws Exception { public void testKeyStore_DeleteEntry_EmptyStore_Success() throws Exception { mKeyStore.load(null, null); mKeyStore.load(null, null); try { // Should not throw when a non-existent entry is requested for delete. mKeyStore.deleteEntry(TEST_ALIAS_1); mKeyStore.deleteEntry(TEST_ALIAS_1); fail("Should throw KeyStoreException with non-existent alias"); } catch (KeyStoreException success) { } } } public void testKeyStore_DeleteEntry_NonExistent_Failure() throws Exception { public void testKeyStore_DeleteEntry_NonExistent_Success() throws Exception { mKeyStore.load(null, null); mKeyStore.load(null, null); // TEST_ALIAS_1 // TEST_ALIAS_1 Loading @@ -596,11 +593,8 @@ public class AndroidKeyStoreTest extends AndroidTestCase { assertTrue(mAndroidKeyStore.put(Credentials.USER_CERTIFICATE + TEST_ALIAS_1, FAKE_USER_1)); assertTrue(mAndroidKeyStore.put(Credentials.USER_CERTIFICATE + TEST_ALIAS_1, FAKE_USER_1)); assertTrue(mAndroidKeyStore.put(Credentials.CA_CERTIFICATE + TEST_ALIAS_1, FAKE_CA_1)); assertTrue(mAndroidKeyStore.put(Credentials.CA_CERTIFICATE + TEST_ALIAS_1, FAKE_CA_1)); try { // Should not throw when a non-existent entry is requested for delete. mKeyStore.deleteEntry(TEST_ALIAS_2); mKeyStore.deleteEntry(TEST_ALIAS_2); fail("Should throw KeyStoreException with non-existent alias"); } catch (KeyStoreException success) { } } } public void testKeyStore_GetCertificate_Single_Success() throws Exception { public void testKeyStore_GetCertificate_Single_Success() throws Exception { Loading Loading
keystore/java/android/security/KeyStore.java +1 −1 Original line number Original line Diff line number Diff line Loading @@ -243,7 +243,7 @@ public class KeyStore { */ */ public long getmtime(String key) { public long getmtime(String key) { try { try { return mBinder.getmtime(key); return mBinder.getmtime(key) * 1000L; } catch (RemoteException e) { } catch (RemoteException e) { Log.w(TAG, "Cannot connect to keystore", e); Log.w(TAG, "Cannot connect to keystore", e); return -1L; return -1L; Loading
keystore/tests/src/android/security/AndroidKeyStoreTest.java +6 −12 Original line number Original line Diff line number Diff line Loading @@ -577,17 +577,14 @@ public class AndroidKeyStoreTest extends AndroidTestCase { assertAliases(new String[] { }); assertAliases(new String[] { }); } } public void testKeyStore_DeleteEntry_EmptyStore_Failure() throws Exception { public void testKeyStore_DeleteEntry_EmptyStore_Success() throws Exception { mKeyStore.load(null, null); mKeyStore.load(null, null); try { // Should not throw when a non-existent entry is requested for delete. mKeyStore.deleteEntry(TEST_ALIAS_1); mKeyStore.deleteEntry(TEST_ALIAS_1); fail("Should throw KeyStoreException with non-existent alias"); } catch (KeyStoreException success) { } } } public void testKeyStore_DeleteEntry_NonExistent_Failure() throws Exception { public void testKeyStore_DeleteEntry_NonExistent_Success() throws Exception { mKeyStore.load(null, null); mKeyStore.load(null, null); // TEST_ALIAS_1 // TEST_ALIAS_1 Loading @@ -596,11 +593,8 @@ public class AndroidKeyStoreTest extends AndroidTestCase { assertTrue(mAndroidKeyStore.put(Credentials.USER_CERTIFICATE + TEST_ALIAS_1, FAKE_USER_1)); assertTrue(mAndroidKeyStore.put(Credentials.USER_CERTIFICATE + TEST_ALIAS_1, FAKE_USER_1)); assertTrue(mAndroidKeyStore.put(Credentials.CA_CERTIFICATE + TEST_ALIAS_1, FAKE_CA_1)); assertTrue(mAndroidKeyStore.put(Credentials.CA_CERTIFICATE + TEST_ALIAS_1, FAKE_CA_1)); try { // Should not throw when a non-existent entry is requested for delete. mKeyStore.deleteEntry(TEST_ALIAS_2); mKeyStore.deleteEntry(TEST_ALIAS_2); fail("Should throw KeyStoreException with non-existent alias"); } catch (KeyStoreException success) { } } } public void testKeyStore_GetCertificate_Single_Success() throws Exception { public void testKeyStore_GetCertificate_Single_Success() throws Exception { Loading