No announcement yet.

XPORT Pro AES encryption

  • Filter
  • Time
  • Show
Clear All
new posts

  • XPORT Pro AES encryption


    I now am using the XPORT Pro to communicate with an Android smartphone over the internet. Normal communication with the Smartphone is working fine. Now I want to implement AES encryption. However, as soon as I turn on AES and enter a key on the XPORT I do not receive any data anymore. I was expecting to receive encrypted data. Also with the CPR manager on the PC I do not receive any data. Only when I use the Secure CPR manager I receive data!

    For Android I have all the AES encyption/decryption code ready but I need encrypted data out of the XPORT to use them. My question now is how I can initiate the XPORT to output encrypted data?


    Tjerk bij de Leij

  • #2
    Sounds right.
    The first question is which side is the client and which is the sever? The client needs to send the initialization vector as the first 16 bytes of the stream.
    I suspect, you are connecting to the XPort (server) and your droid application does not send the IV; so the XPort just waits.


    • #3
      Hi Garry,

      Thanks for your reply. In my case Android is the client side. The XPORT is attached to a circuit with a microcontroller sending data. What do I need to send to the XPORT so it will send encrypted data to the Android client?




      • #4
        You need to send it the initialization vector.
        Traditionally, when you perform encryption, there is a shared secret key and a random initialization vector. The key length will vary based on AES128, 192 or 256. The IV is always 16 bytes. The IV will be used for initialization of both the encrypt and decrypt ciphers.
        I guess you should also know that we use Cipher Feedback 128 (CFB128) mode for data traversing a TCP connection.


        • #5
          Thanks again. I am new to AES so a lot of new terminology but I do not understand it completely yet... I understand that the IV is a 16 byte array. The value of the IV I can choose myself? Since I am using a 128-bit key this also goes for the key. But what data do I have to send to the XPORT Pro's serial port in order to get the encrypted data out of it?


          • #6
            You don't need to send the IV on the serial side, but on the network side when the Android device initiates the connection to the XPort Pro. The IV should be randomly generated, and 16 bytes in length.



            • #7
              Thanks. I am still puzzled how to send the IV. In Android I am opening a socket to the XPORT. Do you have any example code for this?


              • #8
                My problem is that I have all the java code to encrypt and decrypt based on a key and IV (see part of code below) but for decrypting the code needs encrypted data as input. I do not know how to initialize the network in such a way that encrypted data is comming out of the XPORT Pro's serial port.

                SecureRandom rnd = new SecureRandom();

                //Generate random IV of 128-bit (AES block size)
                byte[] IV = new byte[128 / 8];
                IvParameterSpec IVSpec = new IvParameterSpec(IV);

                //Create the cipher object to perform AES operations.
                //Specify Advanced Encryption Standard - Cipher Feedback Mode - No Padding
                Cipher AESCipher = Cipher.getInstance("AES/CFB/NoPadding");

                //Initialize the Cipher with the key and initialization vector.
                AESCipher.init(Cipher.ENCRYPT_MODE, key, IVSpec);


                • #9
                  Once you have the socket open from your Android device to the XPort Pro, send the IV as the first 16 bytes of data on that connection.

                  Then the encrypted communication will start.


                  • #10
                    I have tested this and now the encrypted data is outputted!

                    Thanks a lot, Tjerk


                    • #11
                      As mentioned earlier the XPORT Pro is using Cipher Feedback 128 (CFB128) mode but what kind of Cipher Algorithm Padding is used?