implementation.tex (36332B)
1 Even though C has lost popularity in recent years, Frosix is free software, written in C. 2 Like every programming language, C has advantages and disadvantages. 3 \custind The main disadvantages are the non-trivial memory management, 4 the freedom that everything is just a pointer and that out-of-bound memory access is not checked. 5 \custind Therefore, during the development of Frosix, care was taken to create \glspl{struct} where possible, 6 to check against the size of an array before accessing it and to ensure, 7 that no substantial memory leak or use after free happens. 8 Especially, because it is nearly impossible for someone with little development experience to write bug-free software, 9 minor and probably also major bugs exist. 10 \custind On the other hand, Frosix benefits a lot from rich and performant libraries written in C. 11 As it was planned from the beginning to reuse parts of the codebase from GNU Anastasis, 12 the question of the programming language has never arisen. 13 14 \par Frosix is organized in different components. Figure~\ref{fig:system_comp_overview} gives an overview. 15 16 \begin{figure}[H] 17 \centering 18 \includegraphics[scale=0.5]{frosix_system_overview} 19 \caption{System components overview} 20 \label{fig:system_comp_overview} 21 \end{figure} 22 23 The middle box contains the core implementation of Frosix, including the implementation of the FROST protocol in the library libfrost. 24 At the bottom are the utilized external libraries 25 and on the left side are the implemented authentication methods. 26 27 \subsubsection{External Libraries} 28 \begin{itemize} 29 \item \textbf{Libsodium}: Sodium is a modern library for virtually all cryptographic tasks. 30 It is a fork of the well-known library NaCl, which is a library with implementations from reputable cryptographers. 31 And most importantly for Frosix, Sodium provides an implementation of the ristretto255 group. \cite{libsodium} 32 \item \textbf{Libgnunet}: GNUnet is not just a library, it is a framework for P2P networking. However, 33 Frosix only uses some of GNUnet's foundational libraries, and not the actual P2P networking stack. 34 The GNUnet libraries offer great functionality for logging, parsing from and to JSON (based on Libjansson) 35 and provide some elegant to use cryptographic operations without the need of additional wrapping (like with Libsodium). \cite{libgnunet} 36 \item \textbf{Libcurl}: libcurl provides functionalities for the basic network communication between a Frosix client and a \Gls{provider}. 37 It is probably the most used library for this purpose. \cite{libcurl} 38 \item \textbf{Libmicrohttpd}: The \Glspl{provider} are based on GNU libmicrohttpd, a very lightweight HTTP server offering great flexibility. \cite{libmicrohttpd} 39 \item \textbf{PostgreSQL}: PostgreSQL serves as the database for a \Gls{provider}. 40 It is open source, widely used and is being developed very actively, making it the default choice if there are no special requirements. \cite{postgresql} 41 \item \textbf{Libjansson}: Jansson is nowadays the standard library in C based project, if they work with JSON data. 42 Frosix not only utilizes Jansson to parse from and to JSON data in the network communication, but also to parse all from the CLI incoming and outputting data. \cite{libjansson} 43 \item \textbf{Libtaler}: Despite the payment system GNU Taler not being integrated in the current version of Frosix, 44 some of GNU Taler's libraries are already in use because they provide additional useful functionalities. \cite{Libtaler} 45 \end{itemize} 46 47 \newpage 48 \section{System Architecture} \label{chap:sys_arch} 49 A general overview of the architecture of Frosix is shown in Figure~\ref{fig:system_arch_overview}. 50 51 \begin{figure}[H] 52 \centering 53 \includegraphics[scale=0.5]{frosix_system_architecture} 54 \caption{System architecture overview} 55 \label{fig:system_arch_overview} 56 \end{figure} 57 58 \subsubsection{Frosix Files} 59 Every input and output to and from the CLI is in the form of JSON data, except purely informative messages. 60 Those inputs and outputs can be stored in various files, depending on the purpose. 61 The files can then easily be manipulated, copied, deleted or even encrypted, by hand or in an automated way. 62 63 \subsubsection{Command Line Interface} 64 The command line interface (CLI) of Frosix exposes all implemented functionality in various commands. 65 It allows the use of Frosix from a shell. 66 67 \subsubsection{Libfrosix}\label{impl:libfrosix} 68 In libfrosix, the input from the CLI is parsed into the different variables. 69 Furthermore, libfrosix is responsible for gathering and maintaining all required information, 70 triggering the necessary calls from the RESTclient, and handling the corresponding responses. 71 Also libfrosix provides the link to libfrost, in order to execute the steps from the FROST protocol. 72 If something goes wrong, it is up to libfrosix to abort the current command, 73 clean up everything and return a useful error message back to the user. 74 75 \subsubsection{Libfrost} 76 Libfrost is the implementation of the FROST protocol and provides an easy-to-use high level API. 77 Thus, libfrosix does not have to care about the complicated cryptography hidden inside the FROST protocol. 78 The second part of libfrost is the low level wrapping of all utilized functions from libsodium. 79 This is due to the fact that libsodium does not offer any typing, and therefore it is not safe to use. 80 81 \subsubsection{RESTclient}\label{impl:restclient} 82 As a counterpart to every REST endpoint from the Frosix Webserver, 83 there is an implementation of a REST startpoint on the client side. 84 The RESTclient encodes the inputs of each request into JSON data and sends them to a REST endpoint from a \Gls{provider}. 85 If there is a response, the RESTclient is responsible to decode the JSON data and pass them back to libfrosix. 86 87 \subsubsection{REST API} 88 The REST API is an instantiation of libmicrohttpd. It receives and forwards incoming request to the matching handlers. 89 90 \subsubsection{REST API Handlers} 91 There is a separate handler for every implemented REST endpoints. 92 The handlers include the main logic of a \Gls{provider}. 93 They parse the incoming data, do the verification, load and store data from the database via the database plugin 94 and use libfrost in order to perform the FROST protocol computation. 95 96 \subsubsection{Database} 97 Frosix uses a PostgreSQL database to store data both for a short duration and long-term. 98 All stored data have an expiration date and get eventually deleted with a regularly running garbage collection task. 99 100 \newpage 101 \section{Server Architecture} 102 A \Gls{provider} consists of a small webserver (libmicrohttpd), 103 some handlers to handle all the different requests, 104 a plugin to access the database, 105 a plugin to handle the different authentication methods 106 and libfrost (Figure~\ref{fig:server_arch}). 107 108 \begin{figure}[H] 109 \centering 110 \includegraphics[scale=0.5]{frosix_server_architecture} 111 \caption{Frosix server architecture} 112 \label{fig:server_arch} 113 \end{figure} 114 115 \subsubsection{REST API} 116 For detailed information about Frosix's RESTful API, see appendix A. 117 118 \subsubsection{Handlers} 119 \textbf{Terms Handler} 120 \newline Returns the terms of service of a \Gls{provider}. 121 At the moment, the terms of service are just a copy of the terms of service from GNU Anastasis \cite{anastasis} and must be adapted to Frosix. 122 123 \textbf{Config Handler} 124 \newline Returns the current configuration of a \Gls{provider}. 125 This includes supported authentication methods, public provider salt, public key and some more information. 126 127 \textbf{Seed Handler} 128 \newline Returns some high entropy bytes, which are used in the key generation process, 129 thus counteracting bad PRNG on client side. 130 131 \textbf{KeyGen Handlers} 132 \newline There are three sub-handlers, one for each round of the key generation protocol: 133 \begin{itemize} 134 \item \textbf{Dkg-Commitment}: Returns a deterministically derived commitment. 135 Whereas the size of such a request increases linearly with number of participating providers, 136 the size of a commitment increases linearly with the selected threshold value. 137 \item \textbf{Dkg-Shares}: Returns an encrypted share of a private key share for each other \Gls{provider}. 138 The size of this request can quickly escalate, because it linearly depends on the number of 139 participating \Glspl{provider}, as well as on the selected threshold value. 140 The size of the response, however, depends solely on the number of involved \Glspl{provider}. 141 \item \textbf{Dkg-Key}: Returns the final public key and a signature over the public key and the submitted authentication value (a salted hash). 142 Only the size of the request to this handler is dependent on the number of involved \Glspl{provider}. 143 \end{itemize} 144 145 \textbf{Sign Handlers} 146 \newline There are two sub-handlers, one for each phase: 147 \begin{itemize} 148 \item \textbf{Sig-Commitment}: Returns a commitment, derived from a random nonce and the submitted hash of the message. 149 \item \textbf{Sig-Share}: Returns the signature share. 150 Both the size of the request and of the response are linearly increasing with the threshold value. 151 \end{itemize} 152 153 \textbf{Key Delete Handler} 154 \newline Allows to delete the data stored in the database of a \Gls{provider}. 155 156 \textbf{Challenge Handler} 157 \newline A request to this handler triggers a challenge-code, which then is transferred over a different channel, 158 if the hash of the submitted authentication data and nonce match the stored hash. 159 160 \newpage 161 \section{Database} 162 The database schema of Frosix is shown below (Figure~\ref{fig:database_schema}). 163 164 \begin{figure}[H] 165 \centering 166 \includegraphics[scale=0.5]{frosix_database} 167 \caption{Frosix database schema} 168 \label{fig:database_schema} 169 \end{figure} 170 171 \subsubsection{Key} 172 This is the main table where all essential data used for authentication and signing is stored. 173 174 \begin{itemize} 175 \item \textbf{key\_id}: The identifier of key data is the hash of the encryption key. 176 \newline \(key\_id = H(encryption\_key)\) 177 \item \textbf{identifier}: The identifier is a unique number in the signing group. 178 This value can be anything between 1 and 254. 179 \item \textbf{expiration}: The expiration field contains a number indication for how many years a \Gls{provider} should store this entry. 180 \item \textbf{encryption\_nonce}: This field represents a high entropy value used in the encryption of the \textit{enc\_key\_data}. 181 \item \textbf{enc\_key\_data}: This is the encrypted key data, including the private key share and the public key. 182 \item \textbf{auth\_data}: The authentication data is a salted hash over a phone number, email address, postal address etc. 183 \end{itemize} 184 185 \subsubsection{Public\_Commitments} 186 The table \textit{pbulic\_commitments} is only used during a key generation process and stores the commitments of all other \Glspl{provider} between round 2 and 3. 187 188 \begin{itemize} 189 \item \textbf{dkg\_id}: The identifier of some stored public commitments is the ID of the corresponding \textit{dkg-*} request (see appendix~\ref{appendix_a} for more details about the request IDs). 190 \item \textbf{time\_stamp}: The time when the entry was created. 191 This value helps to clean up the database regularly, without deleting entries which are still in use. 192 \item \textbf{commitments}: This field stores a blob with the commitments from all other \Glspl{provider}. 193 \end{itemize} 194 195 Since there can be up to 253 commitments with each up to 253 values with a size of 32 bytes each, this table can grow quickly. 196 However, the usage of these values is for a short time, a few minutes at most. 197 This table should therefore be cleaned up regularly. 198 199 \subsubsection{Challengecode} 200 In contrast to the table \textit{public\_commitment}, the lifetime of these values is measured in days. 201 This table and the corresponding logic are part of the code reuse from GNU Anastasis \cite{anastasis} and are therefore not explained in detail. 202 203 \subsubsection{Seed} 204 This table stores the \gls{seed} which was used to generate the commitment in the first round of the signing process. 205 As with the entries in \textit{public\_commitments}, these values have a very short lifetime. 206 207 \begin{itemize} 208 \item \textbf{seed\_id}: The identifier of a seed is the hash over the hash of the encryption key and the hash of the message 209 \newline \(seed\_id = H(H(encryption\_key) || H(message))\). 210 \item \textbf{seed}: This field contains the freshly and random generated high entropy nonce. 211 \item \textbf{time\_stamp}: The time when this entry was created. 212 This value helps to clean up the database regularly, without deleting entries which are still in use. 213 \end{itemize} 214 215 There is no relation between the tables, because every table serves a different purpose 216 and the identifier of an entry is related to corresponding data in a request, except for the key table. 217 218 \section{Authentication Methods} 219 Following authentication methods are implemented, or can at least be integrated with little effort\footnote{The approach of challenge-code based authentication methods is implemented.}: 220 221 \begin{itemize} 222 \item \textbf{SMS}: A challenge-code, together with the hash of the message is sent in an SMS to the matching phone number. 223 \item \textbf{Email}: A challenge-code, together with the hash of the message is sent in an email to the matching email address. 224 \item \textbf{Mail}: A challenge-code, together with the hash of the message is sent in a letter to the matching postal address. 225 \item \textbf{Security Question}: Does not involve a challenge-code (see chapter \ref{chap:sec_question}). 226 \end{itemize} 227 228 \section{Client Architecture} 229 Frosix client consists out of three modules: 230 \begin{itemize} 231 \item Command line interface (CLI) 232 \item Libfrosix 233 \item RESTclient 234 \end{itemize} 235 236 The functionalities and responsibilities of Libfrosix and the RESTclient are already explained in chapter \ref{chap:sys_arch}. 237 238 \subsubsection{Command Line Interface} 239 The command line interface exposes useful commands to the user. 240 241 \textbf{Available Commands and Options} 242 \begin{itemize} 243 \item \textit{keygen -o signing\_document(.json) < providerlist(.json)}: 244 \newline takes a valid Frosix providerlist as input and does a distributed key generation with all listed \Glspl{provider} 245 \item \textit{export-pk -o public\_key(.json) < signing\_document(.json)}: 246 \newline takes a Frosix signing document and exports the public key and the signature of each involved \Gls{provider} 247 \item \textit{verify-pk < public\_key(.json)}: 248 \newline verifies all signatures in a Frosix public key document 249 \item \textit{request-challenge -a '{"provider\_index":\$provider\_index}' -m "\$message" < signing\_document(.json)}: 250 \newline requests a challenge-code for the specified \Gls{provider} 251 \item \textit{sign -a '{"1":"\$solution1", "2":"\$solution2"}' -m "\$message" -o signature(.json) < signing\_document(.json)}: 252 \newline signs a message with the provided challenge-codes or a secret answer 253 \item \textit{verify -m "\$message" < signature(.json)}: 254 \newline verifies a signature against a message 255 \item \textit{delete-key < signing document(.json)}: 256 \newline requests the deletion of all data stored at each \Gls{provider} from the provided Frosix signing document 257 \item \textit{-o} (output): 258 \newline writes the output to a file with the specified name 259 \item \textit{-a} (argument): 260 \newline submit further arguments, formatted as JSON 261 \item \textit{-m} (message): 262 \newline submit a message to sign (will always get hashed before signing) 263 \item \textit{<} (shell input redirection): 264 \newline redirects the content of a document as input to a command 265 \item \textit{\$provider\_index}: 266 \newline a value between 1 and 254 and must match a \Gls{provider} in the signing document (value is written without surrounding quotes) 267 \item \$message: 268 \newline the message that is to be signed or is already signed 269 \end{itemize} 270 271 \subsection{Frosix Files} 272 This chapters explains the use and structure of all Frosix files in detail. 273 274 \newpage 275 \subsubsection{Frosix Provider List} 276 A Frosix providerlist includes all necessary information to start a Frosix key generation process. 277 Below is a minimal example of a \textit{Frosix providerlist}. 278 Technically, it is possible to use only two \Glspl{provider} and a \textit{threshold-value} of 1. 279 280 \begin{verbatim} 281 { 282 "threshold": 2, 283 "expiration": 5, 284 "providers": [ 285 { 286 "url": "$PROVIDER_URL_1", 287 "public_key": "$PROVIDER_PUBLIC_KEY_1", 288 "auth_method": "sms", 289 "auth_data": "$PHONE_NUMBER" 290 }, 291 { 292 "url": "$PROVIDER_URL_2", 293 "public_key": "$PROVIDER_PUBLIC_KEY_2", 294 "auth_method": "question", 295 "auth_data": "The answer to life, the universe and everything", 296 "auth_answer": "42" 297 }, 298 { 299 "url": "$PROVIDER_URL_3", 300 "public_key": "$PROVIDER_PUBLIC_KEY_3", 301 "auth_method": "email", 302 "auth_data": "$EMAIL_ADDRESS", 303 } 304 ] 305 } 306 \end{verbatim} 307 308 \textbf{Frosix provider list values explained} 309 \begin{itemize} 310 \item \textit{threshold}: defines the \textit{threshold-value}. 311 \item \textit{expiration}: number of years until a \Gls{provider} should delete the private key share 312 \item \textit{providers}: list of chosen \Glspl{provider}, defines total number of providers at the same time (\Glspl{provider} may occur more than once) 313 \item \textit{url}: URL under which this \Gls{provider} is reachable 314 \item \textit{public\_key}: public key of this provider, to detect if someone is impersonating a \Gls{provider} 315 \item \textit{auth\_method}: method, which should be used for authentication before issuing a signature 316 \item \textit{auth\_data}: corresponding authentication data like a phone number or an email address 317 \item opt. \textit{auth\_answer}: hash of a public key, which is derived from the secret answer (only if auth\_method is \textit{question}). 318 \end{itemize} 319 320 Note: A \textit{Frosix provider list} can and should be deleted after being successfully used in Frosix key generation, 321 as it can contain sensitive information like the secret answer to a security questions. 322 323 \subsubsection{Frosix Signing Document} 324 A Frosix signing document contains all data required to request a challenge, 325 to start a Frosix sign process, to export the public key 326 and to delete the private key shares. 327 328 \begin{verbatim} 329 { 330 "public_key": "$PUBLIC_KEY", 331 "number_of_participants": 3, 332 "threshold": 2, 333 "providers": [ 334 { 335 "provider_index": 1, 336 "provider_name": "$PROVIDER_NAME_1", 337 "backend_url": "$PROVIDER_URL_1", 338 "encryption_key": "$ENCRYPTION_KEY_1", 339 "auth_method": "sms", 340 "auth_data": "$PHONE_NUMBER", 341 "auth_nonce": "$AUTH_NONCE_1", 342 "auth_hash": "$AUTH_HASH_1", 343 "provider_signature": "$PROVIDER_SIGNATURE_1" 344 "provider_public_key": "$PROVIDER_PUBLIC_KEY_1" 345 }, 346 { 347 "provider_index": 2, 348 "provider_name": "$PROVIDER_NAME_2", 349 "backend_url": "$PROVIDER_URL_2", 350 "encryption_key": "$ENCRYPTION_KEY_2", 351 "auth_method": "question", 352 "auth_data": "The answer to life, the universe and everything", 353 "auth_nonce": "$AUTH_NONCE_2", 354 "auth_hash": "$AUTH_HASH_2", 355 "provider_signature": "$PROVIDER_SIGNATURE_2" 356 "provider_public_key": "$PROVIDER_PUBLIC_KEY_2" 357 }, 358 { 359 "provider_index": 3, 360 "provider_name": "$PROVIDER_NAME_3", 361 "backend_url": "$PROVIDER_URL_3", 362 "encryption_key": "$ENCRYPTION_KEY_3", 363 "auth_method": "email", 364 "auth_data": "$EMAIL_ADDRESS", 365 "auth_nonce": "$AUTH_NONCE_3", 366 "auth_hash": "$AUTH_HASH_3", 367 "provider_signature": "$PROVIDER_SIGNATURE_3" 368 "provider_public_key": "$PROVIDER_PUBLIC_KEY_3" 369 } 370 ] 371 } 372 \end{verbatim} 373 374 \textbf{Frosix signing document's values explained}\label{sec:frosix_sign_document} 375 \begin{itemize} 376 \item \textit{public\_key}: the public key to verify a signature, which is created based on this Frosix signing document 377 \item \textit{number\_of\_participants}: this value could technically be omitted and is therefore just supporting information 378 \item \textit{threshold}: the threshold value which defines how many \Glspl{provider} are necessary to issue a valid signature 379 \item \textit{providers}: list of all \Glspl{provider}, which were part of the preceding Frosix key generation 380 \item \textit{provider\_index}: unique identifier of this \Gls{provider} in the group, a value between 1 and 254 381 \item \textit{provider\_name}: human-friendly name of this \Gls{provider} (received from a GET /config request) 382 \item \textit{backend\_url}: URL under which this provider is reachable 383 \item \textit{encryption\_key}: this value is needed to find the corresponding encrypted private key share in the \Gls{provider} 's database and to decrypt that private key share 384 \item \textit{auth\_method}: method which is used for authentication 385 \item \textit{auth\_data}: data which corresponds to the chosen authentication method (phone number, email address, etc.) 386 \item \textit{auth\_nonce}: salt which was used to hash the authentication data 387 \item \textit{auth\_hash}: the resulting hash 388 \newline Note: the authentication hash is not absolutely necessary, 389 except in the case where the authentication method is of type \textit{question} (since we do not want to store the secret answer in plaintext). 390 \item \textit{provider\_signature}: a signature from this \Gls{provider} over the \textit{public\_key} and the \textit{auth\_hash} 391 \item \textit{provider\_public\_key}: public key of this \Gls{provider} which was used to create the \textit{provider\_signature} (public key is received from a GET /config request) 392 \end{itemize} 393 394 Note: Even though the security of Frosix does not rely on the confidentiality of a Frosix signing document, 395 it should nevertheless be handled like a private signing key. 396 In case of disclosure, the chosen \textit{threshold-value} and the possible combinations of authentication methods can still provide strong protection. 397 \custind In such a situation we recommend deleting all private key shares as soon as possible and creating a new Frosix signing document. 398 399 \subsubsection{Frosix Public key} 400 Unlike a Frosix signing document, a Frosix public key can and should be published to those, who have to verify our signatures. 401 402 \begin{verbatim} 403 { 404 "public_key": "$PUBLIC_KEY", 405 "providers": [ 406 { 407 "provider_name": "$PROVIDER_NAME_1", 408 "backend_url": "$PROVIDER_URL_1", 409 "auth_hash": "$AUTH_HASH_1", 410 "provider_signature:" "$PROVIDER_SIGNATURE_1", 411 "provider_public_key": "$PROVIDER_PUBLIC_KEY_1" 412 }, 413 { 414 "provider_name": "$PROVIDER_NAME_2", 415 "backend_url": "$PROVIDER_URL_2", 416 "auth_hash": "$AUTH_HASH_2", 417 "provider_signature:" "$PROVIDER_SIGNATURE_2", 418 "provider_public_key": "$PROVIDER_PUBLIC_KEY_2" 419 }, 420 { 421 "provider_name": "$PROVIDER_NAME_3", 422 "backend_url": "$PROVIDER_URL_3", 423 "auth_hash": "$AUTH_HASH_3", 424 "provider_signature:" "$PROVIDER_SIGNATURE_3", 425 "provider_public_key": "$PROVIDER_PUBLIC_KEY_3" 426 } 427 ] 428 } 429 \end{verbatim} 430 431 For a detailed description of those values, see chapter~\ref{sec:frosix_sign_document}. 432 433 \subsubsection{Frosix signature} 434 435 \begin{verbatim} 436 { 437 "message_hash": "$MESSAGE_HASH", 438 "public_key": "$PUBLIC_KEY", 439 "signature_r": "$SIGNATURE_R_VALUE", 440 "signature_z": "$SIGNATURE_Z_VALUE" 441 } 442 \end{verbatim} 443 444 \textbf{Frosix signature's values explained}\ 445 \begin{itemize} 446 \item \textit{message\_hash}: hash of the signed message, not absolutely necessary since the message itself always has to be submitted to verify the signature 447 \item \textit{public\_key}: public key which corresponds to the private key used to issue this signature 448 \item \textit{signature\_r}: first part of the signature 449 \item \textit{signature\_z}: second part of the signature 450 \end{itemize} 451 452 Note: Both signature values could be combined in one value in the future. 453 454 \newpage 455 \section{Application Flow} 456 In this section, the different flows between the Frosix client and the \Glspl{provider} are described. 457 458 \subsubsection{Distributed Key Generation} 459 Figure \ref{fig:dkg_sequence} illustrates the Frosix key generation process. 460 The specifications of the REST endpoints can be found in appendix~\ref{appendix_a}. 461 462 \begin{figure}[H] 463 \centering 464 \includegraphics[scale=0.5]{frosix_dkg_sequence} 465 \caption{Frosix distributed key generation sequence} 466 \label{fig:dkg_sequence} 467 \end{figure} 468 469 \begin{enumerate} 470 \item The user prepares a Frosix Providerlist as input to frosix-cli keygen. 471 \item The Frosix client requests the server configuration from each \Glspl{provider} (GET /config), which includes information like supported authentication methods, public key to verify a providers signature and the \Gls{provider} public server salt. 472 If one of the \Glspl{provider} doesn't respond to this request the Frosix client will abort the process. 473 \item After positive feedback was received from all \Glspl{provider}, the Frosix client asks each \Gls{provider} for a seed (GET /seed), to be used as partial source of entropy (see chapter design). 474 \item Before starting the first round of the distributed key generation process, the Frosix client combines all received seeds together with local entropy and derives all \glspl{nonce} and context strings. 475 \item In the first round of the distributed key generation process, the Frosix client requests every \Gls{provider} to derive a commitment from the submitted \gls{context string} and the \Gls{provider} \gls{secret server salt} (POST /dkg-commitment). 476 \item Next, the Frosix client distributes all commitments to every participating \Gls{provider}, requesting the \Glspl{provider} to send the encrypted secret shares (POST /dkg-shares). 477 \item Afterwards, those encrypted shares have to be ordered and the Frosix client transmits to each \Gls{provider} only the secret shares targeted to this specific provider (POST /dkg-key), initiating round three. 478 \item Last, the Frosix client receives the public key of the generated key pair and a signature from each provider, checks if every public key is the same and verifies the signature over the public key and the authentication data, aborting if it fails. 479 \item At the end, the Frosix client outputs a Frosix signing document. 480 \end{enumerate} 481 482 \subsubsection{Request Challenge} 483 Figure \ref{fig:challenge_sequence} illustrates a single challenge request sequence. This request must be done for each challenge-code independently. 484 485 \begin{figure}[H] 486 \centering 487 \includegraphics[scale=0.5]{frosix_request-challenge_sequence} 488 \caption{Frosix request challenge sequence} 489 \label{fig:challenge_sequence} 490 \end{figure} 491 492 \begin{enumerate} 493 \item The user provides the \textit{Frosix signing document} and specifies from which listed \Gls{provider} a challenge-code should be requested for which message. 494 \item The Frosix client sends the challenge request and if the submitted authentication data matches the salted hash stored at the \Gls{provider}, a challenge-code is issued (POST /auth-challenge). 495 \end{enumerate} 496 497 \subsubsection{Distributed Signing} 498 Figure \ref{fig:sig_sequence} illustrates the sequence of a complete distributed signing process. 499 500 \begin{figure}[H] 501 \centering 502 \includegraphics[scale=0.5]{frosix_sign_sequence} 503 \caption{Frosix distributed signing sequence} 504 \label{fig:sig_sequence} 505 \end{figure} 506 507 \begin{enumerate} 508 \item There are always two different inputs needed to start a distributed signing process. Besides a Frosix signing document, the Frosix client needs a challenge-code or the correct answer to a \textit{security question} 509 for each participating \Gls{provider}. There has to be exactly \textit{threshold-value} numbers of providers! 510 \item Frosix client starts the first round of the distributed signing process with a request for a random, but message-specific commitment to each participating \Gls{provider} (POST /sig-commitment). 511 \item After passing the authentication challenge and receiving a commitment from each participating \Gls{provider}, the Frosix client distributes these commitments with the request to each compute a partial signature (POST /sig-share). 512 \item The Frosix client verifies now each partial signature and aggregates and outputs the final signature. 513 \end{enumerate} 514 515 \subsubsection{Delete Key} 516 Figure \ref{fig:del-key_sequence} illustrates the deletion of all private key shares, which belong to a specific public key. 517 518 \begin{figure}[H] 519 \centering 520 \includegraphics[scale=0.5]{frosix_delete-key_sequence} 521 \caption{Frosix delete key sequence} 522 \label{fig:del-key_sequence} 523 \end{figure} 524 525 \begin{enumerate} 526 \item To delete the private key shares the signing document has to be provided. 527 \item The Frosix client then calls for each \Gls{provider} the REST endpoint DELETE /dkg-key with the hash of the encryption key as identifier. 528 \item A \Gls{provider} deletes a key immediately if there is a corresponding key stored in its database. 529 \end{enumerate} 530 531 \section{Further Considerations} 532 Numerous decisions were made throughout the development of Frosix. 533 Some of them are mentioned and explained below. 534 535 \subsubsection{Data Parsing} 536 In Frosix, the use of JSON data is employed for input, output and transmission. 537 The parsing of JSON data is facilitated by the use of Libjannson \cite{libjansson}. 538 This approach significantly mitigates the risks associated with manual parsing, 539 as Libjansson is widely adopted and reviewed. 540 541 \subsubsection{POST vs GET} 542 The majority of the REST endpoints accept only POST requests, although there are some exceptions (see appendix~\ref{appendix_a}). 543 This design choice is driven by the objective of transmitting all data encrypted (over TLS). 544 All data must therefore be in the body of the request. 545 \custind An identifier in every request allows to correlate the request between the rounds of Frosix key generation and Frosix sign. 546 This identifier is a hash over all relevant data in the body of the request, 547 therefore it doesn't matter if the identifier gets logged from various systems while being transmitted between the Frosix client and a \Gls{provider}. 548 549 \subsubsection{Denial-of-service} 550 Since in Frosix's adversary model, an adversary has full control over the user's device and can therefore suppress and manipulate all network communication, 551 Frosix cannot protect against such denial-of-service (DoS) attacks! 552 \custind Additionally, Frosix lacks robustness against misbehaving providers, resulting in abortion of the protocol if anything fails. 553 554 \subsubsection{Availability Considerations} 555 Protection against denial-of-service (DoS) attacks is an important aspect in the design of the \Glspl{provider}. 556 A good protection against a large number of requests, with the objective of exhausting the \Gls{provider} 's resources, 557 is to always require a small payment in advance. However, this is currently not implemented (see chapter~\ref{chap:payment}). 558 559 Frosix incorporates an expiration date for all stored data in the database. 560 The commitments stored during Frosix key generation, which may consume much memory, 561 are stored for a few minutes only. 562 Moreover, the key data, which have a long storage time (some years), require only minimal storage space. 563 This makes it challenging for an adversary to exhaust a provider's storage capacity. 564 565 Furthermore, Frosix employs rate limiting within the database to mitigate exhaustive repeated requests in Frosix Sign. 566 However, it is important to note that Frosix does not offer protection against other network-based DoS attacks beyond its own scope of operation. 567 568 \section{Performance} 569 This section lists some performance measurements of Frosix, running single threaded on an Intel Core i7-7600U CPU. 570 All data points represent a single run of the application as performance is quite predictable and thus multiple runs were not deemed necessary. 571 Furthermore, the measurements are not completely accurate due to heat-based throttling, but they show the general tendency. 572 573 \newpage 574 \subsubsection{Frosix key generation} 575 Figure~\ref{fig:perf_dkg_threshold} shows the linear increase if the \textit{threshold-value} is raised. 576 \newline This is done with the number of parties fixed to the value 240. 577 578 \begin{figure}[H] 579 \centering 580 \includegraphics[scale=0.5]{frosix_perf_dkg_threshold} 581 \caption{Performance of Frosix key generation of a \Gls{provider} depending on the threshold value} 582 \label{fig:perf_dkg_threshold} 583 \end{figure} 584 585 Figure~\ref{fig:perf_dkg_parties} shows a second linear increase if the \textit{number of parties} is raised. 586 In this example the threshold-value is fixed to a value of only 10, resulting in much smaller numbers. 587 588 \begin{figure}[H] 589 \centering 590 \includegraphics[scale=0.5]{frosix_perf_dkg_parties} 591 \caption{Performance of Frosix key generation of a \Gls{provider} depending on number of involved \Glspl{provider}} 592 \label{fig:perf_dkg_parties} 593 \end{figure} 594 595 Figure~\ref{fig:perf_dkg_combined} shows the behavior if the \textit{threshold-value} is always \textit{number of parties - 1}, 596 therefore we have a situation of nearly $n = k$. 597 As the incrementation of both values on its own results in a linear increase, 598 if both values are incremented at the same time the complexity is squared. 599 600 \begin{figure}[H] 601 \centering 602 \includegraphics[scale=0.5]{frosix_perf_dkg_combined} 603 \caption{Performance of Frosix key generation of a \Gls{provider} if k = n} 604 \label{fig:perf_dkg_combined} 605 \end{figure} 606 607 \subsubsection{Frosix sign} 608 609 Figure~\ref{fig:perf_sign_provider} shows the time required for a \Gls{provider} to create a partial signature. 610 Since the sole dependency of signing a message is the \textit{threshold-value}, 611 the increase is linear. In contrast to Frosix sign, the maximum number needed to sign a message is smaller by a factor of about 20. 612 613 \begin{figure}[H] 614 \centering 615 \includegraphics[scale=0.5]{frosix_perf_sign_provider} 616 \caption{Performance of Frosix sign of a \Gls{provider} depending on the threshold value} 617 \label{fig:perf_sign_provider} 618 \end{figure} 619 620 Figure~\ref{fig:perf_sign_client} shows the time needed for the Frosix client to verify the partial signatures. 621 This is quite an inefficient computation in the current implementation, with a complexity of $O(n^2)$. 622 There is in principle a simple way to reduce the computation cost of this step to almost zero. 623 However, this was left for future work (see chapter \ref{future_work}). 624 625 \begin{figure}[H] 626 \centering 627 \includegraphics[scale=0.5]{frosix_perf_sign_client} 628 \caption{Performance of Frosix sign of Frosix client depending on the threshold value} 629 \label{fig:perf_sign_client} 630 \end{figure} 631 632 \subsubsection{Frosix verify} 633 634 The verification of threshold signatures is very fast and because its always one signature to verify, 635 has a complexity of \(O(1)\), as Figure~\ref{fig:perf_verify_client} shows. 636 637 \begin{figure}[H] 638 \centering 639 \includegraphics[scale=0.5]{frosix_perf_verify_client} 640 \caption{Performance of Frosix verify of Frosix client depending on the threshold value} 641 \label{fig:perf_verify_client} 642 \end{figure} 643 644 \newpage 645 \section{Testing} 646 At the moment, there are only two integration tests. 647 648 \subsubsection{Libfrost} 649 The first integration test is a compiled binary which runs every high level function of libfrost once. 650 651 \begin{itemize} 652 \item performs a distributed key generation 653 \item signs a message 654 \item checks if the resulting signature can be verified 655 \end{itemize} 656 657 \subsubsection{Frosix} 658 The integration test of Frosix is a shell script which does the following. 659 660 \begin{itemize} 661 \item creates and resets (in case they already exist) five instances of PostgreSQL databases 662 \item starts five \Glspl{provider} with predefined configuration files 663 \item runs a Frosix key generation among all five \Gls{provider} with a predefined providerlist 664 and stores the result Frosix in a Frosix signing document 665 \item runs a Frosix sign with three \Glspl{provider}, using the previously created Frosix signing document 666 and stores the result in a signature file 667 \item runs Frosix verify with the signature file and the message which was signed and checks if the verification succeeds. 668 \end{itemize}