Вводные таковы: НW_ID = "12345", М_КЕY = "10121", USЕRРЕRМIT = "66B5CBFDF7E4139D5B6086C23130 (где первые 16 символов - зашифрованный НW_ID ключем М_КЕY)"
Для проверки алгоритма расшифровал обратно НW_ID из юзерпермита получив "12345", как должно было быть.
Но при попытке расшифровать сам ключ от карты (F81AC653B0AB63B0), который зашифрован HW_ІD(12345) получаю непонятные символы в онлайн сервисе для расшифровки и пустую строку в с++ библиотеке (видимо принимает все данные за padding).
Хотя в итоге должен был получить ключ из 5 символов. Согласно спецификации s63 везде используется одинаковый алгоритм шифрования.
Спойлер
3.2.2 Encryption of Other Protection Scheme Information
The Userpermit and the Cell permit contents are encrypted using a 48-bit key.
3.2.3 Encryption Algorithm – Blowfish
The scheme encrypts all information referenced in 3.1 using the Blowfish algorithm [9]. The algorithm is
unpatented and available in the public domain (___). Blowfish is a block cipher
algorithm that operates on 64 bit (8 byte) quantities. It requires that the data sources must be padded if
they are not a multiple of 8 bytes. The protection scheme uses the “DES in CBC Mode” padding algorithm
defined in [8] whenever any data sources must be padded. This complies with the ECB (Electronic Code
Book) mode of DES [7].
* К сожалению многие ссылки из документа не открываются и что там за padding algoritm defined in [8] посмотреть не удалось. Но исходя из того, что мне удалось расшифровать НW_ID из USЕRРЕRМIT, думаю что как онлайн сервис так и с++ библиотека используют верный pading алгоритм.
The Userpermit and the Cell permit contents are encrypted using a 48-bit key.
3.2.3 Encryption Algorithm – Blowfish
The scheme encrypts all information referenced in 3.1 using the Blowfish algorithm [9]. The algorithm is
unpatented and available in the public domain (___). Blowfish is a block cipher
algorithm that operates on 64 bit (8 byte) quantities. It requires that the data sources must be padded if
they are not a multiple of 8 bytes. The protection scheme uses the “DES in CBC Mode” padding algorithm
defined in [8] whenever any data sources must be padded. This complies with the ECB (Electronic Code
Book) mode of DES [7].
* К сожалению многие ссылки из документа не открываются и что там за padding algoritm defined in [8] посмотреть не удалось. Но исходя из того, что мне удалось расшифровать НW_ID из USЕRРЕRМIT, думаю что как онлайн сервис так и с++ библиотека используют верный pading алгоритм.
Очень удивляет полное отсутствие open-source кода для работы с S63 на различных репозиториях. Нет ни единого примера в сети.