This is a generator for the C-Netz Sim Card
"Berechtigungskarte als Speicherkarte". (memory card)

In the sub directory "simulator" you find an Arduino Sketch to simulate a memory card.

In the sub directory "programmer" you find an Arduino Sketch to program an SLE4428 card.

NOTE:
This will only work with old phones that were released before the CPU SIM was released.
The Smart Card "Berechtigungskarte als Prozessorkarte" is implemented at src/sim.


Run cnetz_memory_card_generator:

# ./extra/cnetz_memory_card_generator
Usage: ./cnetz_memory_card_generator <futln_nat> <futln_fuvst> <futln_rest> <sicherungscode> <sonderheitsschluessel>

# ./extra/cnetz_memory_card_generator 2222002

Magic Data 011..015 = 30 (0x1e)
Magic Data 018..020 = 7
Magic Data 021..023 = 2
FUTLN NAT = 2
FUTLN FUVST = 2
FUTLN REST = 22002
Sicherungscode=12345
Sonderheitenschluessel=0 (0x0000)
Wartungsschluessel=65535 (0xffff)

Binary data: (LSB first)
0xff, 0xf7, 0x5c, 0xff, 0xff, 0xff, 0xff, 0xff,
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x4b, 0x90,
0x5f, 0x25, 0x07, 0x0c, 0x00, 0x00, 0xfe, 0xfd,
0xfb, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,


After generation, the hex data can be copied to the data array of programmer/programmer.ino or simulator/simulator.ino

If you use the programmer, connect an SLE4428 or compatible as inicated at the pin definition of programmer.ino.

Note: The SLE card must not have protected serial number area. (ATR area)
Also the card must show all 416 written bits via ATR, not only 32 bits.

If you use the Arduino as emulator, connect the card reader as indicated at the pin definition of simulator.ino

Tested:
Works with BSA 51
Does not work with all other phones I have.

Test cards and monitor cards for BSA 51:
# ./extra/cnetz_memory_card_generator --special-key 898 2222002
# ./extra/cnetz_memory_card_generator --special-key 899 2222002
# ./extra/cnetz_memory_card_generator --magic1 0x1d --special-key 0x900 --maintenance-key 0xa139 2222002
# ./extra/cnetz_memory_card_generator --magic1 0x1d --special-key 0x901 --maintenance-key 0xa139 2222002

