Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

euicc_init failed on 5ber standard edition #175

Closed
JohnDoe-JohnDoe opened this issue Dec 13, 2024 · 22 comments · Fixed by #181
Closed

euicc_init failed on 5ber standard edition #175

JohnDoe-JohnDoe opened this issue Dec 13, 2024 · 22 comments · Fixed by #181

Comments

@JohnDoe-JohnDoe
Copy link

I'm trying to use EasyLPAC (windows 11) with a 5ber "standard" eSim card.
I am using this card reader http://www.aliexpress.com/item/1005006885571475.html

I get a popup
Lpac error
Function:euicc_init
Data:
Please check log for details

When I look at the log:
C:\temp\EasyLPAC-windows-x86_64-with-lpac\lpac.exe version
{"type":"lpa","payload":{"code":0,"message":"success","data":"v2.1.0"}}

C:\temp\EasyLPAC-windows-x86_64-with-lpac\lpac.exe driver apdu list
{"type":"driver","payload":{"env":"DRIVER_IFID","data":[{"env":"0","name":"Generic Smart Card Reader Interface 0"}]}}
C:\temp\EasyLPAC-windows-x86_64-with-lpac\lpac.exe profile list
{"type":"lpa","payload":{"code":-1,"message":"euicc_init","data":""}}

I messaged EasyLPAC and was told it is an LPAC issue.

What am I doing wrong??

Thanks.

@CoelacanthusHex CoelacanthusHex changed the title Help with 5ber esim euicc_init failed on 5ber standard edition Dec 13, 2024
@Root-Core
Copy link
Contributor

I have a similar issue with the 5ber Standard, using Linux:

[manjaro-lenovo manjaro]# lpac version
{"type":"lpa","payload":{"code":0,"message":"success","data":"v2.1.0"}}
[manjaro-lenovo manjaro]# lpac driver apdu list
{"type":"driver","payload":{"env":"DRIVER_IFID","data":[{"env":"0","name":"Lenovo Integrated Smart Card Reader 00 00"}]}}
[manjaro-lenovo manjaro]# lpac profile list
{"type":"lpa","payload":{"code":-1,"message":"euicc_init","data":""}}

I have tested it on the same machine via. Windows and it shows the same behavior.

@rdtmaster
Copy link

rdtmaster commented Dec 16, 2024

@JohnDoe-JohnDoe ; @Root-Core
Try to exchange APDU commands with the card manually via some tool like https://github.com/tithanayut/APDUSender/releases/
How qill it react to

80AA00000AA9088100820101830107 //Term caps, should be 9000
0070000000 //open logical chan, should be 019000, if first byte is not 01 close all opened channels using 0070800x00
01A4040010A0000005591010FFFFFFFF8900000100 //select ISD-R aid
81E2910006BF3E035C015A //get card EID

This is the first thing I'd try to see if the issue is related to card or driver or LPAC.

@harshd3shpande
Copy link

Decided to give this a try with my 5ber Ultra.

`++APDUSender : Begin++

TrasmitAPDU : SUCCESS
<< 80 AA 00 00 0A A9 08 81 00 82 01 01 83 01 07
>> NO RESPONSE DATA
(90 00)

TrasmitAPDU : SUCCESS
<< 00 70 00 00 00
>> NO RESPONSE DATA
(6C 01)

TrasmitAPDU : SUCCESS
<< 00 70 80 00 00
>> NO RESPONSE DATA
(6A 81)

TrasmitAPDU : SUCCESS
<< 01 A4 04 00 10 A0 00 00 05 59 10 10 FF FF FF FF 89 00 00 01 00
>> NO RESPONSE DATA
(69 99)

TrasmitAPDU : SUCCESS
<< 81 E2 91 00 06 BF 3E 03 5C 01 5A
>> NO RESPONSE DATA
(68 81)`

Not sure what any of this means. Hope it doesn't damage my card. 😋

@rdtmaster
Copy link

rdtmaster commented Dec 17, 2024

@harshd3shpande

<< 00 70 00 00 00

NO RESPONSE DATA
(6C 01)

Well, the issue is definitely the card. Quick search suggests to try

80AA00000AA9088100820101830107
0070000001

If it returns 019000 you can go forward, otherwise please post the response code.

Hope it doesn't damage my card.

It shouldn't, but of course sending any apdu command is a 'do at your own risk' thing. These commands do not modify file system of your eUICC so I wouldn't worry if I were you. Hope that helps. I am not a smart card mega expert as well.

@harshd3shpande
Copy link

harshd3shpande commented Dec 17, 2024

@rdtmaster
Fwiw I also have a 9esim card which works fine with EasyLPAC and I still got the same response when I tried this on it.

TrasmitAPDU : SUCCESS
<< 00 70 00 00 00
>> NO RESPONSE DATA
(6C 01)

Tried the new commands you posted with 5ber Ultra.

++APDUSender : Begin++

TrasmitAPDU : SUCCESS
<< 80 AA 00 00 0A A9 08 81 00 82 01 01 83 01 07
>> NO RESPONSE DATA
(90 00)

TransmitAPDU : ERROR
<< 00 70 00 00 00 01
::: Error code: 87

@harshd3shpande
Copy link

Also got the same error code 87 with 9esim with 00 70 00 00 00 01

@Root-Core
Copy link
Contributor

I used gscriptor, but never worked with it before.. so I hope that helps:
This is with 5ber Standard.

Beginning script execution...

Sending: 80 AA 00 00 0A A9 08 81 00 82 01 01 83 01 07
Received: 90 00
Normal processing.

Script was executed without error...
Beginning script execution...

Sending: 00 70 00 00 00
Received: 6C 01
Wrong length Le: should be 0x01

Script was executed without error...
Beginning script execution...

Sending: 01 A4 04 00 10 A0 00 00 05 59 10 10 FF FF FF FF
89 00 00 01 00
Received: 6A 82
Wrong parameter(s) P1-P2. File not found.

Script was executed without error...
Beginning script execution...

Sending: 81 E2 91 00 06 BF 3E 03 5C 01 5A
Received: 6D 00
Instruction code not supported or invalid.

Script was executed without error...
Beginning script execution...

Sending: 80 AA 00 00 0A A9 08 81 00 82 01 01 83 01 07
Received: 90 00
Normal processing.

Script was executed without error...
Beginning script execution...

Sending: 00 70 00 00 00 01
Received: 6C 01
Wrong length Le: should be 0x01

Script was executed without error...

@rdtmaster
Copy link

rdtmaster commented Dec 17, 2024

@harshd3shpande @Root-Core

Also got the same error code 87 with 9esim with 00 70 00 00 00 01

My bad, I made a mistake when pasting the command. Of course I meant

0070000001

(there was an unwanted 00 byte somehow). Sorry about that.

@harshd3shpande
Copy link

harshd3shpande commented Dec 17, 2024

@rdtmaster Thanks. Got 019000 this time.

++APDUSender : Begin++

TrasmitAPDU : SUCCESS
<< 80 AA 00 00 0A A9 08 81 00 82 01 01 83 01 07
>> NO RESPONSE DATA
(90 00)

TrasmitAPDU : SUCCESS
<< 00 70 00 00 01
>> 01
(90 00)

TrasmitAPDU : SUCCESS
<< 01 A4 04 00 10 A0 00 00 05 59 10 10 FF FF FF FF 89 00 00 01 00
>> NO RESPONSE DATA
(69 99)

TrasmitAPDU : SUCCESS
<< 81 E2 91 00 06 BF 3E 03 5C 01 5A
>> NO RESPONSE DATA
(68 81)

@rdtmaster
Copy link

rdtmaster commented Dec 17, 2024

@harshd3shpande
Generally this error means the AID does not exist or is not selectable. That is strange but maybe 5ber somehow modified their card to use another AID in place of ISD-R. Unfo I don't have this card and couldn't experiment, though to make any final conclusion a sim tracing device would be needed to intercept the commands sent by 5ber app. I also searched for this issue and found some person were in the same boat when they used an unusual card reader (wireless/NFC one) but I doubt this is the case here.

You might try to select another aid just to see if it exists:

01A4040010A0000005591010FFFFFFFF8900000200

(Ecasd), but even if you can you will not be able to do much other than view card EID.

@Root-Core
Copy link
Contributor

Root-Core commented Dec 17, 2024

Beginning script execution...

Sending: 80 AA 00 00 0A A9 08 81 00 82 01 01 83 01 07
Received: 90 00
Normal processing.

Sending: 00 70 00 00 00
Received: 6C 01
Wrong length Le: should be 0x01

Sending: 01 A4 04 00 10 A0 00 00 05 59 10 10 FF FF FF FF
89 00 00 01 00
Received: 6A 82
Wrong parameter(s) P1-P2. File not found.

Sending: 81 E2 91 00 06 BF 3E 03 5C 01 5A
Received: 6D 00
Instruction code not supported or invalid.

Sending: 80 AA 00 00 0A A9 08 81 00 82 01 01 83 01 07
Received: 90 00
Normal processing.

Sending: 00 70 00 00 01
Received: 02 90 00
Normal processing.

Script was executed without error...


Beginning script execution...

Sending: 80 AA 00 00 0A A9 08 81 00 82 01 01 83 01 07
Received: 90 00
Normal processing.

Sending: 00 70 00 00 01
Received: 01 90 00
Normal processing.

Script was executed without error...
Beginning script execution...

Sending: 01 A4 04 00 10 A0 00 00 05 59 10 10 FF FF FF FF
89 00 00 01 00
Received: 6A 82
Wrong parameter(s) P1-P2. File not found.

Script was executed without error...
Beginning script execution...

Sending: 81 E2 91 00 06 BF 3E 03 5C 01 5A
Received: 6D 00
Instruction code not supported or invalid.

Script was executed without error...


Beginning script execution...

Sending: 80 AA 00 00 0A A9 08 81 00 82 01 01 83 01 07
Received: 90 00
Normal processing.

Sending: 00 70 00 00 01
Received: 01 90 00
Normal processing.

Sending: 01 A4 04 00 10 A0 00 00 05 59 10 10 FF FF FF FF
89 00 00 02 00
Received: 90 00
Normal processing.

Script was executed without error...
Beginning script execution...

Sending: 81 E2 91 00 06 BF 3E 03 5C 01 5A
Received: 6D 00
Instruction code not supported or invalid.

Script was executed without error...


a sim tracing device would be needed to intercept the commands sent by 5ber app

This is what I thought.. but unfortunally I do not have access to such a device.
I could try to decompile the app though.. this could also give us some insight.

@harshd3shpande
Copy link

@iebb over at NekokoLPA checked in this change meant to support 5ber. Although I haven't had much luck with their app either even with the latest version with the 5ber toggle turned on.

@JohnDoe-JohnDoe
Copy link
Author

I have tried NekokoLPA, both the playstore & github version. Both crash continuously. The 5ber ultra switch doesn't seem to make any difference. When it does connect to the card it gives 0B size.
Screenshot_2024-12-21-00-45-05-701

@rdtmaster
Copy link

rdtmaster commented Dec 21, 2024

@harshd3shpande @JohnDoe-JohnDoe @Root-Core

@iebb over at NekokoLPA checked in this change meant to support 5ber. Although I haven't had much luck with their app either even with the latest version with the 5ber toggle turned on.

Like I said, 5ber uses custom AID

A0000005591010FFFFFFFF8900050500

If you don't have trouble compiling lpac from source, I'd find euicc\euicc.c file, line 10 (#define ISD_R_AID "...), modify the corresponding AID and rebuild it. Unfo I don't have the 5ber card, but it should work given the AID is correct.

Or before doing that run APDU command:

01A4040010A0000005591010FFFFFFFF8900050500

To see if the AID is right.
(You might have logical channel open from previous try and fail, in that case run 0070800100 to close it prior).

@borghorst
Copy link

I have just changed the AID in the source code, compiled LPAC and could download an eSim profile to a 5ber standard card that was not working previously successfully.

Thanks @rdtmaster for the hint.

@JohnDoe-JohnDoe
Copy link
Author

That's good news.
Changing source code & compiling software is a bit beyond my capabilities.
It would be great if you could share your working version. Could you please upload it and send me the link.
Thanks,

@harshd3shpande
Copy link

@JohnDoe-JohnDoe I forked the repo. You can download the binaries from here. https://github.com/harshd3shpande/lpac/actions/runs/12528635582

Also download EasyLPAC from here https://github.com/creamlike1024/EasyLPAC/releases/tag/0.7.6.5

Replace the lpac.exe file included in EasyLPAC with the one from my fork.

@JohnDoe-JohnDoe
Copy link
Author

That's great thanks.
It now seems to connect to the 5ber sim, says 491kb free.
I am surprised that it doesn't show any profiles, when I insert it in a phone it shows a Hong Kong telecom so I assumed there was a profile already on the card. Is that normal?

@harshd3shpande
Copy link

Had you actually installed an eSIM on the card? Check on 5ber app to see if it shows any profiles on it. If it's a brand new 5ber card, then there shouldn't be any profiles on it.

@borghorst
Copy link

That's great thanks. It now seems to connect to the 5ber sim, says 491kb free. I am surprised that it doesn't show any profiles, when I insert it in a phone it shows a Hong Kong telecom so I assumed there was a profile already on the card. Is that normal?

Was the same with my card as well, it also showed 5ber as the provider name when installing it in a device. But there were no profiles on the card.

@JohnDoe-JohnDoe
Copy link
Author

Thanks.
The device I intend to use it in is not compatible with the 5ber app, my plan is to just set it up with EasyLPAC. I have tried the app on another device and it wanted me to set up an account so I gave up.
When I inserted the 5ber in a phone it connected to the network as a Hong Kong telecom, when I tried my 9esim it didn't connect, that made me think there was some kind of default pre-loaded profile on the 5ber and not on the 9esim.
As long as others are getting the same result then it's all good.
Many thanks to everyone for fixing this.

Root-Core added a commit to Root-Core/lpac that referenced this issue Jan 4, 2025
…up#157)

- Added env variable "CUSTOM_AID" for user defined AIDs
- Added support for 5ber by iterating over multiple pre-defined AIDs
@Root-Core
Copy link
Contributor

I implemented support for 5ber Standard via #181 please give some feedback, if it works out for you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants