Decap of a Cell Phone SIM card [video]
youtube.com
youtube.com
http://www.extremetech.com/computing/161870-the-humble-sim-c...
basically, telcos make sure only them can update the code there. it's a computer running 24h, with full network and sensor access, that you carry everywhere, and you have zero control or visibility
They say Java but it's basically C++. It's Java without strings and I'm not even sure it has normal 32-bit signed integers (heard somewhere that they didn't, but I can't find it right now). It's called Java Card by the way.
Like the video creator, I'm very surprised the humble SIM card has been made so capable!
I am quite sure that my first SIM card, 20 years ago, didn't have such setup and worked, quite the same.
Same thing with (modern) credit cards: you can send a transaction and a PIN code, and get a signed transaction in return, but you can't fetch the keys and sign arbitrary transactions afterwards.
SIM cards can have micro applications that get exposed via the "SIM Services" menu entry or something similar named.
That is how before the WAP days, the carriers used to offer SMS based applications.