Programming SIM card RAND?

Dieter Spaar spaar at
Sat Nov 24 13:14:36 UTC 2012

Hello Andrew,

On Sat, 24 Nov 2012 10:42:00 +0000, "Andrew Back" <andrew at> wrote:
> I bought one of those generic test SIMs from eBay that claim to work
> with HP8922 etc. testers. Now this is probably another stupid
> question, but how do I determine the IMSI and Ki? Or maybe set them
> ( doesn't seem to work with it).

For the IMSI you can read the appropriate EF of the SIM (the phone
does the same to get the IMSI). Ki usually cannot be read back but
because A3/A8 for a Test SIM is GSM XOR you can calculate Ki from
the SIM response to the RUN GSM ALGORITHM command. OpenBSC contains
code for the GSM XOR algorithm, this should give enough hints for
how the calculation is done.

For setting IMSI and Ki you most certainly have to contact the seller
of the SIM card and hope that he can/will tell you the details.

Best regards,
Dieter Spaar, Germany                           spaar at

More information about the baseband-devel mailing list