line / line-sdk-android

LINE SDK for Android lets you integrate LINE into your Android app to create a more engaging experience for your users.
https://developers.line.biz/en/docs/android-sdk/
Apache License 2.0
134 stars 45 forks source link

LineLoginApi.getLoginIntent throws javax.crypto.KeyGenerator.generateKey exception #167

Open kightsonsanom opened 5 months ago

kightsonsanom commented 5 months ago

What did you do?

Tried to create login intent:

val authParams = LineAuthenticationParams.Builder()
            .scopes(listOf(Scope.PROFILE, Scope.OPENID_CONNECT, Scope.OC_EMAIL))
            .build()

val intent = LineLoginApi.getLoginIntent(context, "mychannelId", authParams)

The issue happens only to some users, in most cases it works fine. Happens on different devices and Android version, we couldn't find any relation between them.

What did you expect?

Intent created properly

What happened actually?

Exception is thrown

android.security.keystore2.AndroidKeyStoreKeyGeneratorSpi.engineGenerateKey (AndroidKeyStoreKeyGeneratorSpi.java:413)
javax.crypto.KeyGenerator.generateKey (KeyGenerator.java:612)
com.linecorp.android.security.encryption.StringAesCipher.createAesKey (StringAesCipher.kt:132)
com.linecorp.android.security.encryption.StringAesCipher.getAesSecretKey (StringAesCipher.kt:98)
com.linecorp.android.security.encryption.StringAesCipher.initialize (StringAesCipher.kt:36)
com.linecorp.linesdk.internal.EncryptorHolder$EncryptorInitializationTask.run (EncryptorHolder.java:48)
java.util.concurrent.ThreadPoolExecutor.runWorker (ThreadPoolExecutor.java:1137)
java.util.concurrent.ThreadPoolExecutor$Worker.run (ThreadPoolExecutor.java:637)
java.lang.Thread.run (Thread.java:1012)

Your environment?

Line SDK version: 5.10.0 Android Studio version: Android Studio Iguana | 2023.2.1 Happens on different devices and android versions. Highest Android version of reported crash is Android 13.