Search code examples
gsmmodemat-command

How to check if the PIN has a certain value


I'm developing on a mobile gsm platform and I need to know the PIN in order to change it. Is there a way to verify if the PIN has a certain value?

I'm looking for the solution that makes use of AT commands since this is the only way to control the gsm modem.

I need this to prevent the use of the SIM card for data transfer, calls etc in personal phones or other devices.

Is there a simple way to find out what the PIN is (highly unlikely) or to check if the PIN is the one from a list of expected values?

Thanks


Solution

  • You cannot extract the pin with the standard command set, AT+CPIN=XXXX will respond with OK if XXXX is the correct pin, otherwise it will generate a CME error - however submitting 3 incorrect attempts can cause the SIM to lock until the PUK code is entered.

    If you know the PUK however, you could always change the pin to a known value without needing the original PIN (AT+CPIN again).