<!DOCTYPE article PUBLIC "-//NLM//DTD JATS (Z39.96) Journal Archiving and Interchange DTD v1.0 20120330//EN" "JATS-archivearticle1.dtd">
<article xmlns:xlink="http://www.w3.org/1999/xlink">
  <front>
    <journal-meta />
    <article-meta>
      <title-group>
        <article-title>Encryption in a High-Speed Connectionless File Transfer System∗</article-title>
      </title-group>
      <contrib-group>
        <contrib contrib-type="author">
          <string-name>Robert Tornai</string-name>
          <email>tornai.robert@inf.unideb.hu</email>
          <xref ref-type="aff" rid="aff0">0</xref>
          <xref ref-type="aff" rid="aff1">1</xref>
          <xref ref-type="aff" rid="aff2">2</xref>
        </contrib>
        <contrib contrib-type="author">
          <string-name>Dalma Kiss-Imre</string-name>
          <email>imre.dalma99@gmail.com</email>
          <xref ref-type="aff" rid="aff0">0</xref>
          <xref ref-type="aff" rid="aff1">1</xref>
          <xref ref-type="aff" rid="aff2">2</xref>
        </contrib>
        <contrib contrib-type="author">
          <string-name>Zoltán Gál</string-name>
          <xref ref-type="aff" rid="aff0">0</xref>
          <xref ref-type="aff" rid="aff1">1</xref>
          <xref ref-type="aff" rid="aff2">2</xref>
        </contrib>
        <aff id="aff0">
          <label>0</label>
          <institution>AMS Subject Classification: 68M10</institution>
          ,
          <addr-line>68M12</addr-line>
        </aff>
        <aff id="aff1">
          <label>1</label>
          <institution>Proceedings of the 1</institution>
        </aff>
        <aff id="aff2">
          <label>2</label>
          <institution>University of Debrecen, Faculty of Informatics</institution>
        </aff>
      </contrib-group>
      <fpage>233</fpage>
      <lpage>239</lpage>
      <abstract>
        <p>This paper describes the usage of encryption in FMFT (Fast Manager of File Transfer) program that is based on Xinan Liu's Reliable File Transfer Protocol. The system consists of a server and a client software pair utilizing UDP connection. The aim is to protect big data transfers by utilizing encryption maintaining the high transfer rates. Relying on Xinan Liu's solution a   -based minimum viable product was developed and further enhanced later, which was even more improved by rewriting it in C++. By adding a graphical user interface to the client, it is more user friendly now. Furthermore, by using WebAssembly, the program is available for many platforms now. After presenting the performance hit of the usage of encryption on data packets, it will be discussed that thanks to multithreading, our application can utilize the CPU in a better way.</p>
      </abstract>
      <kwd-group>
        <kwd>Encryption</kwd>
        <kwd>high-speed networking</kwd>
        <kwd>high-performance computing</kwd>
        <kwd>Internet</kwd>
        <kwd>parallel communication</kwd>
      </kwd-group>
    </article-meta>
  </front>
  <body>
    <sec id="sec-1">
      <title>1. Introduction</title>
      <p>
        We experienced at file transfers forth and back with a server hosted in the Gyires
supercomputer’s data center [
        <xref ref-type="bibr" rid="ref6">6</xref>
        ] that even gigabit connections can slow down to a
few megabit range on a busy network in real-life use cases having even packet loss
or damage [
        <xref ref-type="bibr" rid="ref15">15</xref>
        ]. This paper will focus on the encryption of the transferred packets
and the performance hit introduced by the handling algorithm. Furthermore, the
introduction of multithreading into the software will be discussed too.
      </p>
      <p>
        A User Datagram Protocol (UDP) based software handles big data transfers a
way better than Transmission Control Protocol (TCP) based solutions. There are
UDP based systems as UFTP and UFTPD software pair that mostly accomplish
our needed features [
        <xref ref-type="bibr" rid="ref16">16</xref>
        ], but they are not available in browsers, which is a basic
requirement in our project. Because of this, we decided to write an own
implementation designed for WebAssembly from scratch [
        <xref ref-type="bibr" rid="ref14">14</xref>
        ]. Furthermore, the Stream
Control Transmission Protocol (SCTP [
        <xref ref-type="bibr" rid="ref4 ref8">4, 8</xref>
        ]) was implemented in our server-client
pair [
        <xref ref-type="bibr" rid="ref19">19</xref>
        ]. It handles the data transfer and control feedback by utilizing both TCP
and UDP protocols.
      </p>
      <p>The structure of the paper is the following: in chapter two the development
environment of the fast file transfer manager application is described. In chapter
three encryption is presented. The multithreading work is detailed in chapter four.
The achievements are enlisted in chapter five. Possible continuation and future
research and development aims are described in chapter six.</p>
    </sec>
    <sec id="sec-2">
      <title>2. Developing Environment</title>
      <p>
        For the platform independent development the Qt 5.15.1 stable version was
chosen [
        <xref ref-type="bibr" rid="ref9">9</xref>
        ]. The server software was tested even under the upcoming Qt 6 snapshots,
the performance diference was not remarkable. This part of the work was carried
out on a Ubuntu 18.04.5 LTS desktop workstation. Qt supports mobile
equipment as Android and iOS besides a lot of desktop operating system targets as
Windows, Linux and macOS [
        <xref ref-type="bibr" rid="ref3">3</xref>
        ]. Through WebAssembly technology almost native
speed program running is available in modern web browsers [
        <xref ref-type="bibr" rid="ref13">13</xref>
        ]. To enable the
WebAssembly target,  ++11 was chosen as the programming language since it is
highly portable.
      </p>
      <p>
        The client is built for the necessary target system natively having a GUI (see
Figure 1.). The server is designed to run in headless mode. The client is planned
to be made usable from command line also. After testing our SCTP file transfer
system for desktop operating systems, we found that the performance of the TCP
based FTP transfer and our SCTP and UDP based file transfer implementations
need more investigation [
        <xref ref-type="bibr" rid="ref11">11</xref>
        ]. Diferent message sizes will be examined to find an
optimal value for later use as default.
      </p>
      <p>
        For testing purposes we used a gigabit network. The first solution to transfer
ifles was using the standard FTP protocol which runs over TCP. Similar to SABUL
[
        <xref ref-type="bibr" rid="ref5">5</xref>
        ], the initial approach in our software was to have a UDP data channel with a
TCP control channel. Project SABUL lived on as UDT until it was abandoned in
2013 [
        <xref ref-type="bibr" rid="ref20">20</xref>
        ]. Solutions based on UDP, especially by adopting rate-based algorithms,
give better performance than other alternatives according to Cosimo Anglano et
al. work [
        <xref ref-type="bibr" rid="ref1">1</xref>
        ]. Later this led us to the conclusion to refine our software to use
a UDP channel for the control messages also based on Xinan Liu’s Reliable File
Transfer Protocol [
        <xref ref-type="bibr" rid="ref10">10</xref>
        ]. His work achieved the first place in CS2105 (Introduction to
Computer Networks) Speed Contest AY15/16 Sem1. If the integrity of the packet
is damaged, a resend is needed as in the case of lost of either the data packet or
the acknowledge packet. It was measured that the CPU utilization of the  ++
code was less than our original   implementation’s [
        <xref ref-type="bibr" rid="ref7">7</xref>
        ].
      </p>
    </sec>
    <sec id="sec-3">
      <title>3. Encryption</title>
      <p>
        For encryption Datagram Transport Layer Security (DTLS) was taken into
consideration [
        <xref ref-type="bibr" rid="ref2">2</xref>
        ]. Due to its complexity, the first attempt to secure the packages sent
over the network a simpler encryption algorithm was chosen [
        <xref ref-type="bibr" rid="ref17">17</xref>
        ]. Qt has a sample
program having a very simple implementation for encrypting strings or byte arrays
called SimpleCrypt. The details of the algorithm is described in their wiki pages
[
        <xref ref-type="bibr" rid="ref18">18</xref>
        ]. Basically, it applies the exclusive OR bitwise operation between the data and
the predefined key.
      </p>
      <p>A 100 MB test file was used to carry out the measurements, its data was
transferred from the desktop workstation to the test server residing in the Gyires
supercomputer’s server room. Results of the consecutive transfers starting from
200 bytes to 4000 bytes of chunk sizes can be seen in Figure 2. It can be observed
that without encryption of data packets, the transfer rate stabilizes around 800
Mbps from chunk size of 700 bytes up to 4000 bytes.</p>
      <p>1,000</p>
      <p>800
]
s
p
b
M
[
e
a 600
t
r
r
e
f
s
n
a
r
T 400
200</p>
      <sec id="sec-3-1">
        <title>Transfer without encryption Transfer with encryption</title>
        <p>200
1,000
2,000
3,000
4,000</p>
      </sec>
      <sec id="sec-3-2">
        <title>Chunk size [bytes]</title>
        <p>The test machine has an Intel® Core™ i7 CPU 920 @ 2.67 GHz with 18 GB
memory having gigabit Ethernet connection, connected to the academic Internet
network running Ubuntu 18.04.5 LTS desktop version. The test server was a Cisco
UCS C240 M5 having gigabit Ethernet connection, connected to the Gyires
supercomputer. The applied virtual machine runs Ubuntu 18.04.5 LTS server version
under VMWare’s vSphere 6.7 having 20 GB memory and 8 cores of an Intel®
Xeon® Gold 6130 CPU @ 2.10 GHz.</p>
        <p>By encrypting the data packets, the transfer rate cross the 800 Mbps boundary
with 811 Mbps just at chunk size of 1100 bytes. The curve of results of transfer rates
with encryption stays almost entirely under the curve of raw transfer of packages.
Exception to this is chunk size of 2200 bytes where encrypted transfer rate of 836
Mbps was better by 1 Mbps over raw transfer rate of 835 Mbps. The diference is
mostly under 1.5% at 900 bytes chunk size or higher. This result was consistent
over various sized test data. For small chunk sizes as 600 bytes the diference can be
as high as almost 20%. At a very small cost SimpleCrypt yields a good protection
against attacks coming from third parties on the same network segment.</p>
        <p>SimpleCrypt has a compression option and we tested it also. It was found that
the packet size for text files could by reduced up to 50%. However, the typical data
for our use case is binary, and for this kind of data usually the gain was generally
around 5%. In the worst cases the compressed data was even bigger than original
packet. Because of the increased stress on the CPU besides the small gain, this was
not tested thoroughly. The next chapter describes our work toward multithreading.
When it will be implemented more extensively in our programs, we will move this
feature in a distinct thread and will test it deeply.</p>
      </sec>
    </sec>
    <sec id="sec-4">
      <title>4. Multithreading</title>
      <p>Multithreading was introduced into the client software first, because at long
workload the graphical user interface became unresponsible. Separating the GUI from
the work thread, the GUI elements as progress bar or buttons started to give
appropriate feedback. This could be achieved by using the signal-slot system of Qt. The
next essential change was to separate the connection setup from the data transfer.
This was done for the server also. Having a distinct thread for the data transfers
was a huge boost especially for the server program, because one thread has a
practical physical limit for the number of the clients to be served. Modern servers are
massively multithreaded nowadays, thus the number of served clients can be raised
this way.</p>
      <p>To optimize handling of new connections, the connection setup and data
transfer was split into two data ports. For each port a distinct thread is started up.
Consecutive data transfers from the same client can disturb each other if packets
from the first transfer are so late that they arrive during the second data transfer.
To minimize the packet mixing, the data transfers got a data port range of 256
elements. This range is used as a circular array, thus giving enough time for
wandering packets to arrive. 256 is practical because an unsigned byte can be used to
index it without computing modulo values each time. In this way, even one client
can initiate multiple data transfers concurrently to the server at the same time.
The server is also having a data port range having an own thread assigned for each
of them.</p>
    </sec>
    <sec id="sec-5">
      <title>5. Results</title>
      <p>Relying on Xinan Liu’s work a high-speed connectionless file transfer system was
developed by using UDP control channel. On busy connections data transfers were
sped up over 800 Mbps by utilizing multithreading among other factors. There is
always a chance for a man-in-the-middle attack. Even malicious nodes anywhere in
the network chain can tamper with packets or the integrity of the data transfers can
be damaged by accidental bit alternations. CRC checking fights eficiently against
packet modifications, but do not hide the transferred information. Encryption is a
good tool for protecting sensitive data. By using SimpleCrypt to mitigate threats,
the performance cost was generally under 1.5% at 900 bytes chunk size or higher.
This way we recommend to use it all the time.</p>
    </sec>
    <sec id="sec-6">
      <title>6. Future Work</title>
      <p>
        Datagram Transport Layer Security (DTLS) is a transport communication
protocol. It ensures security for datagram-based applications by letting them to
communicate in a way that is designed to prevent eavesdropping, tampering, or message
forgery [
        <xref ref-type="bibr" rid="ref2">2</xref>
        ]. Qt has a QDtls class for handling encrypted connections through UDP
sockets which was introduced in Qt 5.12 [
        <xref ref-type="bibr" rid="ref12">12</xref>
        ]. We are planning to use it for
securing the whole connection instead of the individual packets in the future. It may
introduce an overhead on the data transfers because the two peers first have to
successfully complete a TLS handshake. Broken transfers are still a problem, we will
make a solution for resuming them. Multithreading shall be even more improved.
      </p>
    </sec>
  </body>
  <back>
    <ref-list>
      <ref id="ref1">
        <mixed-citation>
          [1]
          <string-name>
            <given-names>C.</given-names>
            <surname>Anglano</surname>
          </string-name>
          ,
          <string-name>
            <surname>M.</surname>
          </string-name>
          <article-title>Canonico: A Comparative Evaluation of High-Performance File Transfer Systems for Data-intensive Grid Applications, 13th IEEE International Workshops on Enabling Technologies: Infrastructure for Collaborative Enterprises</article-title>
          (
          <year>June 2004</year>
          ), pp.
          <fpage>283</fpage>
          -
          <lpage>288</lpage>
          .
        </mixed-citation>
      </ref>
      <ref id="ref2">
        <mixed-citation>
          [2]
          <string-name>
            <given-names>Datagram</given-names>
            <surname>Transport Layer Security</surname>
          </string-name>
          ,
          <year>September 9</year>
          ,
          <year>2020</year>
          , url: https://en.wikipedia.org/wiki/Datagram_Transport_Layer_Security.
        </mixed-citation>
      </ref>
      <ref id="ref3">
        <mixed-citation>
          [3]
          <string-name>
            <given-names>L. Z.</given-names>
            <surname>Eng: Qt5 C+</surname>
          </string-name>
          <article-title>+ GUI Programming Cookbook: Practical recipes for building crossplatform GUI applications, widgets, and animations with Qt 5, 2nd</article-title>
          , Birmingham, England: Packt Publishing Ltd.,
          <source>March</source>
          <volume>27</volume>
          ,
          <year>2019</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref4">
        <mixed-citation>
          [4]
          <string-name>
            <given-names>V.</given-names>
            <surname>Gn</surname>
          </string-name>
          <article-title>: Multimedia Streaming in MANETs using SCTP, Paperback</article-title>
          , LAP LAMBERT Academic Publishing,
          <year>2019</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref5">
        <mixed-citation>
          [5]
          <string-name>
            <given-names>Y.</given-names>
            <surname>Gu</surname>
          </string-name>
          ,
          <string-name>
            <surname>R.</surname>
          </string-name>
          <article-title>Grossman: SABUL: A Transport Protocol for Grid Computing</article-title>
          ,
          <source>Journal of Grid Computing</source>
          <volume>1</volume>
          .4 (
          <issue>Dec</issue>
          .
          <year>2003</year>
          ), pp.
          <fpage>377</fpage>
          -
          <lpage>386</lpage>
          , issn:
          <fpage>1572</fpage>
          -
          <lpage>9184</lpage>
          , doi: https://doi.org/10.1023/B:GRID.
          <volume>0000037553</volume>
          .18581.
          <year>3b</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref6">
        <mixed-citation>
          [6]
          <string-name>
            <surname>Gyires</surname>
            <given-names>supercomputer</given-names>
          </string-name>
          ,
          <source>May</source>
          <volume>8</volume>
          ,
          <year>2020</year>
          , url: https://hpc.unideb.hu/hu/node/219.
        </mixed-citation>
      </ref>
      <ref id="ref7">
        <mixed-citation>
          [7]
          <string-name>
            <surname>Java</surname>
            <given-names>performance</given-names>
          </string-name>
          ,
          <source>The page was last edited on 7 November</source>
          <year>2019</year>
          , url: https://en.wikipedia.org/wiki/Java_performance#cite_note-43.
        </mixed-citation>
      </ref>
      <ref id="ref8">
        <mixed-citation>
          [8]
          <string-name>
            <surname>S. Khatri:</surname>
          </string-name>
          <article-title>SCTP Performance Improvement Based on: Adaptive Retransmission Time-Out Adjustment</article-title>
          , Paperback, LAP LAMBERT Academic Publishing,
          <year>2012</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref9">
        <mixed-citation>
          [9]
          <string-name>
            <given-names>G.</given-names>
            <surname>Lazar</surname>
          </string-name>
          , R. Penea:
          <article-title>Mastering Qt 5: Create stunning cross-platform applications</article-title>
          , Birmingham, England: Packt Publishing Ltd.,
          <source>December</source>
          <volume>15</volume>
          ,
          <year>2016</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref10">
        <mixed-citation>
          [10]
          <string-name>
            <given-names>X.</given-names>
            <surname>Liu</surname>
          </string-name>
          : ReliableFileTransferProtocol, October
          <volume>30</volume>
          ,
          <year>2015</year>
          , url: https://github.com/xinan/ReliableFileTransferProtocol/tree/master/src.
        </mixed-citation>
      </ref>
      <ref id="ref11">
        <mixed-citation>
          [11]
          <string-name>
            <given-names>D.</given-names>
            <surname>Madhuri</surname>
          </string-name>
          , P. C.
          <article-title>Reddy: Performance comparison of TCP, UDP and SCTP in a wired network</article-title>
          ,
          <source>in: 2016 International Conference on Communication and Electronics Systems (ICCES)</source>
          , Coimbatore, India, Oct.
          <year>2016</year>
          , pp.
          <fpage>1</fpage>
          -
          <lpage>6</lpage>
          , isbn:
          <fpage>978</fpage>
          -1-
          <fpage>5090</fpage>
          -1066-0, doi: https://doi.org/10.1109/CESYS.
          <year>2016</year>
          .
          <volume>7889934</volume>
          .
        </mixed-citation>
      </ref>
      <ref id="ref12">
        <mixed-citation>
          [12]
          <string-name>
            <given-names>QDtls</given-names>
            <surname>Class</surname>
          </string-name>
          ,
          <year>September 9</year>
          ,
          <year>2020</year>
          , url: https://doc.qt.io/qt-5/qdtls.html.
        </mixed-citation>
      </ref>
      <ref id="ref13">
        <mixed-citation>
          [13]
          <string-name>
            <surname>Qt for</surname>
            <given-names>WebAssembly</given-names>
          </string-name>
          ,
          <source>December</source>
          <volume>16</volume>
          ,
          <year>2019</year>
          , url: https://wiki.qt.io/Qt_for_WebAssembly.
        </mixed-citation>
      </ref>
      <ref id="ref14">
        <mixed-citation>
          [14]
          <string-name>
            <given-names>M.</given-names>
            <surname>Rourke</surname>
          </string-name>
          <article-title>: Learn WebAssembly: Build web applications with native performance using Wasm and C/C++</article-title>
          , 1st, Birmingham, England: Packt Publishing Ltd.,
          <source>September</source>
          <volume>24</volume>
          ,
          <year>2018</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref15">
        <mixed-citation>
          [15]
          <string-name>
            <given-names>H.</given-names>
            <surname>Sawashima</surname>
          </string-name>
          ,
          <string-name>
            <given-names>Y.</given-names>
            <surname>Hori</surname>
          </string-name>
          , H. Sunahara:
          <article-title>Characteristics of UDP Packet Loss: Efect of TCP Trafic , in: Proceeding of the 7th Annual Conference of the Internet Society</article-title>
          , Kuala Lumpur, Malaysia,
          <year>June 1997</year>
          , url: https : / / web . archive . org / web / 20160103125117 / https : /www . isoc . org / inet97 / proceedings/F3/F3_1.HTM.
        </mixed-citation>
      </ref>
      <ref id="ref16">
        <mixed-citation>
          [16]
          <string-name>
            <given-names>B.</given-names>
            <surname>Schuller</surname>
          </string-name>
          ,
          <string-name>
            <surname>T.</surname>
          </string-name>
          <article-title>Pohlmann: UFTP: High-Performance Data Transfer for UNICORE</article-title>
          ,
          <source>in: 7th UNICORE Summit</source>
          <year>2011</year>
          Proceedings, ed. by
          <string-name>
            <given-names>M.</given-names>
            <surname>Romberg</surname>
          </string-name>
          ,
          <string-name>
            <given-names>P.</given-names>
            <surname>Bała</surname>
          </string-name>
          , R. MüllerPfefferkorn, D. Mallmann, vol.
          <source>IAS Series 9</source>
          ,
          <string-name>
            <surname>Toruń</surname>
          </string-name>
          , Poland: Forschungszentrum Jülich GmbH,
          <year>July 2011</year>
          , pp.
          <fpage>135</fpage>
          -
          <lpage>142</lpage>
          , url: https://core.ac.uk/download/pdf/34995345.pdf#page=
          <fpage>144</fpage>
          .
        </mixed-citation>
      </ref>
      <ref id="ref17">
        <mixed-citation>
          [17]
          <article-title>Simple encryption with SimpleCrypt</article-title>
          ,
          <source>September</source>
          <volume>9</volume>
          ,
          <year>2020</year>
          , url: https://wiki.qt.io/Simple_encryption_with_SimpleCrypt.
        </mixed-citation>
      </ref>
      <ref id="ref18">
        <mixed-citation>
          [18]
          <article-title>SimpleCrypt algorithm details</article-title>
          ,
          <source>September</source>
          <volume>9</volume>
          ,
          <year>2020</year>
          , url: https://wiki.qt.io/SimpleCrypt_algorithm_details.
        </mixed-citation>
      </ref>
      <ref id="ref19">
        <mixed-citation>
          [19]
          <string-name>
            <given-names>R.</given-names>
            <surname>Tornai</surname>
          </string-name>
          ,
          <string-name>
            <given-names>D.</given-names>
            <surname>Kiss-Imre</surname>
          </string-name>
          ,
          <string-name>
            <given-names>P.</given-names>
            <surname>Fürjes-Benke</surname>
          </string-name>
          ,
          <string-name>
            <surname>Z.</surname>
          </string-name>
          <article-title>Gál: Developing a High-Speed Connectionless File Transfer System with WASM Based Client</article-title>
          ,
          <source>in: Proceedings of the 11th International Conference on Applied Informatics (ICAI)</source>
          (Eger, Hungary, Jan.
          <fpage>29</fpage>
          -
          <lpage>31</lpage>
          ,
          <year>2020</year>
          ), ed. by I. Fazekas, G. Kovásznai, T. Tómács, CEUR Workshop Proceedings 2650,
          <string-name>
            <surname>Aachen</surname>
          </string-name>
          ,
          <year>2020</year>
          , pp.
          <fpage>392</fpage>
          -
          <lpage>399</lpage>
          , url: http://ceur-ws.
          <source>org/</source>
          Vol-
          <volume>2650</volume>
          /#paper40.
        </mixed-citation>
      </ref>
      <ref id="ref20">
        <mixed-citation>
          [20]
          <article-title>UDP-based Data Transfer Protocol (UDT</article-title>
          ),
          <year>September 9</year>
          ,
          <year>2020</year>
          , url: https://udt.sourceforge.io/.
        </mixed-citation>
      </ref>
    </ref-list>
  </back>
</article>