Error while logging in on android registration client

When logging in to android registration client, an error of Invalid Machine Spec ID found is thrown when the app tries to saveAuthToken. Below are the logs:

E/LocalClientCryptoServiceImpl(16100): null
E/LocalClientCryptoServiceImpl(16100): javax.crypto.IllegalBlockSizeException
E/LocalClientCryptoServiceImpl(16100): at android.security.keystore2.AndroidKeyStoreCipherSpiBase.engineDoFinal(AndroidKeyStoreCipherSpiBase.java:613)
E/LocalClientCryptoServiceImpl(16100): at javax.crypto.Cipher.doFinal(Cipher.java:2056)
E/LocalClientCryptoServiceImpl(16100): at io.mosip.registration.keymanager.service.LocalClientCryptoServiceImpl.asymmetricDecrypt(LocalClientCryptoServiceImpl.java:344)
E/LocalClientCryptoServiceImpl(16100): at io.mosip.registration.keymanager.service.LocalClientCryptoServiceImpl.decrypt(LocalClientCryptoServiceImpl.java:284)
E/LocalClientCryptoServiceImpl(16100): at io.mosip.registration.clientmanager.service.LoginService.saveAuthToken(LoginService.java:67)
E/LocalClientCryptoServiceImpl(16100): at io.mosip.registration_client.api_services.AuthenticationApi$1.onResponse(AuthenticationApi.java:80)
E/LocalClientCryptoServiceImpl(16100): at retrofit2.DefaultCallAdapterFactory$ExecutorCallbackCall$1.lambda$onResponse$0$retrofit2-DefaultCallAdapterFactory$ExecutorCallbackCall$1(DefaultCallAdapterFactory.java:89)
E/LocalClientCryptoServiceImpl(16100): at retrofit2.DefaultCallAdapterFactory$ExecutorCallbackCall$1$$ExternalSyntheticLambda1.run(Unknown Source:6)
E/LocalClientCryptoServiceImpl(16100): at android.os.Handler.handleCallback(Handler.java:942)
E/LocalClientCryptoServiceImpl(16100): at android.os.Handler.dispatchMessage(Handler.java:99)
E/LocalClientCryptoServiceImpl(16100): at android.os.Looper.loopOnce(Looper.java:201)
E/LocalClientCryptoServiceImpl(16100): at android.os.Looper.loop(Looper.java:288)
E/LocalClientCryptoServiceImpl(16100): at android.app.ActivityThread.main(ActivityThread.java:7872)
E/LocalClientCryptoServiceImpl(16100): at java.lang.reflect.Method.invoke(Native Method)
E/LocalClientCryptoServiceImpl(16100): at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:548)
E/LocalClientCryptoServiceImpl(16100): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:936)
E/LocalClientCryptoServiceImpl(16100): Caused by: android.security.KeyStoreException: Invalid input length (internal Keystore code: -21 message: In KeystoreOperation::update
E/LocalClientCryptoServiceImpl(16100):
E/LocalClientCryptoServiceImpl(16100): Caused by:
E/LocalClientCryptoServiceImpl(16100): 0: In update: KeyMint::update failed.
E/LocalClientCryptoServiceImpl(16100): 1: Error::Km(ErrorCode(-21))) (public error code: 13 internal Keystore code: -21)
E/LocalClientCryptoServiceImpl(16100): at android.security.KeyStore2.getKeyStoreException(KeyStore2.java:369)
E/LocalClientCryptoServiceImpl(16100): at android.security.KeyStoreOperation.handleExceptions(KeyStoreOperation.java:78)
E/LocalClientCryptoServiceImpl(16100): at android.security.KeyStoreOperation.update(KeyStoreOperation.java:115)
E/LocalClientCryptoServiceImpl(16100): at android.security.keystore2.KeyStoreCryptoOperationChunkedStreamer$MainDataStream.update(KeyStoreCryptoOperationChunkedStreamer.java:222)
E/LocalClientCryptoServiceImpl(16100): at android.security.keystore2.KeyStoreCryptoOperationChunkedStreamer.update(KeyStoreCryptoOperationChunkedStreamer.java:156)
E/LocalClientCryptoServiceImpl(16100): at android.security.keystore2.KeyStoreCryptoOperationChunkedStreamer.doFinal(KeyStoreCryptoOperationChunkedStreamer.java:179)
E/LocalClientCryptoServiceImpl(16100): at android.security.keystore2.AndroidKeyStoreCipherSpiBase.engineDoFinal(AndroidKeyStoreCipherSpiBase.java:603)
E/LocalClientCryptoServiceImpl(16100): … 15 more
E/ (16100): Failed to save auth token
E/ (16100): io.mosip.registration.clientmanager.exception.InvalidMachineSpecIDException: Invalid Machine Spec ID found
E/ (16100): at io.mosip.registration.clientmanager.service.LoginService.saveAuthToken(LoginService.java:69)
E/ (16100): at io.mosip.registration_client.api_services.AuthenticationApi$1.onResponse(AuthenticationApi.java:80)
E/ (16100): at retrofit2.DefaultCallAdapterFactory$ExecutorCallbackCall$1.lambda$onResponse$0$retrofit2-DefaultCallAdapterFactory$ExecutorCallbackCall$1(DefaultCallAdapterFactory.java:89)
E/ (16100): at retrofit2.DefaultCallAdapterFactory$ExecutorCallbackCall$1$$ExternalSyntheticLambda1.run(Unknown Source:6)
E/ (16100): at android.os.Handler.handleCallback(Handler.java:942)
E/ (16100): at android.os.Handler.dispatchMessage(Handler.java:99)
E/ (16100): at android.os.Looper.loopOnce(Looper.java:201)
E/ (16100): at android.os.Looper.loop(Looper.java:288)
E/ (16100): at android.app.ActivityThread.main(ActivityThread.java:7872)
E/ (16100): at java.lang.reflect.Method.invoke(Native Method)
E/ (16100): at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:548)
E/ (16100): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:936)

The request to login is:
Url: https://{server address}/v1/syncdata/authenticate/useridpwd
Body: {
“request”: “eyJraWQiIDogIjU5OjIyOjc1OmY4OjllOjVmOjA1OjNlOjU3OmMwOjUyOmMyOjU0OjI4OjE3OjdiOjNmOmEwOjk2OjU3OjRhOjAyOmRlOmRlOjVlOjFhOmQwOmM2OmMwOmNmOmI4OjM5In0.eyJ1c2VySWQiIDogIm1vc2lwY2xpZW50IiwgInBhc3N3b3JkIjogIk1vc2lwQDEyMyIsICJhdXRoVHlwZSI6Ik5FVyIsICJ0aW1lc3RhbXAiIDogIjIwMjQtMDEtMTBUMDg6MTU6MzMuMDk3WiJ9.BC4A116WLmVIkk9HakFdtf3aoR2LYpSbT08zZQlVGApMsc9Z2noUDXHyNVaPBdYcgIAQm3snyLEGn8cpHIcCmbtP0HHUjMUiFiNW_Z08VVUH7PllLElfmtI3KgrbiWS5pW7_eVf_uv7qP09Db42SelM4XTNVvKUESkHYNmznJrt6qsFUH_dsFnhMfSvMZO75DNJcIsERYKl1TeIBJOZA9kO0YadDl7iTRUDqPZqEYM8dYMaMRvQsDnTPKHoYlBbzIWOeEwTQR3qOvSsy5Op-IZMw9ADueSNq1g1XQhEIic1xQ6DRCClh3tffByjIPBdaf7–EzLh8tiQy9n_9cK2Vw”,
“request_time”: “2024-01-10T08:15:33.345Z”
}

The response is:
{
“id”: null,
“version”: null,
“responsetime”: “2024-01-10T08:15:37.819Z”,
“metadata”: null,
“response”: “Y6w7s3IfF31Unv3pHXYLRwsBptwqjUjHJoMhOBInFWcYgU8T-wrKKac3l7ChUE8e_UbOVvOW4MJoGoOEePgn3RqVejk8hXWBVoX5OpzSutSqJnhDCwVFRFguXP2Jgr2eiaZ3OfnG4FbiFB1FsskUALu9VnAYos7mKACoCcE_UKGCrnV5Xb3PluZyH–TPhhEcyNfBp0OUonyNlyNbHaEQ_XeYfvI2RTtBi7HquO_ec5LpXH7nLnYPgmwyBtCCmr92qty29caHKKutbmn_G4JgIlyZF4OHB9aizDq58G0lbnhTlCamxA9vqwrsQbTXKfcSEcjHzB2mD61NJXnxhtHfcCRFlwJ2B19LNEZ6N2_xvjzWPkmCFYp0whXD_7xr-4A_uITNv1qHOl_rnuHHktmo50KfwLdX2n_QI5Cq4qtYP9RxAKD6i-GGY4VHOfATaji2hY8I_cc_YUj4-lUPnbhaaESPdp-wkLhF8ftozux4G__mNQdOzMnHbYfK0PYy7tt2EF0Cx6-OUDzaMu6a4zYzB4Pv-PGKX91ZmZxmE6sL1CTLz4IP7qhE5mtiZ-Eg5T-HMf0Zto_y-YXfpFRkIqQdgmzM6eul8d_A2tvoEXHelzgRElAw40rgN19J0DhF6w8hTfPVIsUagY7Z0wOxOVeBhd4gBsMVl9rRWvejI6D0AVdynz2c7y5oocUU_lLW_WqsvkHe6QpgynrpGJJr0bnKYQP79MYV2gyPe7JrktH5-GsfeGH5DGDM2kIaI3mO9crqR02m2YdlgOX2n2wRsIZ6b0v1uKrZCcnwyG3wlXJHi2MhC-2BOPKlQCgnjSojRLZZ13n3BD0jBYxgInBn3w_gWfIo-ID4ROvz3eao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o4B0ahGoZNUvOTqsDPBxzrOal0EetjyumfUio5nJXESnJCs3GHRs27qMezNGCG_u2Q4XuBGgkI-r-EHhnlYESLdn4dasGqtsagafPdSsCvqwKaN6dQPqnuW7R2vDMVQ_dgprjueKGP07Fh3i3tHo_D6i__FORom6bchhUCbEmnT-BefC2YjOR0KmbEyZte8Tu_tzCTcz8R7nYxIGZvtn63WFxc6M99cn6dsVfgGWEz7qnAZlNe1HdOd2z-fEX1WiKli8mR3U2rjA5w2qbYWqLxOxmpTWguwltCSQfSrtMhM2AM6oOQrdn7DiXqHlkfdKNGDD-UWut_CGqt-IaeIMSCGNDuczUPBvLvZb8NT1pe0LkJPT4_U1ozKOfILACP2udusN6I_AF_0zzP_Xpk1f6YpnMkN4U6Acnqv3BPQN7hC”,
“errors”:
}

From my debugging, the error seems to be coming from asymmetricDecrypt of the response. How can we solve this challenge.

Thanks

@Ajesh_Vs

1 Like

Hi @jeresaf

Thanks for sharing the error logs. I have informed the Android reg client team to look into this and respond to you with a solution ASAP!

@pragya Please look into this!

Best Regards,
Team MOSIP

Hi @pragya kindly update.

1 Like

Hi @pragya & @sanchi-singh24 , any further update…?

Hi @ajeshvs007

Apologies for the delayed response from our end as the team is occupied with pre-scheduled tasks for ARC but we will make sure you get an update by today!

Best Regards,
Team MOSIP

Hi Sanchi,

Thanks for the update, waiting for further updates.

Hi @ajeshvs007 ,

Apologies for the delay.

I have a few questions reg the setup you’re using.

Mosip Platform Version:
Android Registration Client : Is it dp1 release or from feature-flutter branch.
Machine Id(on which the android reg client was onboarded):

Can you confirm try setting up android registration client with “Android” as machine type.

Hi @jainhitesh9998,

Mosip Platform Version: v1.2.0.1-B3
Android Registration Client: feature-flutter
Machine Id: Its a value we get by long pressing the mosip icon on the login page, it’s different for the different devices we used

We didnt have a machine type of android on the admin portal, unless we are to add it and attach it to the android machine ID.

@ajeshvs007, can you confirm these details.

Hi @jeresaf ,

if you are using latest code from feature-flutter branch of mosip,

then we have removed the need to add machine type as Android. you can configure any machine type except “Android” and login should work.

if you are using dp1 release, Android is the only machine type which will work.

1 Like

Hi Team,

 I am facing compilation failure error while run the registration client set up code in local as mentioned in development guide.

Could you pls assist me on that error.

Thanks,
Narayana prakash.k


Hi @narayana_prakash ,

Can you please let us know which branch you checked out and also show where exactly is the compilation error coming from the code?

Regards,
Himaja

1 Like