nelenkov / android-keystore

Direct access to Android's credential storage (keystore)
Other
243 stars 72 forks source link

FC from KeyStore ln 75 AssertionError 1 and 5 #1

Open bfazen opened 12 years ago

bfazen commented 12 years ago

I just posted a longer explanation on your blog, but here is log if at all helpful. Thanks!

09-10 08:08:01.346: I/ActivityManager(59): Displayed activity org.nick.androidkeystore/.KeystoreActivity: 445 ms (total 445 ms)
09-10 08:08:01.466: I/keystore(36): uid: 10051 action: t -> 1 state: 1 -> 1 retry: 4
09-10 08:08:01.466: I/keystore(36): uid: 10051 action: t -> 1 state: 1 -> 1 retry: 4
09-10 08:08:01.596: D/KeystoreActivity(4894): Keystore state: UNLOCKED
09-10 08:08:01.706: I/keystore(36): uid: 10051 action: s -> 1 state: 1 -> 1 retry: 4
09-10 08:08:01.716: I/keystore(36): uid: 10051 action: t -> 1 state: 1 -> 1 retry: 4
09-10 08:08:01.716: D/KeystoreActivity(4894): Keys: 
09-10 08:08:01.726: I/keystore(36): uid: 10051 action: g -> 1 state: 1 -> 1 retry: 4
09-10 08:08:01.726: D/KeystoreActivity(4894):   test_key1: -8825863414354876680663630784384295312183551205364498841532107818494149774506
09-10 08:08:01.736: I/keystore(36): uid: 10051 action: g -> 1 state: 1 -> 1 retry: 4
09-10 08:08:01.736: D/KeystoreActivity(4894):   test_key0: -19378007423384393247659212638159071070138594974322013632346596321676577597408
09-10 08:08:01.825: W/dalvikvm(4894): threadid=12: thread exiting with uncaught exception (group=0x4001d800)
09-10 08:08:01.885: E/AndroidRuntime(4894): FATAL EXCEPTION: AsyncTask #5
09-10 08:08:01.885: E/AndroidRuntime(4894): java.lang.RuntimeException: An error occured while executing doInBackground()
09-10 08:08:01.885: E/AndroidRuntime(4894):     at android.os.AsyncTask$3.done(AsyncTask.java:200)
09-10 08:08:01.885: E/AndroidRuntime(4894):     at java.util.concurrent.FutureTask$Sync.innerSetException(FutureTask.java:273)
09-10 08:08:01.885: E/AndroidRuntime(4894):     at java.util.concurrent.FutureTask.setException(FutureTask.java:124)
09-10 08:08:01.885: E/AndroidRuntime(4894):     at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:307)
09-10 08:08:01.885: E/AndroidRuntime(4894):     at java.util.concurrent.FutureTask.run(FutureTask.java:137)
09-10 08:08:01.885: E/AndroidRuntime(4894):     at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1068)
09-10 08:08:01.885: E/AndroidRuntime(4894):     at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:561)
09-10 08:08:01.885: E/AndroidRuntime(4894):     at java.lang.Thread.run(Thread.java:1096)
09-10 08:08:01.885: E/AndroidRuntime(4894): Caused by: java.lang.AssertionError: 1
09-10 08:08:01.885: E/AndroidRuntime(4894):     at org.nick.androidkeystore.android.security.KeyStore.state(KeyStore.java:75)
09-10 08:08:01.885: E/AndroidRuntime(4894):     at org.nick.androidkeystore.KeystoreActivity$1.doWork(KeystoreActivity.java:139)
09-10 08:08:01.885: E/AndroidRuntime(4894):     at org.nick.androidkeystore.KeystoreActivity$KeystoreTask.doInBackground(KeystoreActivity.java:96)
09-10 08:08:01.885: E/AndroidRuntime(4894):     at org.nick.androidkeystore.KeystoreActivity$KeystoreTask.doInBackground(KeystoreActivity.java:1)
09-10 08:08:01.885: E/AndroidRuntime(4894):     at android.os.AsyncTask$2.call(AsyncTask.java:185)
09-10 08:08:01.885: E/AndroidRuntime(4894):     at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:305)
09-10 08:08:01.885: E/AndroidRuntime(4894):     ... 4 more
09-10 08:08:01.905: W/ActivityManager(59):   Force finishing activity org.nick.androidkeystore/.KeystoreActivity

...

09-10 08:18:08.966: I/ActivityManager(59): Starting activity: Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] flg=0x10200000 cmp=org.nick.androidkeystore/.KeystoreActivity }
09-10 08:18:09.166: I/keystore(36): uid: 10051 action: t -> 1 state: 1 -> 1 retry: 4
09-10 08:18:09.206: I/keystore(36): uid: 10051 action: t -> 1 state: 1 -> 1 retry: 4
09-10 08:18:09.206: I/keystore(36): uid: 10051 action: t -> 1 state: 1 -> 1 retry: 4
09-10 08:18:09.246: D/KeystoreActivity(27660): Keystore state: UNLOCKED
09-10 08:18:09.435: I/keystore(36): uid: 10051 action: t -> 1 state: 1 -> 1 retry: 4
09-10 08:18:09.475: I/keystore(36): uid: 10051 action: s -> 1 state: 1 -> 1 retry: 4
09-10 08:18:09.495: D/KeystoreActivity(27660): Keys: 
09-10 08:18:09.495: I/keystore(36): uid: 10051 action: g -> 1 state: 1 -> 1 retry: 4
09-10 08:18:09.505: D/KeystoreActivity(27660):  test_key1: -48453358114406951772358788725542992193076986772767435236646674819192049096916
09-10 08:18:09.505: I/keystore(36): uid: 10051 action: g -> 1 state: 1 -> 1 retry: 4
09-10 08:18:09.505: D/KeystoreActivity(27660):  test_key0: 12715778555170410776424802206206477859550137287931188221243440516653640148217
09-10 08:18:09.625: W/dalvikvm(27660): threadid=7: thread exiting with uncaught exception (group=0x4001d800)
09-10 08:18:09.655: E/AndroidRuntime(27660): FATAL EXCEPTION: AsyncTask #1
09-10 08:18:09.655: E/AndroidRuntime(27660): java.lang.RuntimeException: An error occured while executing doInBackground()
09-10 08:18:09.655: E/AndroidRuntime(27660):    at android.os.AsyncTask$3.done(AsyncTask.java:200)
09-10 08:18:09.655: E/AndroidRuntime(27660):    at java.util.concurrent.FutureTask$Sync.innerSetException(FutureTask.java:273)
09-10 08:18:09.655: E/AndroidRuntime(27660):    at java.util.concurrent.FutureTask.setException(FutureTask.java:124)
09-10 08:18:09.655: E/AndroidRuntime(27660):    at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:307)
09-10 08:18:09.655: E/AndroidRuntime(27660):    at java.util.concurrent.FutureTask.run(FutureTask.java:137)
09-10 08:18:09.655: E/AndroidRuntime(27660):    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1068)
09-10 08:18:09.655: E/AndroidRuntime(27660):    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:561)
09-10 08:18:09.655: E/AndroidRuntime(27660):    at java.lang.Thread.run(Thread.java:1096)
09-10 08:18:09.655: E/AndroidRuntime(27660): Caused by: java.lang.AssertionError: 5
09-10 08:18:09.655: E/AndroidRuntime(27660):    at org.nick.androidkeystore.android.security.KeyStore.state(KeyStore.java:75)
09-10 08:18:09.655: E/AndroidRuntime(27660):    at org.nick.androidkeystore.KeystoreActivity$1.doWork(KeystoreActivity.java:139)
09-10 08:18:09.655: E/AndroidRuntime(27660):    at org.nick.androidkeystore.KeystoreActivity$KeystoreTask.doInBackground(KeystoreActivity.java:96)
09-10 08:18:09.655: E/AndroidRuntime(27660):    at org.nick.androidkeystore.KeystoreActivity$KeystoreTask.doInBackground(KeystoreActivity.java:1)
09-10 08:18:09.655: E/AndroidRuntime(27660):    at android.os.AsyncTask$2.call(AsyncTask.java:185)
09-10 08:18:09.655: E/AndroidRuntime(27660):    at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:305)
09-10 08:18:09.655: E/AndroidRuntime(27660):    ... 4 more
09-10 08:18:09.665: W/ActivityManager(59):   Force finishing activity org.nick.androidkeystore/.KeystoreActivity
nelenkov commented 12 years ago

Nothing obvious, but maybe you are using the KeyStore class from multiple threads? It doesn't have any built-in locking, so you should take care of this (the sample app probably doesn't). Other than that, since this is not a supported 'API", you should test it on each device you intend to support to be sure.