Topology Hiding

Module Documentation

[Overview] [Code Structure] [Configuration and Usage] [Example]

Overview

As SIP is a text based protocol all information is sent as plain text. Some headers contain sensitive information such as the addresses of entities from the home network or the number of such entities. Therefore, an operator may choose to hide this information in order to minimize the risk of attacks and to be able to perform changes to the internal network at will.

The headers in question here are : Via, Path, Record-Route and Service-Route.

The solution is to encrypt the headers as they leave the network and to decrypt the messages when they enter the internal network.

The Twofish encryption algorithm has been chosen for this purpose because of its speed and flexibility. However, if you consider it necessary you can use some other algorithm as the interface of the application allows such changes to be performed with relative ease.

Code Structure

The file thig_ims_enc.c provides the following functionality:

1.Initialization of the data structures needed by Twofish
2.Ability to encrypt a SER string (also adds padding in order to perform encryption, and performs BASE64 encoding in order to use only characters that do not confuse the SIP parsers).
3.Ability to decrypt a SER string (this removes the padding and decodes the previously BASE64 encoded string

Note: You may choose not to use the BASE64 encoding as this adds to the length of the SIP message.However be aware that doing so will result in incorrect parsing of the message as the ouput from the encryption algorithm can contain any character, including the ones used by the parser to delimit the parts of the message.If you choose to modify the parser accordingly, then the BASE64 encoding may indeed be superfluous.

If you choose to use another algorithm here you can call its own block encryption functions.

The file thig.c contains functions necessary to add the ICSCFs address to the SIP headers and also the functions that you can call to encrypt or decrypt headers.

Configuration and Usage

You may choose to tweak the following parameters :

in thig_ims_enc.c:
keySize - the Twofish key length.256 bits it's the biggest value and also provides the most security.If you choose to use a shorter key this can improve speed but also provide less security.
mode - the mode in which Twofish operates.MODE_EBC is not recommended as it yields obvious patterns in the encrypted strings and makes them prone to attacks or decyphering.

in thig_aes.h:
BLOCK_SIZE - number of bits per block (Twofish encrypts blocks of data)
MAX_BLK_CNT - max nr blocks per call in Twofish

You should be aware that a big value of the BLOCK_SIZE can lead to unnecessary padding being added to a SIPMessage (for Example if the BLOCK_SIZE converted into bytes is 16 a block of 2bytes will have to be padded with 14bytes to be encrypted).

Usage:
In provide thig functionality the functions from thig.c should be used.
I_THIG_encrypt_header and I_THIG_decrypt_header take as parameters the SIP message and the name of the header.Using this name the function searches for the header in the messages and then encrypts the information. However if you are not concerned with the details of each header then you should use I_THIG_encrypt_all_headers and I_THIG_decrypt_all_headers. Those functions try to encrypt/ decrypt all sensitive headers (Via, Route , Record-Route,Service-Route)

Example


Generated on Tue Oct 7 04:15:01 2008 for Open IMS Core CSCFs by  doxygen 1.5.2