TLS Restriction with Private APN
Using TLS implies configuring a hostname, instead of an IP, in the SiTef server address parameter. In order for the TLS component to attest to the authenticity of the server, this hostname must be must be the same as the name on the TLS certificate.
Due to this restriction, TLS communication cannot be used in the GPRS scenario with Private APN. This is because, in general, there is no hostname resolution in this scenario — normally only the VPN IPs are used — which results in the authenticity check of the server's TLS certificate failing. Therefore, if the terminal uses a GPRS chip with Private APN, the application will not be able to use the TLS configuration.
If the application alternates between different forms of communication that include both the public Internet — where the use of TLS is mandatory by standard — as a Private APN — where there needs to be a secure VPN —, the application will need develop a configuration switching mechanism to turn on and off the TLS configuration according to the communication channel.
In other words, if the terminal is using public Internet communication (WiFi, Ethernet, Public APN), the application must activate the TLS configuration and define the Sitef address accordingly (i.e. use hostname instead of IP). And if the terminal is using Private APN communication with VPN, the application must disable the TLS configuration and set the SiTef address accordingly (i.e. use the VPN IP). In this case, it is important to make sure that the rules security measures applied to the application environment allow TLS to be turned off.
The application can implement this behavior in the most appropriate way for the structure of your source code. But, in general terms, the procedure to obtain this behavior must follow the following basic logic:
- Before starting each transaction, check which means of communication is currently active.
- If the communication requires TLS (if it is WiFi, Ethernet or Cellular with Public APN), enable TLS and set the SiTef address as the SiTef hostname.
- If the communication does not support TLS (Cellular with Private APN), disable TLS and set SiTef address as the SiTef IP in the VPN.
- Start the transaction.
Below, we illustrate this logic in code snippets considering the scenarios integration with CliSiTef and m-SiTef.