I have been looking for a tool to encrypt Ki
values (into eKi
) using AES encryption. Ki
is a 128-bit value used in authenticating the SIMs on the mobile network.
I was initially using the online AES encryption tool by Herbert Hanewinkel. But this tool is not convenient when I have more than a hundred Ki
values to encrypt.
As I could not find a suitable command line tool, I wrote a simple Perl script to perform the job. You can download the tool here.
The Perl script requires the use of the Crypt::Rijndael
module to perform the AES encryption. Note that the Crypt::Rijndael_PP
or Crypt::OpenSSL::AES
Perl modules could perform the encryption job as well.
AES encryption requires a key to encrypt the data. To encrypt the Ki
, a key, known as the A4Key
is normally used. To encrypt a Ki
with a value of 0x11111111111111111111111111111111
and a A4Key
with a value of 0x12345678901234567890123456789012
, run the script as follows:
1 |
$ aes-crypter.pl -e -s 128 -k 12345678901234567890123456789012 -t 11111111111111111111111111111111 |
The script is also able to perform AES decryption by passing the -d
option. Encryption is performed by passing the -e
option.
To perform encryption on multiple Ki
values, a simple shell script can be used to call the Perl script multiple times.
Download: AES Encryption tool