3_preliminaries.tex (94043B)
1 \chapter{Preliminaries} 2 \label{chap:preliminaries} 3 \section{\acl{Taler} Overview} 4 \label{sec:taler-intro} 5 This chapter provides an high-level overview of GNU Taler with its core components. 6 The purpose of this chapter is to provide all the necessary details to understand this work and is not a specification nor a documentation of GNU Taler. 7 For more information on GNU Taler refer to \cite{dold:the-gnu-taler-system} or the GNU Taler documentation \cite{taler-documentation}. 8 \\ 9 Generally, GNU Taler is based on Chaumian e-cash \cite{chaum:blind-sign}. 10 The following parts discuss the different entities seen in the figure \ref{fig:simple-diagram} 11 12 \subsection{Components} 13 \label{sec:taler-components} 14 In this section the different components are described as in \cite{dold:the-gnu-taler-system}. 15 \begin{figure}[htp] 16 \includegraphics[height=0.6\textwidth]{diagram-simple.png} 17 \centering 18 \caption{GNU Taler simple overview (source: \cite{pic:simple-diagram})} 19 \label{fig:simple-diagram} 20 \end{figure} 21 22 \subsubsection{Exchange} 23 \label{sec:exchange} 24 The exchange is the payment service provider for financial transactions between a customer and merchant. 25 The exchange holds bank money as reserve for the anonymous digital coins. 26 \\ 27 Details of the exchange's functionality can be found in section 4.3 from Florian Dold's thesis \cite{dold:the-gnu-taler-system} or in the documentation \cite{taler-documentation:exchange-operator-manual}. 28 \\The code can be found in the exchange's git repository \cite{taler-git:exchange}. 29 30 \subsubsection{Customer (Wallet)} 31 A customer holds Taler Coins in his electronic wallet. 32 As we see in figure \ref{fig:simple-diagram}, a customer can withdraw coins from the exchange. 33 These coins can then be spent with a merchant. 34 \\ 35 Details of the wallet's functionality can be found in section 4.6 from Florian Dold's thesis \cite{dold:the-gnu-taler-system} or in the documentations \cite{taler-documentation:wallet-developer-manual} \cite{taler-documentation:wallet-cli-manual}. 36 \\ 37 Git Repositories: 38 \begin{itemize} 39 \item Main repository \cite{taler-git:wallet-core} \\ 40 This Repository includes the wallet-core and the implementations for the web extension and CLI. 41 \item Android app \cite{taler-git:android} 42 \item iOS app \cite{taler-git:ios} 43 \end{itemize} 44 45 \subsubsection{Merchant} 46 A merchant accepts Taler Coins in exchange for goods and services. 47 The merchant deposits these coins at the exchange and receives bank money in return. 48 \\ 49 Details of the wallet's functionality can be found in section 4.5 from Florian Dold's thesis \cite{dold:the-gnu-taler-system} or in the documentations: 50 \begin{itemize} 51 \item Operator manual \cite{taler-documentation:merchant-backend-operator-manual} 52 \item Merchant API \cite{taler-documentation:merchant-api} 53 \item Back-Office \cite{taler-documentation:back-office} 54 \item Point-of-Sales \cite{taler-documentation:pos-manual} 55 \end{itemize} 56 57 \noindent Git Repositories: 58 \begin{itemize} 59 \item Backend: \cite{taler-git:merchant} 60 \item Backoffice: \cite{taler-git:backoffice} 61 \item Point-of-Sales App: \cite{taler-git:android} (part of android repo) 62 \end{itemize} 63 64 \noindent Merchant Frontend Repositories: 65 \begin{itemize} 66 \item Payments with Django: \cite{taler-git:django-payments} 67 \item Wordpress woocommerce plugin: \cite{taler-git:woocommerce} 68 \item Saleor Frontend: \cite{taler-git:saleor} 69 \item Demo Frontends: \cite{taler-git:merchant-demos} 70 \end{itemize} 71 72 \subsubsection{Auditor} 73 The auditors, which are typically run by financial regulators, have the purpose to monitor the behavior of the exchanges to assure that exchanges operate correctly. 74 \\ 75 Details of the auditor's functionality can be found in section 4.4 from Florian Dold's thesis \cite{dold:the-gnu-taler-system} or in the documentation \cite{taler-documentation:auditor-operator-manual}. 76 \\Git Repositories: 77 \begin{itemize} 78 \item Main repository \cite{taler-git:exchange} (Part of exchange repository, inside ./src/auditor and ./src/auditordb) 79 \item Auditor's public website \cite{taler-git:auditor} 80 \end{itemize} 81 82 \subsubsection{Bank} 83 The banks receive wire transfer instructions from customers and exchanges. 84 As long as the banks can make wire transfers to each other, the Taler parties do not have to have the same bank. 85 86 \subsection{Taler Step by Step} 87 \begin{figure}[htp] 88 \includegraphics[height=0.65\textwidth]{taler_bigger.png} 89 \centering 90 \caption{GNU Taler overview (source: \cite{pic:taler-overview})} 91 \label{fig:taler-overview-big} 92 \end{figure} 93 This is a high-level overview of what Taler generally does. 94 Many details (like privacy of the buyer, income transparency) are left out and are explained in the following sections. 95 We see in Figure \ref{fig:taler-overview-big} how Taler works step by step (at a high-level). 96 \begin{enumerate} 97 \item The customer decides to withdraw Taler coins. To do this, he goes to his bank and gives the order to pay the exchange. 98 \item The customers bank receives the customers order and makes a wire transfer to the exchanges Bank. 99 \item The exchange has received the money and the customer can now withdraw coins to his wallet. 100 \item The customer can now spend his coins at a merchant or merchants of his choice. 101 \item The merchant can then deposit the coins at the exchange. 102 \item The exchanges bank makes a wire transfer to the merchants bank. 103 \item The merchant has successfully received the money for the goods he sold. 104 \end{enumerate} 105 106 \subsection{Protocols Overview} 107 This section provides a high-level overview of the different Taler protocols. 108 The details are here omitted and discussed later. 109 110 \subsubsection{Refresh Protocol} 111 Taler has a quite interesting protocol to get change. 112 The purpose of the protocol is to give unlinkable change. 113 When a customer buys something from a merchant, in most situations he does not have the exact sum in coins. 114 For this reason, change is needed to provide a convenient payment system. 115 A coin can be partially spent. 116 When this happens, the exchange and the merchant know that this coin is used for that specific contract. 117 If the rest of this coin would be spent in future, one could link these two transactions. 118 Therefore, a mechanism to get unlinkable change while still preventing money laundering or tax evasion is needed. 119 120 \subsubsection{Refund} 121 Taler has a built-in refund functionality. 122 Merchants can instruct the exchange to refund a transaction before the refund deadline. 123 The customer then refreshes the coin(s) in order for payments to remain unlinkable. 124 125 \subsubsection{Payment Fees} 126 The exchange can charge fees for withdrawal, refreshing, deposition of coins. 127 These fees can depend on the denomination since different denominations can have different storage requirements. 128 Merchants are able to cover these costs fully or partially. 129 \\Exchanges are also able to aggregate wire transfers to merchants, thus reducing wire transfer fees. 130 131 \subsubsection{Tipping} 132 Merchants can give customers a small tip. 133 This feature can be useful for different use cases, for example a merchant can give a tip when a customer participates in a survey. 134 135 \subsubsection{Auditing} 136 Financial auditing is built-in to Taler in the form of auditors. 137 Auditors have read access to certain exchange databases. 138 Their task is to verify that exchange work as expected, see chapter 4.4 in Florian Dold's thesis \cite{dold:the-gnu-taler-system} for more details. 139 In future versions, the auditor will provide an interface that can be used by merchants to submit deposit confirmation samples. 140 This can be used to detect compromised signing keys or a malicious exchange. 141 142 \subsection{Properties} 143 \label{sec:taler-properties} 144 This section describes Taler's properties. 145 146 \subsubsection{Free Software} 147 The core components of \acl{Taler} are under the following licenses: 148 \begin{itemize} 149 \item exchange \cite{taler-git:exchange}: \ac{GNU AGPL} 150 \item merchant \cite{taler-git:merchant}: 151 \begin{itemize} 152 \item backend: \ac{GNU GPL}v3+, \ac{GNU AGPL} 153 \item library: \ac{GNU LGPL} 154 \end{itemize} 155 \item wallet-core \cite{taler-git:wallet-core}: \ac{GNU GPL} 156 \end{itemize} 157 158 \newpage 159 160 \subsubsection{Buyer Privacy Protection} 161 Taler protects the privacy of buyers during the different stages in the lifetime of a coin: 162 \begin{enumerate} 163 \item Reserve: The reserve is identified by a key pair (private and public key). 164 This means that the exchange doesn't know the identity of the reserve account holder. 165 Whoever knows the private key is able to withdraw from the corresponding reserve. 166 \item Withdrawal: The withdrawal process is encrypted with TLS and uses a blind signature scheme. 167 Therefore the exchange doesn't know which customer holds which coin. 168 \item Payment: The complete payment process doesn't rely on any information identifying a customer. 169 \end{enumerate} 170 Beware that an anonymous bi-directional channel is assumed for communication between the customer and the merchant as well as during the retrieval of denomination key from the exchange and change for partially spent coins (between customer and exchange). 171 172 \subsubsection{Merchant Taxability} 173 Merchant's incomes are transparent to auditors which makes taxation by the state possible. 174 \newline 175 A buyer could theoretically transfer the private key and signature of a coin directly to the merchant to bypass the exchange. 176 However, this is suboptimal for the merchant because the knowledge of the coin doesn't grant him the sole ownership. 177 If the customer spends the coin in another transaction before the merchant, the coin is voided before the merchant claims its value, thus rendering this form of payment unusable. 178 The same principle holds for change (refreshed coins) because it is linked to the original coin. 179 Whoever knows the private key and signature of the original coin can obtain the change and use it before the merchant. 180 181 \subsubsection{\acl{AML} and \acl{CFT}} 182 Every transaction contains the cryptographic hash of the associated contract. 183 This enables the authorities to request the merchant to reveal the transaction details (the contract). 184 If the merchant isn't able to reveal the contract, in other words fails to deliver a contract with the same hash which is included in the transaction, he risks punishment or further investigation. 185 \\Another aspect for \ac{AML} and \ac{CFT} are \ac{KYC} checks. 186 \acl{KYC} checks require certain institutions to verify certain information about their business partners in order to prevent money laundering and terrorism (see \cite{dewiki:205456999}). 187 \\\acl{Taler} implements these \ac{KYC} checks: 188 \begin{itemize} 189 \item Exchanges know the identities of their customers. 190 \item Merchants might need to pre-register with exchanges (depending on the deployment scenario). 191 \end{itemize} 192 193 \subsubsection{Payer Fraud Prevention} 194 The following definition was taken from the BigCommerce website \cite{website:bigcommerce-payment-fraud}. 195 \begin{center} 196 \textit{ 197 "Payment fraud is any type of false or illegal transaction completed by a cybercriminal. The perpetrator deprives the victim of funds, personal property, interest or sensitive information via the internet." 198 } 199 \end{center} 200 Prevention of payment fraud is a design goal for \acl{Taler}. 201 202 \subsubsection{Minimal Information Disclosure} 203 \acl{Taler} aims to disclose as minimal information as possible. 204 This mostly concerns customers, but merchants also profit by keeping financial details hidden from competitors. 205 206 \subsubsection{\acl{SPOF} Avoidance} 207 \ac{SPOF}s are fatal because a failure in this component can bring the complete system to a halt. 208 209 \subsubsection{Offline Payment (unsupported)} 210 \acl{Taler} doesn't offer offline payments due to the CAP problem (see chapter "Challenges of offline payments" in \cite{grothoff-dold:euro-bearer-online}). 211 212 213 \section{Cryptographic Preliminaries} 214 \label{sec:crypto-preliminaries} 215 In this section we will cover the necessary preliminaries to understand Taler. 216 For this part we took most of the information from Nigel P. Smarts book Cryptography made simple \cite{modernCrypto} and from the course "Applied Cryptography" at the BFH. 217 The chapter includes preliminaries of the already implemented cryptographic schemes and the ones that are implemented during this work. 218 219 \subsection{Hash Functions} 220 As source for this section, page 271-275 were used in \textit{Cryptography made Simple} \cite{modernCrypto}. 221 \label{sec:hashfunc} 222 In this paper a hash function is always a cryptographic hash function. 223 Cryptographic hash function are one-way functions $H()$, which are calculating the hash value $h$ from a message $m$ so that $ h = H(m)$. 224 With known input one can easily calculate the hash value. 225 The other way around is computationally infeasible. 226 \\ Cryptographic hash functions have the following properties. 227 228 \subsubsection{(First) Preimage Resistance} 229 \label{sec:first-pre-resist} 230 It should be hard to find a message with a given hash value. 231 For a given output $y$ it is impossible to calculate the input $x$ such that $ h(x) = y$. 232 \\ This basically means, a hash function can not be inverted, not even with unlimited computing power. 233 Too much information is destroyed by the hash function and there are many values resulting in the same hash. 234 235 \subsubsection{Second Preimage Resistance} 236 \label{sec:second-pre-resist} 237 Given one message, it should be hard to find another message with the same hash value. 238 For a given $x_1$ and $h(x_1)$ it is hard to find a $x_2$ such that $h(x_1) = h(x_2)$. 239 240 \subsubsection{Collision Resistance} 241 \label{sec:col-resist} 242 It should be hard to find two messages with the same hash value. 243 It is quite obvious that collisions are existent, since there are more possible messages than hash values. 244 This is also known as the pigeonhole principle. 245 Even if there are hash collisions, it should be hard to find $x_1 \ne x_2$ such that $h(x_1) = h(x_2)$. 246 Due to the birthday paradoxon (a detailed description can be found under \cite{enwiki:1019272750}) it is easier to cause a collision of two arbitrary messages than of a specific message. 247 248 \subsection{Key Derivation} 249 \label{sec:kdf} 250 A \ac{KDF} derives one or more cryptographically strong secret keys from initial keying material by using a \acl{PRF}. 251 Therefore, input of a \ac{KDF} is some sort of keying material (e.g. from a key exchange). 252 Output will be a pseudo-random bit-string, which can be used as new key material. 253 254 255 \subsubsection{\acl{PRF}} 256 A \ac{PRF} is a deterministic function whose output appears to be random if the input is unknown. 257 The output is computationally indistinguishable from a true random source. 258 Different PRFs exist, for example \ac{AES} or HMAC could be used as \ac{PRF}. 259 In the case of \gls{hkdf}, HMAC is a suitable choice as \ac{PRF}. 260 261 \subsubsection{HMAC} 262 \label{sec:hmac} 263 A \acl{MAC} (\ac{MAC}) provides \textbf{unforgeability}, which means, only a person who knows the key $k$ can compute the MAC. 264 Further, a MAC protects the \textbf{message integrity}, since unauthorized changes are being detected. 265 Last but not least, \textbf{message authenticity} is provided too, since only a person who knows the key can compute the HMAC. 266 However, it does not provide non-repudation because it is a shared secret. 267 MACs take a message and a key as input and give the MAC tag as output. 268 \\One way to design such MACs is by using a hash function. 269 The obvious way one would design such a function would most likely be: $ t = H(k || m || pad)$ 270 However, this variant would be \textbf{completely insecure} with hash functions based on Merkle-Damgard constructions. 271 Because of the structure of such hash functions, it is easy to find $H(M || X)$ for an arbitrary $X$ and a hash value $H(M)$, with that a so called \textit{length-extension} attack is possible. 272 \\HMAC prevents this attack by computing the MAC as follows: $t = $ HMAC$_k(m) = H( (k \oplus opad) || H( (k \oplus ipad) || m) ) $ 273 \\ H() could be any standard hash functions, for example SHA-256, SHA-512 or SHA-3. 274 $\oplus$ stands for the XOR operation. 275 HMAC is specified in \cite{rfc2104}. 276 277 \subsubsection{HKDF} 278 \gls{hkdf} follows the \textit{extract-then-expand} paradigm and therefore has two phases. 279 In the extract phase, the input keying material is taken and a fixed-length pseudorandom key $K$ is \textit{extracted}. 280 This phase is used to generate a high entropy pseudorandom key from potentially weaker input keying material. 281 This key $K$ is used in the \textit{expand} phase to output a variable-length, pseudorandom key. 282 283 The \gls{hkdf} makes use of HMAC (\ref{sec:hmac}) instantiated with a hashfunction \ref{sec:hashfunc}. 284 It takes the input keying material, a salt and the length of output keying material as arguments. 285 \gls{hkdf} is specified in \cite{rfc5869}. 286 287 \subsection{Digital Signatures} 288 \label{sec:sign-schemes} 289 As source for this section, page 216-218 were used in \textit{Cryptography made Simple}\cite{modernCrypto}. 290 A digital signature is a cryptographic function used to verify the origin and integrity of a message. 291 It provides the following properties: 292 \begin{itemize} 293 \item Sender authenticity: The origin/sender of a message can not be forged. 294 \item Message integrity: No unauthorized change to the message can be made, the message is tamperproof. 295 \item Non-repudiation: After a message is signed, one can not dispute that a message was signed. 296 \end{itemize} 297 If verification is successful, only Alice knows her private key and Bob uses Alice's public key to verify, then Bob knows that this message is really from Alice and the message has not been tampered or further modified. 298 A digital signature scheme has a message space M, a signature space S and three algorithms: 299 \begin{itemize} 300 \item Key generation: $(pk,sk) \gets keyGen()$ 301 \item Signature generation: $s \gets $sign$_sk(m)$ 302 \item Verification: $ v \gets $verify$_pk(m,s)$ where $v \in {0,1}$ 303 \end{itemize} 304 If the result of the verification algorithm equals 1, a signature for m is called valid. 305 \\Digital signatures are publicly verifiable, which means anyone can verify that $(m,s)$ is legitimate. 306 307 \subsubsection{Adversary Models \& Provable Security} 308 \label{sec:euf-cma} 309 Digital Signature schemes are believed to be secure when they are EUF-CMA secure. 310 \acl{EUF} (\ac{EUF}) means that given a public key $pk$ the adversary cannot construct a message with a valid signature, except with a negligible probability. 311 \acl{CMA} (\ac{CMA}) means that an adversary can ask a signing oracle to produce valid signatures $s' = sign_{sk}(m')$ for arbitrary messages $m' \ne m$.\\ 312 EUF-CMA is therefore existentially unforgeability under chosen message attack and is a standard security model for digital signatures. 313 More details can be found in page 217-218 in \textit{Cryptography made Simple} \cite{modernCrypto}. 314 315 316 \subsubsection{RSA-FDH Signature Scheme} 317 As source for this section, pages 300-301 and 333-335 were used in \textit{Cryptography made Simple} \cite{modernCrypto}. 318 319 \label{sec:rsa-fdh} 320 RSA-FDH is a deterministic digital signature scheme which provides authenticity, message integrity and non-repudation. 321 The RSA signature scheme (without the full domain hash) is NOT \ac{EUF} secure and is vulnerable to existential forgery attacks. 322 RSA-FDH is one possible solution for a EUF-CMA secure scheme. EUF-CMA and its adversary model is further discussed in section \ref{sec:euf-cma}. 323 RSA-FDH is EUF-CMA secure under factoring and RSA assumptions. 324 More details on the hardness assumptions can be found on page 32-49 in \textit{Cryptography made Simple} \cite{modernCrypto}. 325 326 \paragraph{\acl{FDH}} 327 A \acl{FDH} is a hash function with an \textbf{image size equal to the size of the RSA modulus}. 328 The hashfunction $h()$ used in the RSA-FDH sign (section \ref{sec:rsa-fdh-sign}) and RSA-FDH verify (section \ref{sec:rsa-fdh-sign}) needs to fulfill all the security properties we defined in chapter \ref{sec:hashfunc}. 329 This means that the image is a co-domain of the RSA group $\mathbb{Z}_N^*$. 330 Provided that the hashfunction has properties of a random oracle, \textbf{RSA-FDH is provably EUF-CMA secure} under the RSA assumption. 331 332 \paragraph{RSA Key Generation} 333 \label{sec:rsa-keygen} 334 The information in this section is from the script of the BFH module \textit{Public Key Cryptography} taught by Prof. Dr. Walter Businger (\cite{businger:public-key-crytpo}). 335 The RSA private and public key are generated like this: 336 \begin{enumerate} 337 \item Generate two random prime numbers $ p, q $ where $ p \neq q $ 338 \item Calculate $ N = pq $ 339 \item Calculate $ \lambda = \text{lcm}(p-1, q-1) $ 340 \item Randomly choose a number $ d $ which is bigger than $ p $ and $ q $ and where $ \text{gcd}(d, \lambda) = 1 $ 341 \item Calculate $ e $, the multiplicative inverse of $ d \mod \lambda $ 342 \item The public key is $ (e, N) $, the private key is $ (d, N) $ 343 \item Destroy all numbers not included in the private or public key 344 \end{enumerate} 345 Note that "lcm" stands for least common multiplier and "gcd" means greatest common divisor. 346 The original RSA specification uses $ \phi(n) = (p-1)(q-1) $ instead of $ \lambda = \text{lcm}(p-1, q-1) $. 347 $ \phi(n) $ is a multiple of $ \lambda $ (for details see \cite{businger:public-key-crytpo}). 348 349 \paragraph{Signature Algorithm} 350 \label{sec:rsa-fdh-sign} 351 The signature can be calculated as following: 352 \\ $ s \gets (\text{FDH}(m))^d \mod N$ 353 354 \paragraph{Verification Algorithm} 355 \label{sec:rsa-fdh-verify} 356 The signature can be validated as following: 357 \\ $ \text{FDH}(m) \gets s^e \mod N$ 358 359 \subsubsection{Schnorr Signature Scheme} 360 \label{sec:schnorr-sig} 361 The Schnorr Signature scheme is a randomized signature scheme, which is proven to be EUF-CMA secure under \ac{DLP}. 362 More information about the \ac{DLP} can be found in chapter 3 of \textit{Cryptography made Simple} \cite{modernCrypto}. 363 In february 2008 the patent expired and Schnorr signatures are now becoming widely deployed. (eg. EdDSA). 364 Schnorr signatures gained quite some attraction lately, since Bitcoin has announced to support Schnorr signatures starting from Block 709632 (see \cite{bip:schnorr-bitc}, \cite{btc:releasnotes-0.21}, and \cite{git:secp256k1-schnorr}). 365 As reference for the Schnorr signature scheme (and later Clause Blind Schnorr Signature Scheme) we use the paper \textit{Blind Schnorr Signatures and Signed ElGamal Encryption in the Algebraic Group Model} \cite{cryptoeprint:2019:877} as general source for Schnorr related schemes. 366 367 \paragraph{Setup} 368 We have a Group $\mathbb{G}$ of order $p$ and a generator $G$ of the group. 369 Further a Hashfunction $H: \{0,1\}* \rightarrow \mathbb{Z}_p$ is used. 370 371 \paragraph{Key Generation} 372 The key generation is the same as in \ac{DSA}. 373 \begin{enumerate} 374 \item private key is a random integer $x \leftarrow random \in \mathbb{Z}_p$ 375 \item public key is $X \leftarrow xG$ 376 \end{enumerate} 377 378 \paragraph{Sign} 379 The sign function takes the secret key $x$ and the message $m$ to be signed as argument. 380 The interactive version with a signer and a user can be seen in figure \ref{fig:schnorr-sign-protocol}. 381 \begin{enumerate} 382 \item choose $r \leftarrow random \in \mathbb{Z}_p $ 383 \item calculate $R := rG$ 384 \item $ c := H(R,m)$ 385 \item $s := r + cx \mod p$ 386 \item $\sigma := (R,s)$ 387 \item return $\sigma$ 388 \end{enumerate} 389 390 \begin{figure} 391 \begin{equation*} 392 \begin{array}{ l c l } 393 % preliminaries 394 \text{User} & & \text{Signer} 395 \\ \text{knows:} & \text{public parameters:} & \text{knows:} 396 \\ \text{public key } X & \langle p, \mathbb{G}, G, H\rangle & \text{private signing key } x, X := xG 397 \\ & & n \leftarrow random \in \mathbb{Z}_p 398 \\ & & R := nG 399 \\ & \xleftarrow[\rule{2.5cm}{0pt}]{R} & 400 \\ c := H(R,m) 401 \\ & \xrightarrow[\rule{2.5cm}{0pt}]{c} & 402 \\ & & s := n+cx \mod p 403 \\ & \xleftarrow[\rule{2.5cm}{0pt}]{s} & 404 \\ \text{check } sG = R + cX 405 \\ \sigma := \langle R,s \rangle 406 \end{array} 407 \end{equation*} 408 \caption{Schnorr signature protocol with user who wants to sign a message $m$ by the signer} 409 \label{fig:schnorr-sign-protocol} 410 \end{figure} 411 412 413 \paragraph{Verify} 414 The verify function takes the public key $X$, the message $m$ and the signature $\sigma$ as argument. 415 \begin{enumerate} 416 \item $ c := H(R,m)$ 417 \item check $sG = R + cX$ 418 \item return true if check was successful, false otherwise 419 \end{enumerate} 420 421 The verification holds because $sG = R + cX $ is $ (r + cx)G = rG + cxG$ which is equal. 422 423 \subsubsection{\acl{EdDSA}} 424 \ac{EdDSA} is a scheme for digital signatures based on twisted Edwards curves and the Schnorr signature scheme. 425 The information described here originates from \cite{rfc8032} and \cite{enwiki:1013094030}. 426 \ac{EdDSA} is a general algorithm that can be used with different curves. A choice in curves consists of 11 parameters. These are the most important (the others can be found in \cite{rfc8032}: 427 \begin{itemize} 428 \item odd prime power q (used to generate elliptic curve over finite field $ \mathbb{F}_q $) 429 \item integer b, where $ 2^{b-1} > q $, describing the bit size of various elements 430 \item cryptographic hash function $ H $ with output size of $ 2b $ 431 \item base point on curve $ B $ (generator) 432 \item number $ c $, (either 2 or 3) 433 \item prime number L where $ LB = 0 $ and $2^c*L = \text{number of points on the curve} $ 434 \end{itemize} 435 436 \paragraph{Key Creation} 437 \label{sec:eddsa-keygen} 438 The private key $ k $ is a random bit-string of length $ b $. 439 The public key $ A $ is a point on the curve. 440 To generate it, we calculate $ A = sB $ where $ s = H(k)[:b] $ (meaning that we take the $ b $ least significant bits from the output of the hash function as $ s $). 441 442 \paragraph{Signature Creation} 443 \label{sec:eddsa-signature-creation} 444 An \ac{EdDSA} signature of a message $ M $ is composed of $ (R, S )$, which are generated as follows: 445 \begin{align*} 446 s & = H(k)[:b] 447 \\r &= H(H(k)[b + 1:2b] \text{ || } M ) 448 \\R &= rB 449 \\S &= (r + H(R || A || M) * s) \mod L 450 \end{align*} 451 Note that $ [:b] $ means taking the $ b $ least significant bits, $ [b + 1:2b] $ means taking the b most significant bits and $ R || A $ means concatenating $ R $ and $ A $. 452 453 \paragraph{Signature Verification} 454 $ (R, S) $ is the signature, $ M $ is the message, $ A $ is the public key and $c, B $ are curve parameters. 455 To verify a signature, the following equation must be satisfied: 456 \\$ 2^cSB = 2^cR + 2^cA*H(R || A || M) $ 457 \\This means that verify() returns 1 if the equation holds and 0 otherwise. 458 459 \paragraph{Ed25519} 460 \label{par:curve25519} 461 Ed25519 is an \ac{EdDSA} based signature scheme and uses \gls{25519} (see \cite{bern:curve25519}), which offers 128 security bits. 462 \gls{25519} gets its name from the prime $ 2^{255} - 19 $ and is designed for fast computation and to resist side channel attacks. 463 \\These are the most important \ac{EdDSA} parameters for Ed25519 (the others can be found in \cite{rfc8032}): 464 \begin{itemize} 465 \item $ q = 2^{255} - 19 $ 466 \item $ b = 256 $ 467 \item $ H() $: SHA-512 468 \item $ B = (15112221349535400772501151409588531511454012693041857206046113283949847762202, $ 469 \\ $46316835694926478169428394003475163141307993866256225615783033603165251855960) $ 470 \item $ c = 3 $ 471 \item $ L = 2^{252} + 27742317777372353535851937790883648493 $ 472 \end{itemize} 473 \subsection{Blind Signature Schemes} 474 \label{sec:blind-sign-schemes} 475 \label{sec:blind-sign-perfect-blindness} 476 One could think of blind signatures as a message put into an envelope made of carbon paper. The signer stamps his signature on the envelope and due to the properties of a carbon paper, the message is now signed too. (the stamp "stamps" through the envelope on the message). 477 The client then can open the envelope, and he possesses a correctly signed message. 478 This is achieved by the client by blinding the message with a blinding factor before sending to the signer ("blind()" operation). 479 The signer signs the blinded message and returns the signature of the blinded message to the client. 480 The client, who possesses the blinding factor can then unblind the signature and gets a signature of the original message ("unblind()" operation). 481 The explanation above leads us to the additional security property of a blind signature, the \textit{blindness} of signatures. 482 This property requires that a signer cannot link a message/signature pair to a particular execution of the signing protocol \cite{cryptoeprint:2019:877}.\\ 483 A blind signature scheme is called \textit{perfectly blind} if the generated signature (\textit{unblinded} signature) is statistically independent of the interaction with the signer (\textit{blinded} signature). 484 Thus, blind signatures cannot be linked to the signer interaction in an information theoretic sense. \cite{schnorr:perfect-dl-signatures} \cite{spring:wallet-db-with-observers} 485 \subsubsection{RSA Blind Signature Scheme} 486 \label{sec:blind-rsa-sign} 487 As source for this section, the course material from "Applied Cryptography" from BFH and \cite{chaum:blind-sign} were used. 488 The process for receiving a valid signature from the exchange uses a blind signature scheme invented by David Chaum (\cite{chaum:blind-sign}) which is based on RSA signatures. 489 The process is described in figure \ref{fig:blind-sign}. 490 \\Note that Bob (the signer) uses a standard RSA signature and can't verify if the message from Alice is blinded. 491 \begin{figure}[htp] 492 \begin{equation*} 493 \begin{array}{ l c l } 494 \text{Alice} & & \text{Bob} 495 \\ \text{knows:} & & \text{knows:} 496 \\ \text{RSA public key } D_B = e, N & & \text{RSA keys } d_B, D_B 497 \\ \text{message } m & & 498 \\ & & 499 \\ \text{blind:} & & 500 \\ r \leftarrow random \in \mathbb{Z}_N^* & & 501 \\ m' = m*r^{e} \mod N & & 502 \\ & \xrightarrow[\rule{2.5cm}{0pt}]{m'} & 503 \\ & & \text{sign:} 504 \\ & & s' = (m')^{d_B} \mod N 505 \\ & \xleftarrow[\rule{2.5cm}{0pt}]{s'} & 506 \\ \text{unblind:}& & 507 \\ s = s'*r^{-1} & & 508 \end{array} 509 \end{equation*} 510 \caption{Blind signature scheme} 511 \label{fig:blind-sign} 512 \end{figure} 513 Mathematically a blind signature works similar to the "naive" RSA signature scheme. 514 We consider Alice as the party who wants to have a message $m$ blindly signed by Bob. 515 Bob has a public key $D_B = (e, N)$ and his corresponding private key $d_B$ known only by Bob. 516 Alice needs to generate a random blinding factor $r\in \mathbb{Z}_N^*$, which needs to remain secret. 517 Alice then calculates $m'=m*r^e \mod N$. The blinded value $m'$ will now be sent to Bob by Alice. 518 Bob on his side calculates now the signature as usual: $s' = m'^{d_B} \mod N$. 519 The signature $s' $ is sent to Alice by Bob. Alice can calculate the signature as following: \\$s = s' * r^{-1}$. 520 \\$s$ is a valid signature of $m$, while the signer, Bob, does not know $m$ nor $b$. 521 \\We now want to analyze this closer to understand why blind signatures work. 522 Let's look at this equation: 523 \\$ s' = m'^{d_B} = (m*r^e)^{d_B} = m^{d_B} * (r^e)^{d_B}$. 524 \\The interesting part for now is $(r^e)^{d_B}$, since this is $r^1$. 525 This means the signature $s'$ we got from Bob is $s' = m^{d_B} * r^1$. 526 Now it is quite obvious how the valid signature $s$ can be calculated by multiplying with the inverse of $r$ as in: $ s = m^{d_B} * r^1 * r^{-1} = s' * r^{-1}$. 527 528 \paragraph{Blindness} 529 \label{par:prop-blindness-rsa} 530 \gls{RSABS} are considered \textit{perfectly blind} (see \autoref{sec:blind-rsa-sign}). 531 There exist multiple $\langle r, m \rangle$ pairs that matches $m'$ such that $m' = m * r^e \mod N$. 532 Thus, \gls{RSABS} achieves \textit{perfect blindness} which cannot be attacked by brute-force or similar attacks. 533 Even if a valid $\langle r, m \rangle$ pair is found, the attacker has no possibility to know if it is the correct pair without additional information. 534 535 \paragraph{RSA Blinding Attack} 536 There are also some possible attacks on this scheme. 537 First this is subject to the RSA blinding attack. 538 In this attack the property is used, that the signing operation is mathematically equivalent to the encrypt operation in RSA. 539 The attacker has a ciphertext $c = m^d$ and he wants to break this message. 540 Now, the attacker uses the ciphertext $c$ as "message" in the blind signature scheme above. 541 \\$m'' = cr^e \mod n = (m^e \mod n) * r^e \mod n = (mr)^e \mod n$. 542 \\The Attacker then sends the blinded message $m''$ to the signer who blindly signs the blinded message. 543 \\$s' = m''^d \mod n = (mr)^{ed} \mod n = m*r \mod n$. 544 \\The attacker recovers the message now with $m = s'*r^{-1} \mod n$. 545 \\This attack could be prevented by the use of a padding scheme, however this would break RSA symmetry. 546 In blind signatures the RSA symmetry is needed, otherwise it would produce an incorrect value in the unblind operation. 547 \\Due to this issue; One should never use the same key for signing and encryption! 548 A version of blind signatures, RSA-FDH will be discussed, which solves this issue. \cite{enwiki:blind-sign} 549 550 \paragraph{Low Encryption Exponent Attack} 551 For this attack a possibly small message $m$ and a small public key $e$ is given. 552 If now $c = m^e < n$, one could compute $ m = \sqrt[e]{c} $. 553 Similar to the RSA blinding attack, padding could solve the issue, however RSA symmetry is needed. 554 To overcome this issue, RSA-FDH blind signatures are introduced in the next chapter. 555 556 \subsubsection{RSA-FDH Blind Signatures} 557 As source for this section, the course material from "Applied Cryptograhy" from BFH and \cite{chaum:blind-sign} were used. 558 \label{sec:blind-sign-fdh} 559 Blind signatures are discussed in \ref{sec:blind-sign-schemes}. 560 This version is quite similar to the blind signatures already introduced in figure \ref{fig:blind-sign}. 561 In addition, the \gls{fdh} introduced in section \ref{sec:rsa-fdh} is used. 562 The difference is that the message does not get directly blinded, it gets hashed before with a \acl{FDH}. 563 \\Given Alice's message $m$ and Bobs public key $D_B = (e,n)$. 564 As in the simple \gls{RSABS}, a random blinding factor $r\in \mathbb{Z}_N^*$ is generated. 565 Before the message is blinded, the \acl{FDH} $ f = \text{FDH}(m)$ is calculated, which then is blinded as in $f' = fr^e \mod n$. 566 Since the hash function is a \acl{FDH}, $f$ is in the RSA domain $\mathbb{Z}_N^*$. 567 Now proceed as in the blind signature scheme introduced in the previous section. 568 The blinded hash $f'$ will be transmitted to Bob who then computes the signature $s' = f'^d \mod n$ and sends $s'$ back. 569 Alice unblinds $s'$ and gets the valid signature $s = s'r^{-1} \mod n$. 570 571 \begin{figure}[htptp] 572 \begin{equation*} 573 \begin{array}{ l c l } 574 \text{Alice} & & \text{Bob} 575 \\ \text{knows:} & & \text{knows:} 576 \\ \text{RSA public key } D_B = e, N & & \text{RSA keys } d_B, D_B 577 \\ \text{message } m & & 578 \\ & & 579 \\ Compute f = FDH(m) & & 580 \\ & & 581 \\ \text{blind:} & & 582 \\ r \leftarrow random \in \mathbb{Z}_N^* & & 583 \\ f' = f*r^{e} \mod N & & 584 \\ & \xrightarrow[\rule{2.5cm}{0pt}]{f'} & 585 \\ & & \text{sign:} 586 \\ & & s' = (f')^{d_B} \mod N 587 \\ & \xleftarrow[\rule{2.5cm}{0pt}]{s'} & 588 \\ \text{unblind:}& & 589 \\ s = s'*r^{-1} & & 590 \end{array} 591 \end{equation*} 592 \caption{RSA-FDH blind signatues} 593 \label{fig:rsa-fdh-blind-sign} 594 \end{figure} 595 596 This version of blind signature is not subject to the attacks introduced in the previous section. 597 598 \subsubsection{Blind Schnorr Signature Scheme} 599 \label{sec:blind-schnorr-sig} 600 The Blind Schnorr Signature Scheme \textbf{is considered broken} and should not be implemented. 601 This section is here to explain how blind Schnorr signatures generally work and should help to understand The Clause Blind Schnorr Signature Scheme \ref{sec:clause-blind-schnorr-sig}. 602 603 For the signer the calculations are the same as in the original Schnorr Signature Scheme \ref{fig:schnorr-sign-protocol}. 604 The exchange chooses a random $n \leftarrow random \in \mathbb{Z}_p$ and calculates $R := nG$ as before. 605 In comparison to the Schnorr Signature Scheme (see section \ref{sec:schnorr-sig}) we generate two random blinding factors $\alpha, \beta \leftarrow random \in \mathbb{Z}_p$ to achieve \textit{blindness}. 606 The User then calculates $R' := R + \alpha G + \beta X$. 607 This $R'$ is then used to calculate $c' := H(R',m)$ and is blinded with $b$ as in $c := c' + \beta \mod p$. 608 The challenge $c$ is then blindly signed by the signer $s := n+cx \mod p$. 609 The User checks if the signature is valid the same way as in the original protocol. 610 Finally the user has to unblind $s$ as in $s' := s + \alpha \mod p$. 611 Now the unblinded signature is $\sigma := \langle R',s' \rangle$. 612 This scheme is described in figure \ref{fig:schnorr-blind-sign-scheme}. 613 More details can be found in the \textit{Blind Schnorr Signatures and Signed ElGamal Encryption in the Algebraic Group Model} paper \cite{cryptoeprint:2019:877}. 614 615 %The unblinded signature can be verified with $s'G = R' + c'X$, since following equation is satisfied:\\ 616 %$s'G = sG + \alpha G = (r + cx)G + \alpha G = R + \alpha G + \beta X + (-\beta + c)X = R' + c'X = R' + H(R',m)X$ \cite{cryptoeprint:2019:877}.\\ 617 618 To verify the signature, the verifier has to check if the following equation holds: 619 \begin{align*} 620 s'G & = R' + c' X 621 \\ &= R' + H(R', m) X 622 \end{align*} 623 $ s', R' $ together form the signature, $ X $ is the public key and $ m $ is message. 624 625 The reason why this works is that the original Schnorr signature verification algorithm remains the same in blind signatures. 626 \begin{align*} 627 sG = R + c X 628 \end{align*} 629 630 By replacing $ s, R, c, $ with the values used in the blind signature scheme (as in figure \ref{fig:schnorr-blind-sign-scheme}) 631 \begin{align*} 632 \\ s &= s' - \alpha 633 \\ R &= R' - \alpha G - \beta X 634 \\ c &= c' + \beta 635 \end{align*} 636 637 we receive the following equation: 638 \begin{align*} 639 sG & = R + c X 640 \\ (s' - \alpha)G &= R' - \alpha G - \beta X + (c' + \beta)X 641 \\ s'G - \alpha G &= R' - \alpha G + c' X 642 \\ s'G &= R' + c' X 643 \end{align*} 644 645 \begin{figure}[htp] 646 \begin{equation*} 647 \begin{array}{ l c l } 648 % preliminaries 649 \text{User} & & \text{Signer} 650 \\ \text{knows:} & \text{public parameters:} & \text{knows:} 651 \\ \text{public key } X & \langle p, \mathbb{G}, G, H\rangle & \text{private signing key } x, X := xG 652 \\ & & r \leftarrow random \in \mathbb{Z}_p 653 \\ & & R := rG 654 \\ & \xleftarrow[\rule{2.5cm}{0pt}]{R} & 655 \\ \alpha, \beta \leftarrow random \in \mathbb{Z}_p 656 \\ R' := R + \alpha G + \beta X 657 \\ c' := H(R',m) 658 \\ c := c' + \beta \mod p 659 \\ & \xrightarrow[\rule{2.5cm}{0pt}]{c} & 660 \\ & & s := r+cx \mod p 661 \\ & \xleftarrow[\rule{2.5cm}{0pt}]{s} & 662 \\ \text{check } sG = R + cX 663 \\ s' := s + \alpha \mod p 664 \\ \sigma := \langle R',s' \rangle 665 \end{array} 666 \end{equation*} 667 \caption{The broken Schnorr Blind Signature Scheme} 668 \label{fig:schnorr-blind-sign-scheme} 669 \end{figure} 670 671 \paragraph{Blindness} 672 Blind Schnorr Signatures also achieve \textit{perfect blindness} (\autoref{sec:blind-sign-perfect-blindness}). \cite{spring:wallet-db-with-observers} \cite{cryptoeprint:2019:877} 673 674 \paragraph{ROS Problem} 675 \label{par:ros-problem} 676 The security of Blind Schnorr Signatures relies on an additional hardness assumption, the \textit{\acl{ROS}} or ROS problem. \cite{Schnorr01securityof} 677 Solving the \ac{ROS} problem breaks the unforgeability property of blind Schnorr signatures by finding $l + 1$ signatures out of $l$ signing operations. 678 David Wagner showed in his paper that the \ac{ROS} problem can be reduced to the $(l+1)$-sum problem and therefore showed that an attack is practicable. \cite{wagner:generalized-bday-prob} 679 More details about \ac{ROS} and Wagner's algorithm can also be found in the paper \textit{Blind Schnorr Signatures and Signed ElGamal Encryption in the Algebraic Group Model} \cite{cryptoeprint:2019:877}. 680 \\ 681 Due to the possible attack, Blind Schnorr Signatures are considered \textbf{broken} and should not be used. 682 The next section \ref{sec:clause-blind-schnorr-sig} introduces a modified version for which the \ac{ROS} problem is much harder to solve. 683 \\ 684 The \ac{ROS} problem is a recent research topic. 685 Recently a paper about the (in)security of \ac{ROS} was published. \cite{cryptoeprint:2020:945} 686 The scheme introduced in the next section \ref{sec:clause-blind-schnorr-sig} is considered secure in 2021. 687 It is important to keep in mind that the \ac{ROS} problem is much newer and there is open research done. 688 689 \subsubsection{Clause Blind Schnorr Signature Scheme} 690 \label{sec:clause-blind-schnorr-sig} 691 The Clause Blind Schnorr Signature Scheme is a modification of the Blind Schnorr Signature Scheme for which the \ac{ROS} problem is harder to solve. 692 The Clause Blind Schnorr Signature Scheme does this by choosing two random values $r_0, r_1$ and calculating $R_0 := r_0G; R_1 := r_1G$. 693 The user generates the blinding factors twice $\alpha_0, \alpha_1, \beta_0, \beta_1 \leftarrow random \in \mathbb{Z}_p$. 694 The user then calculates the challenges as before $c_0' := H(R_0',m); c_0 := c_0' + \beta_0 \mod p$ and $c_1' := H(R_1',m); c_1 := c_1' + \beta_1 \mod p$. 695 After the signer receives the two challenges $c_0$ and $c_1$, the signer randomly chooses $b \leftarrow random \{0, 1\}$ and calculates only $s_b$ as in $s := r_b+c_bx \mod p$. 696 The User receives $s, b$ and can unblind the signature to receive his signature $\sigma := \langle R'_b, s'_b \rangle$. 697 The verification algorithm remains the same for Clause Blind Schnorr Signature Scheme. 698 Figure \ref{fig:clause-blind-schnorr-sign-scheme} shows the Clause Blind Schnorr Signature Scheme. 699 More details about the scheme can be found in the paper \textit{Blind Schnorr Signatures and Signed ElGamal Encryption in the Algebraic Group Model} \cite{cryptoeprint:2019:877}. 700 701 702 \begin{figure} 703 \begin{equation*} 704 \begin{array}{ l c l } 705 % preliminaries 706 \text{User} & & \text{Signer} 707 \\ \text{knows:} & \text{public parameters:} & \text{knows:} 708 \\ \text{public key } X & \langle p, \mathbb{G}, G, H\rangle & \text{private signing key } x, X := xG 709 \\ & & r_0, r_1 \leftarrow random \in \mathbb{Z}_p 710 \\ & & R_0 := r_0G 711 \\ & & R_1 := r_1G 712 \\ & \xleftarrow[\rule{2.5cm}{0pt}]{R_0, R_1} & 713 \\ \alpha_0, \alpha_1, \beta_0, \beta_1 \leftarrow random \in \mathbb{Z}_p 714 \\ R_0' := R_0 + \alpha_0 G + \beta_0 X 715 \\ R_1' := R_1 + \alpha_1 G + \beta_1 X 716 \\ c_0' := H(R_0',m) 717 \\ c_1' := H(R_1',m) 718 \\ c_0 := c_0' + \beta_0 \mod p 719 \\ c_1 := c_1' + \beta_1 \mod p 720 \\ & \xrightarrow[\rule{2.5cm}{0pt}]{c_0, c_1} & 721 \\ & & b \leftarrow random \in \{ 0,1\} 722 \\ & & s := r_b+c_bx \mod p 723 \\ & \xleftarrow[\rule{2.5cm}{0pt}]{b, s} & 724 \\ \text{check } sG = R + cX 725 \\ s' := s + \alpha_b \mod p 726 \\ \sigma := \langle R_b',s' \rangle 727 \end{array} 728 \end{equation*} 729 \caption{The Clause Schnorr Blind Signature Scheme} 730 \label{fig:clause-blind-schnorr-sign-scheme} 731 \end{figure} 732 733 \paragraph{Blindness} 734 \label{par:prop-blindness-cs} 735 \gls{CSBS} also achieve \textit{perfect blindness} as in Schnorr Blind Signatures (see \autoref{sec:blind-rsa-sign}). \cite{cryptoeprint:2019:877} 736 737 738 \subsection{Diffie Hellman Key Exchange} 739 As source for this section, pages 383-386 were used in \textit{Cryptography made Simple} \cite{modernCrypto}. 740 \label{sec:preliminaries-DHKE} 741 The \acl{DHKE} is a well proofed and well understood key exchange mechanism. 742 \ac{DHKE} relies mainly on the \acl{DLP}. 743 \ac{DHKE} is used for key exchange in many protocols today (e.g. TLS cipher suites). 744 745 \subsubsection{Hardness Assumptions} 746 \label{sec:dlp} 747 As already stated, the \ac{DHKE} relies on the assumption that calculating the discrete logarithm is hard. 748 The \ac{DLP} is in $G$, where $G$ is a finite abelian group of prime order q. 749 This could either be a subgroup of the multiplicative group of a finite field or the set of points on an elliptic curve over a finite field. 750 Given $g,h \in G$, find x such that $g^x = h$. 751 752 Further, \ac{CDH} and \ac{DDH} are important hardness assumption, which can be reduced to the \ac{DLP}. 753 Hardness assumptions are introduced very briefly. 754 In this work we believe that these well proofed and well tested hardness assumptions hold. 755 (See Chapter 3.1 \textit{Cryptography made Simple} \cite{modernCrypto} for more details on DH hardness assumptions.) 756 757 \subsubsection{Protocol} 758 Alice and Bob want to securely exchange a key with \ac{DHKE}. 759 Alice has a private key $a$ and a corresponding public key $A = g^a \mod p$. 760 Bob has a private key $b$ and a corresponding public key $B = g^b \mod p$. 761 With elliptic curves, the private key is a multiplication factor for a base point $g$ (see example on page 385 \textit{Cryptography made Simple} \cite{modernCrypto}). 762 763 Alice now sends her public key $A$ to Bob. 764 Bob can then calculate $k = A^b \mod p = g^{ab} \mod p$ and sends his public key $B$ to Alice. 765 Alice can then calculate $k = B^a \mod p = g^{ab} \mod p$. 766 Both get the same key $k$ as result of the key exchange. 767 Note: This protocol on its own is not an authenticated key exchange, which means that Man-in-the-Middle attacks are possible. 768 769 A different way of looking at \ac{DHKE} is by thinking of a lock which can be unlocked by two (private) keys. 770 If one of the two private keys are known, one could calculate $k$ on its own. 771 Taler's refresh protocol (see \ref{sec:refresh-protocol}) uses \ac{DHKE} in a very interesting way. 772 773 \subsection{Cut and Choose Protocol} 774 \label{sec:preliminaries-cut-choose} 775 A good introduction to cut and choose protocols gives the Paper from Claude Crépeau (\cite{Crépeau2005} References to the important examples can be found in the paper.): 776 \begin{center} 777 \textit{ 778 "A cut and choose protocol is a two-party protocol in which one party tries to convince another party that some data he sent to the former was honestly constructed according to an agreed upon method. 779 Important examples of cut-and-choose protocols are interactive proofs, interactive arguments, zero-knowledge protocols, witness indistinguishable and witness hiding protocols for proving knowledge of a piece of information that is computationally hard to find. 780 Such a protocol usually carries a small probability that it is successful despite the fact that the desired property is not satisfied. 781 \\\dots\\ 782 The expression cut-and-choose was later introduced by David Chaum in analogy to a popular cake sharing problem: 783 Given a complete cake to be shared among two parties distrusting of each other (for reasons of serious appetite). 784 A fair way for them to share the cake is to have one of them cut the cake in two equals hares, and let the other one choose his favourite share. 785 This solution guarantees that it is in the formers best interest to cut the shares as evenly as possible." 786 } 787 \end{center} 788 789 Talers cut and choose protocol is \textit{zero knowledge}, which means that nothing about the secret is learned. 790 The cut and choose protocol used in Taler is explained further when the refresh protocol is discussed (see \ref{sec:refresh-protocol}). 791 792 \section{Taler Protocols} 793 In section \ref{sec:taler-intro} a brief overview of how \acl{Taler} works is given. All the relevant preliminaries are covered in section \ref{sec:crypto-preliminaries}. 794 In this section a closer look at the different protocols is taken. 795 796 \subsection{Withdrawal Protocol} 797 \label{sec:withdrawal} 798 The withdrawal protocol is described in chapter 4.7.2 of \cite{dold:the-gnu-taler-system}. 799 Before coins can be withdrawn, the customer generates a reserve key pair $ w_s, W_p \leftarrow Ed25519.KeyGen() $. 800 He then transfers a certain amount of money from his bank to the exchange's bank via wire transfer. 801 This payment must include the reserve public key $ W_p $. 802 The customer will later authorize withdrawals with a signature using his private reserve key. 803 %The customer can then authenticate, since he is in possession of the private reserve key. 804 As soon as the exchange has received the payment, the withdrawal for coins with a value $ i $ can begin (described in figure \ref{fig:withdrawal-process}). 805 806 At this stage the client knows the reserve private key and the public denomination key. 807 The customer can then create coins up to the amount included in the wire transfer. 808 The coin creation and blind signatures are described in section \ref{sec:blind-sign-fdh}. 809 So the client generates a planchet (an Ed25519 key pair) and blinds it. 810 This blinded planchet is then signed by the customers private reserve key, to prove that the customer is eligible to withdraw the coin. 811 The exchange who receives the blinded planchet and the signature first checks whether the signature is valid with the public reserve key sent with the wire transfer. 812 When successful, the exchange blindly signs the planchet, returns the signature and notes the amount withdrawn of the reserve. 813 The customer unblinds the signature, checks its validity and persists the coin. 814 The state machine of a coin can be seen in figure \ref{fig:coin:states}. 815 816 \begin{figure}[htp] 817 \begin{center} 818 \includegraphics[scale=0.58]{coin.pdf} 819 \end{center} 820 \caption{State machine of a coin (source: \cite{pic:coin-state-machine})} 821 \label{fig:coin:states} 822 \end{figure} 823 824 \begin{figure}[htp] 825 \begin{equation*} 826 \resizebox{1.0\textwidth}{!}{$\displaystyle 827 \begin{array}{ l c l } 828 \text{Customer} & & \text{Exchange} 829 \\ \text{knows:} & & \text{knows:} 830 \\ \text{reserve keys } w_s, W_p & & \text{reserve public key } W_p 831 \\ \text{denomination public key } D_p = e, N & & \text{denomination keys } d_s, D_p 832 \\ & & 833 \\\text{generate coin key pair:} & & 834 \\ c_s, C_p \leftarrow Ed25519.KeyGen() & & 835 \\ \text{blind:} & & 836 \\ r \leftarrow random \in \mathbb{Z}_N^* & & 837 \\ m' = \text{FDH}(N, C_p)*r^{e} \mod N & & 838 \\ \text{sign with reserve private key:} & & 839 \\ \rho_W = D_p, m' & & 840 \\ \sigma_W = \text{Ed25519.Sign}(w_s, \rho_W) & & 841 \\ & \xrightarrow[\rule{2.5cm}{0pt}]{\rho = W_p, \sigma_W, \rho_W} & 842 \\ & & \text{verify if denomination public key} 843 \\ & & \text{is valid} 844 \\ & & \text{check } \text{Ed25519.Verify}(W_p, \rho_W, \sigma_W) 845 \\ & & \text{decrease balance if sufficient} 846 \\ & & \text{sign:} 847 \\ & & \sigma'_c = (m')^{d_s} \mod N 848 \\ & \xleftarrow[\rule{2.5cm}{0pt}]{\sigma'_c} & 849 \\ \text{unblind:}& & 850 \\ \sigma_c = \sigma'_c*r^{-1} & & 851 \\ \text{verify signature:}& & 852 \\ \text{check } \sigma_c^{e} = \text{FDH}(N, C_p) & & 853 \\ & & 854 \\ \text{resulting coin: } c_s, C_p, \sigma_c, D_p & & 855 \end{array}$ 856 } 857 \end{equation*} 858 \caption{Withdrawal process} 859 \label{fig:withdrawal-process} 860 \end{figure} 861 862 \subsubsection{Withdraw Loophole} 863 \label{sec:withdraw-loophole} 864 The withdraw loophole allows withdraw operations where owner of the resulting coins isn't the owner of the reserve that the coins where withdrawn from. 865 It is used for tipping (described in section \ref{sec:tipping}) and can therefore be seen as a feature. 866 867 By misusing the withdraw loophole, untaxed and untraceable payments can be performed. 868 Figure \ref{fig:withdraw-loophole-exploit} explains how such a payment would work. 869 Note that we omitted the parts leading up to the coin creation (contract, agreement of price, number of coins and their denominations). 870 This is how it works on a high level: 871 \begin{enumerate} 872 \item The malicious merchant generates and blinds coins, which are then transmitted to the customer 873 \item The customer authorizes the withdraw from his reserve by signing the blinded coins with the private key of his reserve, thus generating withdraw confirmations. 874 \item The withdraw confirmations are transmitted to the exchange, which generates the signatures and returns them to the malicious merchant. 875 \item The malicious merchant unblinds the signatures. 876 He is now in possession of the coin, thus the payment is completed. 877 \end{enumerate} 878 879 \begin{figure}[htp] 880 \begin{equation*} 881 \resizebox{1.0\textwidth}{!}{$\displaystyle 882 \begin{array}{ l c l} 883 % preliminaries 884 \textbf{Customer} & & \textbf{malicious Merchant} 885 \\ \text{knows:} & & \text{knows:} 886 \\ \text{reserve keys } w_s, W_p 887 \\ \text{denomination public key } D_p = \langle e, N \rangle & & \text{denomination public key } D_p = \langle e, N \rangle 888 \\ 889 % generate coin 890 \\ & & \text{generate coin key pair:} 891 \\ & & c_s, C_p \leftarrow \text{Ed25519.KeyGen}() 892 % blind 893 \\ & & \text{blind:} 894 \\ & & r \leftarrow random \in \mathbb{Z}_N^* 895 \\ & & m' := \text{FDH}(N, C_p)*r^{e} \mod N 896 % sing with reserve sk 897 \\ & \xleftarrow[\rule{2cm}{0pt}]{m'} 898 \\ \text{sign with reserve private key:} 899 \\ \rho_W := \langle D_p, m' \rangle 900 \\ \sigma_W := \text{Ed25519.Sign}(w_s, \rho_W) 901 \\ & \xrightarrow[\rule{2cm}{0pt}]{ \langle W_p, \sigma_W, \rho_W \rangle } 902 \\ 903 \hline 904 \\ 905 \textbf{malicious Merchant} & & \textbf{Exchange} 906 \\\text{knows:} & & \text{knows:} 907 \\& & \text{reserve public key } W_p 908 \\ \text{denomination public key } D_p = \langle e, N \rangle & & \text{denomination keys } d_s, D_p 909 \\ 910 \\ & \xrightarrow[\rule{2cm}{0pt}]{ \langle W_p, \sigma_W, \rho_W \rangle } 911 \\ & & \langle D_p, m' \rangle := \rho_W 912 \\ & & \text{verify if } D_p \text{ is valid} 913 \\ & & \textbf{check } \text{Ed25519.Verify}(W_p, \rho_W, \sigma_W) 914 \\ & & \text{decrease balance if sufficient} 915 \\ & & \text{sign:} 916 \\ & & \sigma'_c := (m')^{d_s} \mod N 917 \\ & \xleftarrow[\rule{2cm}{0pt}]{\sigma'_c} 918 \\ \text{unblind:} 919 \\ \sigma_c := \sigma'_c*r^{-1} 920 \\ \text{verify signature:} 921 \\ \textbf{check if } \sigma_c = \text{FDH}(N, C_p) 922 \\ 923 \\ \text{resulting coin: } \langle c_s, C_p, \sigma_c, D_p \rangle 924 \end{array}$ 925 } 926 \end{equation*} 927 \caption{Untaxed payment using the withdraw loophole} 928 \label{fig:withdraw-loophole-exploit} 929 \end{figure} 930 931 \subsection{Payment Process} 932 The payment process is divided in two steps described by the spend and deposit protocols. 933 Details about the payment process can be found in multiple chapters in \cite{dold:the-gnu-taler-system}: 934 Chapter 4.7.3 describes the spend and deposit protocols. 935 Chapter 4.1.4 describes more general aspects as well as the contract header and deposit permission structure and details. 936 \\On a high level, payment works like this: 937 \begin{enumerate} 938 \item The customer submits a shopping cart (one or more items to buy) and commits his intent to buy them. 939 \item The merchant puts together the contract terms containing the necessary information for payment, signs it and sends both to the customer (spend protocol). 940 \item The customer generates a deposit permission and its signature for each coin used in the transaction (spend protocol). 941 \item The customer forwards the deposit permission(s) to the merchant (spend protocol). 942 If the deposit protocol is performed by the customer, this step can be skipped. 943 \item Either the customer or the merchant sends the deposit permission(s) to the exchange (deposit protocol). 944 \item The exchange processes the deposit permission and returns a deposition confirmation when successful (deposit protocol). 945 \item If the deposit protocol was performed by the customer, the deposit confirmation(s) have to be forwarded to the merchant. 946 \end{enumerate} 947 948 \subsubsection{Spend Protocol} 949 The payment process begins when a customer submits a shopping cart (one or more items to buy) and commits his intent to buy them. 950 The merchant has a key pair skM, pkM of which the customer knows the public key. 951 Note that certain details contained in contract header or deposit permission like merchant \ac{KYC} information, deposit and refund deadlines and fees are left out. 952 The deposit state machine can be seen in figure \ref{fig:deposit:states}. 953 \begin{figure}[htp] 954 \begin{center} 955 \includegraphics[scale=0.7]{deposit.pdf} 956 \end{center} 957 \caption{State machine of a deposit (source: \cite{pic:deposit-state-machine})} 958 \label{fig:deposit:states} 959 \end{figure} 960 961 \begin{enumerate} 962 \item The merchant puts together the following information (without transmitting them) and requests payment: 963 \begin{itemize} 964 \item price $ v $ 965 \item exchange $E_m$ (multiple possible) 966 \item account $A_m$ at the exchange $E_m$ 967 \item info (free form details containing the full contract) 968 \end{itemize} 969 \item The customer generates an Ed25519 claim key pair $ p_s, P_p $ and submits the public key to the merchant. 970 This key can be used by the customer to prove that he didn't copy contract terms from another customer. 971 \item The merchant puts together the contract terms $ \rho $ and signs it with skM, resulting in the signature $ \sigma_P$. 972 \\The contract terms contains: 973 \begin{itemize} 974 \item $E_m$ (exchange) 975 \item $A_m$ (account at exchange $E_m$) 976 \item pkM 977 \item Hash($v$, info) 978 \item $ P_p $ 979 \end{itemize} 980 $ \rho_P $ (contract terms), $ \sigma_P$ (contract terms signature), $ v $ (price) and info are submitted to the customer. 981 \item The customer does the following checks: 982 \begin{itemize} 983 \item Is the signature of the contract terms correct? 984 \item Is the public key referenced in the contract terms the same as the one generated in step 2? 985 \item Is the hash of price and info the same as the one in the contract terms? 986 \end{itemize} 987 If all checks are successful, the customer chooses one or more coins to be spent. 988 For each coin, a deposit permission $ \rho_{D} $ and its signature $ \sigma_{D} $ is generated. 989 The deposit permission contains the following information: 990 \begin{itemize} 991 \item Coin public key $ C_p $ 992 \item Coin denomination public key pkD 993 \item Coin signature $ \sigma_C $ 994 \item Value to be spent for this coin $f$ (greater than zero, up to the residual value of the coin) 995 \item Hash of the contract terms $ \rho_P $ 996 \item Account of merchant $A_m$ (at exchange $E_m$) 997 \item Merchant public key pkM 998 \end{itemize} 999 The list of deposit permissions and their signatures is transferred to the merchant who then executed the deposit protocol. 1000 Note that the customer is also able to deposit the coins (instead of the merchant), this is used in cases where the merchant doesn't have an internet connection, but the customer does. 1001 This can be useful in cases where the merchant becomes unresponsive. 1002 The customer can prove that he paid in time. 1003 \item The merchant receives the deposit permissions and signatures and uses the deposit protocol to execute the payment. 1004 \end{enumerate} 1005 1006 Before we continue with the deposit protocol, there are a few interesting details to point out (described in \cite{dold:the-gnu-taler-system} section 4.1.4): 1007 \begin{itemize} 1008 \item The contract terms and the deposit permission are \ac{JSON} objects. 1009 \item The contract terms only contains a cryptographic hash of the contract. 1010 This improves privacy since the exchange doesn't have to know the full contract details, but still makes it possible to identify the contract in case of a dispute or some form of auditing. 1011 \item At the point where the merchant completes step three (submits the contract terms and its signature) to the customer, the customer is able to finish the transaction using the deposit protocol without interaction of the merchant. 1012 This means that the merchant at this step must be able to fulfill the contract if the customer completes the payment process. 1013 \end{itemize} 1014 1015 \subsubsection{Deposit Protocol} 1016 \label{sec:deposit-protocol} 1017 As previously mentioned, both parties (customer and merchant) are able to run the deposit protocol. 1018 In the following description, the term merchant will be used, but could be replaced by customer. 1019 In cases where there are multiple deposit permissions (meaning that multiple coins are used to pay), the deposit protocol is run separately for each deposit permission. 1020 \begin{enumerate} 1021 \item The merchant submits the deposit permission and its signature to the exchange. 1022 \item The exchange runs these checks: 1023 \begin{itemize} 1024 \item Is the denomination public key referenced in the deposit permission valid (issued by the exchange, lifetime between start and deposit/refresh expiration, not revoked)? 1025 \item Is the deposit permission signature $ \sigma_{D} $ a correct signature of the deposit permission $ \rho_{D} $ with the Ed25519 coin public key $ C_p $ referenced in the deposit permission? 1026 \item Is there a processed deposit recorded in the exchanges databases based on coin public key and contract terms hash (replay/double spending)? 1027 If not, continue with the next check since this is correct and expected behavior. 1028 \\If there is, does the recorded deposit permission equal the one we're currently checking? 1029 If this is the case, further checks can be skipped and the deposit confirmation signature can be returned to the customer. 1030 If not, the process should be terminated because there's something wrong with the transaction. 1031 \item Is the signature of the coin valid? 1032 \item Is $ f $ (the value to be spent) smaller or equal the residual value of the coin (check for overspending attempt)? 1033 \end{itemize} 1034 If all checks are successful, the exchange saves the deposit record containing the deposit permission and its signature in a database, subtracts the spent value from the residual value of the coin and schedules the money transfer to the merchant's account $ A_m $ (grouping payments is done to reduce payment fees). 1035 \\The exchange calculates a deposit confirmation signature $ \sigma_{DC} $ for the deposit permission with the exchange signing private key and returns them to the merchant. 1036 \\This signature is also used to prove that a merchant was the first to receive payment from a certain coin. 1037 Without this, an evil exchange could later deny confirming a payment and claim double spending. 1038 With the signature, the merchant can prove that the payment was confirmed by the exchange, thus delegating the responsibility (and potential financial loss) for double spending detection to the exchange. 1039 \item The merchant checks the signatures of the deposit confirmations with the exchange signing public key. 1040 \end{enumerate} 1041 1042 It may happen that a payment gets stuck as partially complete, for example when a backup of a wallet is restored and one coin or more have already been spent (\cite{dold:the-gnu-taler-system} chapter 4.1.4). 1043 In this case, the customer can retry the payment with a different coin. 1044 If this isn't possible, the payment can be refunded (assuming refunds were enabled for this payment). 1045 Other scenarios were described in Dold's thesis, but dismissed due to privacy concerns. 1046 This means that disputes have to be settled aside from Taler when a customer isn't able to fully pay and refunds are disabled. 1047 1048 \subsubsection{Web Payment Scenarios} 1049 The following methods are Taler-native methods for paying and payment validation. 1050 They are not identity-based, meaning that they do not require a login or similar techniques. 1051 Note that other methods could be implemented depending on the scenario. 1052 1053 \begin{itemize} 1054 \item \textbf{Resource-based web payment} (\cite{dold:the-gnu-taler-system} chapter 4.1.5): 1055 All Taler contract terms contain a fulfillment URL. 1056 This can either be a direct link to a digital product (like a movie, a song or a document), or to a confirmation page. 1057 When a browser opens a fulfillment URL for a resource that hasn't yet been paid for, the merchant requests payment. 1058 The wallet then generates and submits a claim key pair, thus claiming the contract, which then can be paid (if the user accepts the contract). 1059 The browser can then retry to navigate to the fulfillment URL, this time submitting the contract order ID as parameter, which the merchant can check if it has been paid (and deliver the content if this is the case). 1060 This is known as the extended fulfillment URL 1061 \\The wallet stores fulfillment URLs and their associated contracts. 1062 Upon receiving a payment request, the wallet searches the stored fulfillment URLs and if it found one, automatically forwards the user to the extended fulfillment URL containing the contract. 1063 \item \textbf{Session-bound payments and sharing} (\cite{dold:the-gnu-taler-system} chapter 4.1.6): 1064 So far, validating payment is done using the extended fulfillment URL. 1065 The problem with this approach is that this URL can be shared, which is a problem for digital content. 1066 To make this more difficult, the seller's website assigns the user a session ID (for example using a session cookie) and extends the extended fulfillment URL with a session signature parameter. 1067 This parameter can be used by the merchant to check if the user paid for the resource or replayed the payment in this session. 1068 \item \textbf{Embedded content} (\cite{dold:the-gnu-taler-system} chapter 4.1.7): 1069 When paying to access multiple resources behind a paywall (instead of just one resource), the previously described methods do not work. 1070 Dold's thesis suggest two methods: 1071 \begin{enumerate} 1072 \item A session cookie can be set by accessing the fulfillment URL. 1073 When the browser requests a subresource, the merchant can verify the session cookie. 1074 \item In this scenario, the fulfillment URL would show the resources behind the paywall. 1075 Upon opening the extended fulfillment URL, the merchant's website would add an authentication token to the URLs of the subresources. 1076 When accessing a subresource, the merchant can check the authentication tokens validity. 1077 \end{enumerate} 1078 \end{itemize} 1079 1080 \subsection{Refresh Protocol} 1081 \label{sec:refresh-protocol} 1082 This section provides a description of the refresh protocol. 1083 The technical details can be found in 4.7.4 \cite{dold:the-gnu-taler-system}. 1084 All relevant preliminaries needed to understand the technical details were already introduced in this work. 1085 1086 \subsubsection{Introduction} 1087 A protocol to refresh coins is needed for many reasons. 1088 One important reason is giving change. 1089 Similar to the real world, there are often situations where one does not have the exact amount of coins. 1090 A change protocol therefore provides a lot of convenience for the users. 1091 Without such a mechanism it would be quite hard to use. \\ 1092 Giving change is not trivial, since \ac{AML} and \ac{CFT} compliance still needs to hold. 1093 On the other side, the change still needs to provide privacy for the customer. 1094 Thus, the change must be unlinkable to the previous (or any) transaction.\\ 1095 Complying with \ac{AML} and \ac{CFT} while preserving the customer's anonymity may sound like a contradiction at first. 1096 However, Taler has a clever way to solve this problem with the refresh protocol. 1097 1098 The general idea is that the new coin can be derived from the private key of the old coin. 1099 1100 \subsubsection{DH Lock} 1101 \ac{DHKE} was introduced in section \ref{sec:preliminaries-DHKE}. 1102 Taler uses \ac{ECDH} as a lock with two possible keys to unlock the shared key. 1103 To create such a lock, one creates two key pairs $C = cG$ and $T = tG$. 1104 To unlock now means calculating $k$. 1105 Both private keys, $c$ and $t$ are now able to calculate $k = tC = t(cG) = c(tG) = cT$ and thus can unlock the lock. 1106 This $k$ can then be used to derive the private key of the new coin and the corresponding blinding factor. 1107 1108 \subsubsection{Customer Setup} 1109 1110 The customer, which holds the old partially spend coin and knows \\$C_{old} = \text{Ed25519.GetPub}(c_{old})$. 1111 A transfer key $T = \text{Ed25519.GetPub}(t)$ is then (randomly) generated by the customer. 1112 \\The key pairs $T = \text{Ed25519.GetPub}(t)$ and $C_{old} = \text{Ed25519.GetPub}(c_{old})$ form the lock with two keys that was introduced before. 1113 The customer then creates $x = c_{old}, T = tC_{old}$ and derives $c_{new}$, the private key of the new coin and $b_{new}$ the blinding factor of the new key. 1114 As usual the customer calculates the coins public key $C_{new} = \text{Ed25519.GetPub}(c_{new})$, hashes the new coin with \gls{fdh} $f_{new} = \text{FDH}(C_{new})$ and blinds the hash $f'_{new} = f_{new}b_{new}^e$. 1115 The $f'_{new}$ is then transmitted to the exchange. 1116 \\Figure \ref{fig:refresh-derive} shows how the new coin is derived as explained above. 1117 1118 \begin{figure}[htp] 1119 \centering 1120 \fbox{% 1121 \procedure[codesize=\small]{$\text{RefreshDerive}(s, \langle e,N\rangle, C_p)$}{% 1122 t := \text{HKDF}(256, s, \text{"t"}) \\ 1123 T := \text{Curve25519.GetPub}(t) \\ 1124 x := \textrm{ECDH-EC}(t, C_p) \\ 1125 r := \text{SelectSeeded}(x,\mathbb{Z}^*_N)\\ 1126 c'_s := \text{HKDF}(256,x,"c")\\ 1127 C'_p := \text{Ed25519.GetPub}(c'_s)\\ 1128 \overline{m} := r^e * C'_p \mod N\\ 1129 \pcreturn \langle t, T, x, c_s', C_p', \overline{m}\rangle 1130 } 1131 } 1132 \caption[RefreshDerive algorithm]{The RefreshDerive derives a new coin from a dirty coin with a seed. The DH-Lock is used to create the link used in the linking protocol} 1133 \label{fig:refresh-derive} 1134 \end{figure} 1135 1136 Now with the DH Lock the person who is in possession of the old key can always recalculate and thus spend the new coin (as long as it knows the public transfer key $T$). 1137 However, there is one last thing: How does the exchange know that the old key is linked to the new one? 1138 To comply with \ac{AML} and \ac{CFT}, the exchange wants to ensure that the person who created the new coin is also in possession of the old coin. 1139 A link needs to be created in a way that nobody can link the old coin to the new coin, except the person in possession of the old coin. 1140 The person in possession of the old coin needs to proof to the exchange that this link was created without revealing the link. 1141 This problem is solved with the cut and choose protocol in the next section. 1142 1143 \begin{figure}[htp] 1144 \centering 1145 \includegraphics[height=0.5\textwidth]{taler_refresh_transfer_key.png} 1146 \caption{Taler refresh protocol, transfer key setup (source: \cite{pic:refresh-prot})} 1147 \label{fig:taler-refresh-transfer-key} 1148 \end{figure} 1149 \newpage 1150 \subsubsection{Cut \& Choose} 1151 Instead of doing the customer setup once, it is done $n$ times. 1152 The customer generates $n$ different transfer keys $t_1, t_2 \dots t_n$. 1153 For each key the whole calculations are done and all the blinded coins $f'_1, f'_2 \dots f'_n$ are sent to the exchange together with the old coins public key and signature. \\ 1154 The exchange responds with a randomly picked number from $1$ to $n$. 1155 The customer has to reveal all the transfer keys, \textbf{except the one picked by the exchange.} 1156 The exchange makes the same calculations with the revealed private transfer keys (without knowing the private key $c_{old}$). 1157 The exchange can now verify whether the customer was honest or not. 1158 A evil customer could create a new coin which is not linked to the old coin (without the DH lock). 1159 Such attacks will be detected with a high probability in this protocol. 1160 Since the $t_x$ picked by the exchange is not checked, an evil customer can win this with a probability of $1/n$. 1161 Already with $n=3$ an attack is not in the customers interest due to economic reasons. 1162 In 2 out of 3 cases the exchange would detect the attack and would keep the money and the customer would have lost it. 1163 The probability can be adjusted with $n$. 1164 With increasing size of $n$ the attack becomes even less attractive. 1165 When the cut and choose protocol ended successfully, the value of the old coin is set to zero. 1166 1167 \begin{figure}[htp] 1168 \centering 1169 \includegraphics[height=0.5\textwidth]{taler_cut_and_choose.png} 1170 \caption{Taler refresh protocol, cut and choose (source: \cite{pic:refresh-prot})} 1171 \label{fig:taler-cut-and-choose} 1172 \end{figure} 1173 1174 \subsection{Commit Phase} 1175 \label{sec:commit-phase-rsa} 1176 The refresh protocol is implemented in two phases. 1177 The commit phases creates $k$ derives and commits to this values by calculating a hash over the derives. 1178 On the exchange's side various checks are done to validate the request. 1179 Detailed steps of the commit phase are shown in figure \ref{fig:refresh-part1}. 1180 1181 1182 \begin{figure} 1183 \begin{equation*} 1184 \resizebox{1.0\textwidth}{!}{$\displaystyle 1185 \begin{array}{ l c l } 1186 % preliminaries 1187 \text{Customer} & & \text{Exchange} 1188 \\ \text{knows:} & & \text{knows:} 1189 \\ \text{denomination public key } D_{p(i)} & & \text{denomination keys } d_{s(i)}, D_{p(i)} 1190 \\ \text{coin}_0 = \langle D_{p(0)}, c_s^{(0)}, C_p^{(0)}, \sigma_c^{(0)} \rangle & & 1191 % refresh request 1192 \\ \text{Select} \langle N_t, e_t\rangle := D_{p(t)} \in D_{p(i)} 1193 \\ \textbf{for } i = 1, \dots, \kappa: % generate k derives 1194 \\ s_i \rightarrow \{0,1\}^{256} % seed generation 1195 \\ X_i := \text{RefreshDerive}(s_i, D_{p(t)}, C_p^{(0)}) 1196 \\ (t_i, T_i, x_i, c_s^{(i)}, C_p^{(i)}, \overline{m}_i) := X_i 1197 \\ \textbf{endfor} 1198 \\ h_T := H(T_1, \dots, T_k) 1199 \\ h_{\overline{m}} := H(\overline{m}_1, \dots, \overline{m}_k) 1200 \\ h_C := H(h_t, h_{\overline{m}}) 1201 \\ \rho_{RC} := \langle h_C, D_{p(t)}, D_{p(0)}, C_p^{(0)}, \sigma_C^{(0)} \rangle 1202 \\ \sigma_{RC} := \text{Ed25519.Sign}(c_s^{(0), \rho_{RC}}) 1203 \\ \text{Persist refresh-request} \langle \rho_{RC}, \sigma_{RC} \rangle 1204 \\ & \xrightarrow[\rule{2.5cm}{0pt}]{\rho_{RC}, \sigma_{RC}} & 1205 % Exchange checks refresh request 1206 \\ & & (h_C, D_{p(t)}, D_{p(0)}, C_p^{(0)}, \sigma_C^{(0)} = \rho_{RC}) 1207 \\ & & \textbf{check} \text{Ed25519.Verify}(C_p^{(0)}, \sigma_{RC}, \rho_{RC}) 1208 \\ & & x \rightarrow \text{GetOldRefresh}(\rho_{RC}) 1209 \\ & & \textbf{Comment: }\text{GetOldRefresh} \\(\rho_{RC} \mapsto \{\bot,\gamma\}) 1210 \\ & & \pcif x = \bot 1211 \\ & & v := D(D_{p(t)}) 1212 \\ & & \langle e_0, N_0 \rangle := D_{p(0)} 1213 \\ & & \textbf{check } \text{IsOverspending}(C_p^{(0)}, D_ {p(0)}, v) 1214 \\ & & \textbf{check } D_{p(t)} \in \{D_{p(i)}\} 1215 \\ & & \textbf{check } \text{FDH}(N_0, C_p^{(0)}) \equiv_{N_0} (\sigma_0^{(0)})^{e_0} 1216 \\ & & \text{MarkFractionalSpend}(C_p^{(0)}, v) 1217 \\ & & \gamma \leftarrow \{1, \dots, \kappa\} 1218 \\ & & \text{Persist refresh-record } \langle \rho_{RC},\gamma \rangle 1219 \\ & & \pcelse 1220 \\ & & \gamma := x 1221 \\ & & \textbf{endif} 1222 \\ & \xleftarrow[\rule{2.5cm}{0pt}]{\gamma} & 1223 \\ 1224 \\ 1225 \\ & \textit{Continued in figure \ref{fig:refresh-part2}} & 1226 %\\ \pcintertext[dotted]{(Continued in Figure)} 1227 \end{array}$ 1228 } 1229 \end{equation*} 1230 \caption{Refresh protocol (commit phase)} 1231 \label{fig:refresh-part1} 1232 \end{figure} 1233 1234 \subsection{Reveal Phase} 1235 \label{sec:reveal-phase-rsa} 1236 In the reveal phase the customer receives $\gamma$ and he reveals the all the seeds to the exchange, except for $s_\gamma$. 1237 The exchange can then verify if the customer was honest with probability $1/k$. 1238 On success the exchange will return the blinded signature of the new coin and the customer can then unblind and store the coin. 1239 The reveal phase is described in figure \ref{fig:refresh-part2} 1240 1241 \begin{figure} 1242 \begin{equation*} 1243 \resizebox{1.0\textwidth}{!}{$\displaystyle 1244 \begin{array}{ l c l } 1245 % preliminaries 1246 \text{Customer} & & \text{Exchange} 1247 \\ & \textit{Continuation of figure \ref{fig:refresh-part1}} & 1248 \\ 1249 \\ 1250 % Check challenge and send challenge response (reveal not selected msgs) 1251 \\ & \xleftarrow[\rule{2.5cm}{0pt}]{\gamma} & 1252 \\ \textbf{check } \text{IsConsistentChallenge}(\rho_{RC}, \gamma) 1253 \\ \textbf{Comment: } \text{IsConsistentChallenge}\\(\rho_{RC}, \gamma) \mapsto \{ \bot,\top \} 1254 \\ 1255 \\ \text{Persist refresh-challenge} \langle \rho_{RC}, \gamma \rangle 1256 \\ S := \langle s_1, \dots, s_{\gamma-1}, s_{\gamma+1}, \dots,s_x \rangle % all seeds without the gamma seed 1257 \\ \rho_L = \langle C_p^{(0)}, D_{p(t)}, T_{\gamma},\overline{m}_\gamma \rangle 1258 \\ \rho_{RR} = \langle T_\gamma, \overline{m}_\gamma, S \rangle 1259 \\ \sigma_{L} = \text{Ed25519.Sign}(c_s^{(0)}, \rho_{L}) 1260 \\ & \xrightarrow[\rule{2.5cm}{0pt}]{\rho_{RR},\rho_L, \sigma_{L}} & 1261 % check revealed msgs and sign coin 1262 \\ & & \langle T'_\gamma, \overline{m}'_\gamma, S \rangle := \rho_{RR} 1263 \\ & & \langle s_1,\dots,s_{\gamma-1},s_{\gamma+1},\dots,s_\kappa \rangle ) := S 1264 \\ & & \textbf{check } \text{Ed25519.Verify}(C_p^{(0)}, \sigma_L, \rho_L) 1265 \\ & & \pcfor i = 1,\dots, \gamma-1, \gamma+1,\dots, \kappa 1266 \\ & & X_i := \text{RefreshDerive}(s_i, D_{p(t)}, C_p^{(0)}) 1267 \\ & & \langle t_i, T_i, x_i, c_s^{(i)}, C_p^{(i)}, \overline{m}_i \rangle := X_i 1268 \\ & & \textbf{endfor} 1269 \\ & & h_T' = H(T_1,\dots,T_{\gamma-1},T'_{\gamma},T_{\gamma+1},\dots,T_\kappa) 1270 \\ & & h_{\overline{m}}' = H(\overline{m}_1,\dots,\overline{m}_{\gamma-1},\overline{m}'_{\gamma},\overline{m}_{\gamma+1},\dots,\overline{m}_\kappa) 1271 \\ & & h_C' = H(h_T', h_{\overline{m}}') 1272 \\ & & \textbf{check } h_C = h_C' 1273 \\ & & \overline{\sigma}_C^{(\gamma)} := \overline{m}^{d_{s(t)}} 1274 \\ & \xleftarrow[\rule{2.5cm}{0pt}]{\overline{\sigma}_C^{(\gamma)}} & 1275 % Check coin signature and persist coin 1276 \\ \sigma_C^{(\gamma)} := r^{-1}\overline{\sigma}_C^{(\gamma)} 1277 \\ \textbf{check } (\sigma_C^{(\gamma)})^{e_t} \equiv_{N_t} C_p^{(\gamma)} 1278 \\ \text{Persist coin} \langle D_{p(t)}, c_s^{(\gamma)}, C_p^{(\gamma)}, \sigma_C^{(\gamma)} \rangle 1279 \end{array}$ 1280 } 1281 \end{equation*} 1282 \caption{Refresh protocol (reveal phase)} 1283 \label{fig:refresh-part2} 1284 \end{figure} 1285 1286 \subsubsection{(Un)linkability} 1287 \begin{figure}[htp] 1288 \centering 1289 \includegraphics[height=0.5\textwidth]{taler_refresh_link_threat.png} 1290 \caption{Taler refresh protocol, linkability (source: \cite{pic:refresh-prot})} 1291 \label{fig:taler-link-threat} 1292 \end{figure} 1293 The goal of the cut and choose protocol is to ensure with a high probability ($1/n$) that the customer honestly created the new coin. 1294 It ensures that the old coin is linked to the new coin via the DH lock. 1295 1296 With that, the following attack scenario is prevented (with probability $1/n$):\\ 1297 An third party creates the new coin without the DH lock as described in section \ref{sec:blind-sign-schemes}. 1298 The third party sends the blinded new coin to the customer (who possesses the old coin). 1299 The customer then signs the new coin by the exchange and sends the blinded signature back to the third party. 1300 The third party would then be in possession of a valid new coin, which is not linked to the old coin. 1301 As mentioned, such an attack is detected with a high probability by the exchange with the cut and choose protocol described earlier. 1302 1303 We will now consider the following attack scenario:\\ 1304 Someone could give the private key of the old coin $c_{old}$ to another person. 1305 This other person then can derive a new coin using the refresh protocol. 1306 The original customer currently can not recreate the new coin with only the knowledge of the old coins private key $c_{old}$. 1307 He would need to know the public key of the transfer key $T_x$ and also the blinded signature of the new coin $f'_{new}$. 1308 For this reason the exchange exposes the public transfer key $T_x$ and the blinded new coin $f'_{new}$ for a given old coin $C_{old}$. 1309 So anybody who knows the public key of the old coin could ask for the public transfer key and the blinded signature of the new coin. 1310 Only a person in possession of the old coins private key $c_{old}$ can recreate the new coin's private key. \\ 1311 This mechanism can not be abused for money laundering anymore, since the original customer could trick this third person and spend the coin faster. 1312 The linking protocol is described in figure \ref{fig:refresh-link}. 1313 1314 \begin{figure} 1315 \begin{equation*} 1316 \resizebox{1.0\textwidth}{!}{$\displaystyle 1317 \begin{array}{ l c l } 1318 % preliminaries 1319 \text{Customer} & & \text{Exchange} 1320 \\ \text{knows:} & & \text{knows:} 1321 \\ \text{coin}_0 = \langle D_{p(0)}, c_s^{(0)}, C_p^{(0)}, \sigma_{C}^{(0)} \rangle 1322 \\ & \xrightarrow[\rule{2.5cm}{0pt}]{C_{p(0)}} & 1323 \\ & & L := \text{LookupLink}(C_{p(0)}) 1324 \\ & & \textbf{Comment: } \text{LookupLink}(C_p) \mapsto \{\langle \rho_L^{(i)}, 1325 \\ & & \sigma_L^{(i)}, \overline{\sigma}_C^{(i)} \rangle\} 1326 \\ & \xleftarrow[\rule{2.5cm}{0pt}]{L} & 1327 \\ \pcfor \langle \rho_{L}^{(i)}, \overline{\sigma}_L^{(i)}, \sigma_C^{(i)} \rangle \in L 1328 \\ \langle \hat{C}_p^{(i)}, D_{p(t)}^{(i)}, T_\gamma^{(i)}, \overline{m}_\gamma^{(i)} \rangle := \rho_L^{(i)} 1329 \\ \langle e_t^{(i)}, N_t^{(i)} \rangle := D_{p(t)}^{(i)} 1330 \\ \textbf{check } \hat{C}_p^{(i)} \equiv C_p^{(0)} 1331 \\ \textbf{check } \text{Ed25519.Verify}(C_p^{(0)}, \rho_{L}^{(i)}, \sigma_L^{(i)}) 1332 \\ x_i := \text{ECDH}(c_s^{(0)}, T_{\gamma}^{(i)}) 1333 \\ r_i := \text{SelectSeeded}(x_i,\mathbb{Z}^*_{N_t}) 1334 \\ c_s^{(i)} := \text{HKDF}(256,x_i,"c") 1335 \\ C_p^{(i)} := \text{Ed25519.GetPub}(c_s^{(i)}) 1336 \\ \sigma_C^{(i)} := (r_i)^{-1} \cdot \overline{m}_\gamma^{(i)} 1337 \\ \textbf{check } (\sigma_C^{(i)})^{e_t^{(i)}} \equiv_{N_t^{(i)}} C_p^{(i)} 1338 \\ \text{(Re-)obtain coin} \langle D_{p(t)}^{(i)},c_s^{(i)}, C_p^{(i)}, \sigma_C^{(i)} \rangle 1339 \end{array}$ 1340 } 1341 \end{equation*} 1342 \caption{Linking protocol} 1343 \label{fig:refresh-link} 1344 \end{figure} 1345 1346 1347 \subsection{Tipping Protocol} 1348 \label{sec:tipping} 1349 Source for this protocol was section 4.1.10 from \cite{dold:the-gnu-taler-system}.\\ 1350 Merchants can give customers a small tip by using the withdraw loophole (described in section \ref{sec:withdraw-loophole}). 1351 This can be for a variety of different reasons, for example for submitting a survey. 1352 The merchant needs to create a reserve with the exchange. 1353 The reserve keys is now used to sign blinded coins generated by the user. 1354 \begin{enumerate} 1355 \item The Merchant triggers the Payment required response with the Taler-Tip header set 1356 \item The taler tip header contains information like amount, exchange to use, deadline and more. (details section 4.1.10 \cite{dold:the-gnu-taler-system}) 1357 \item The customer creates planchets that sum up the amount and blinds the token with the denomination key of the specified exchange and sends the blinded planchets to the merchant. 1358 \item The merchant creates withdrawal confirmations (by signing them with the reserver private key) for these planchets and responds with a list of signatures. 1359 \item The customer then uses these signatures to create coins as in the withdrawal protocol 1360 \end{enumerate} 1361 The received coins are still anonymized and only spendable by the customer. 1362 1363 1364 \subsection{Refund Protocol} 1365 A merchant can undo a deposit on a coin by signing a refund permission. 1366 The protocol details can be found in section 4.7.5 of \cite{dold:the-gnu-taler-system}. 1367 Since a refund is mainly done by the merchant, to provide refunds a merchant need to support refunds. 1368 A refund can be either fully or partially. 1369 After a refund, the customer is able to spend the coin, but it should be refreshed first to prevent linking of transactions. 1370 The refund deadline is specified in the contract header, after the deadline the exchange makes a wire transfer with the money to the merchants bank. 1371 There is a refund fee, which is subtracted from the remaining coin value. 1372 This also prevents denial of service attacks, or at least makes them economically uninteresting. 1373 There exists automatic refunds when a payment only partially succeeds for many reasons. 1374 Refunds are also an important business case for many merchants who want to provide a convenient experience. 1375 A merchant can for example provide a refund when the customer is not happy with the product. 1376 Such a refund can be made by the merchant with a signature without the customers consent. 1377 Now should be clear what the purpose of a refund protocol is, the rest of this section will look at the refund protocol. 1378 1379 1380 In the protocol the customer requests a refund from the merchant. 1381 If the merchant accepts the request, it authorizes the exchange to apply the refund. 1382 \begin{enumerate} 1383 \item The customer asks for a refund for payment $p$ with reason $m$ 1384 \item The merchant decides whether it accepts the refund or not according to the merchants business rules. 1385 \item If accepted, the merchant signs the refund permission with the merchants Ed25519 key and sends it to exchange. 1386 \item The exchange checks the signature and refunds the coin(s) and sends a signed confirmation to the merchant. 1387 \item The merchant sends the signed confirmation from the exchange to the customer. 1388 \end{enumerate} 1389 1390 \section{Trust and PKI in Taler} 1391 In this section Taler's \ac{PKI} is explained and how Taler handles trust. 1392 This section is included due to the reason that we have to create Schnorr denomination keys to add the Clause Blind Schnorr Signature scheme to Taler. 1393 Taler uses TLS, however it does not rely on TLS for authenticity or integrity. (More detailed in chapter 4.1.3 of \cite{dold:the-gnu-taler-system}) 1394 1395 \subsubsection{Auditor} 1396 In Taler the auditors serves as trust anchor, and they are identified by a single Ed25519 public key. 1397 Similar to the list of trusted root \ac{CA} that come with web browsers and operating systems, a wallet comes with a list of trusted auditor certificates. 1398 In the rest of this section, different parts of Taler and how they are integrated in Taler's \ac{PKI} are discussed. 1399 The section ends with a discussion about security risks of Taler's trust model. 1400 For details, refer to chapter 4.1.3 of \cite{dold:the-gnu-taler-system}. 1401 1402 \begin{figure}[htp] 1403 \includegraphics[height=0.5\textwidth]{taler-pki.png} 1404 \centering 1405 \caption{GNU Taler PKI entities (source: \cite{dold:the-gnu-taler-system})} 1406 \label{fig:taler-pki} 1407 \end{figure} 1408 1409 \subsubsection{Exchange} 1410 The exchange has to expose an API in order to enable customers (wallets), merchants and auditors to access keys and other information. 1411 An exchange has a long term master key (Ed25519 key) and a base URL. 1412 The URL and the long term \ac{MK} identifies an exchange. 1413 The \ac{MK} is only used as an offline signing key and should be stored on an air-gapped machine. 1414 Further, the exchange has online signing keys (Ed25519 key), which are signed by the exchanges \ac{MK}. 1415 This \ac{MK} is on his side signed by one or possibly more auditors master key(s). 1416 The exchange's (online) signing keys are used to sign API responses. 1417 The denomination keys of an exchange are also signed by the exchanges offline \ac{MK} and the auditors \ac{MK}. 1418 The bank accounts supported by the exchange for withdrawals and deposits are also signed by the exchanges offline \ac{MK}. 1419 1420 API requests are made to the base URL appending the name of the endpoint (eg. <base-url>/keys) 1421 The endpoint <base-url>/keys is used to get the exchanges signing keys and other information. 1422 Similar to the \ac{CA} trust model, the client (customer or merchant) can validate the signature of the keys, with the list of trusted auditor certs. 1423 1424 \subsubsection{Coins} 1425 As seen in the withdrawal protocol blind signatures are done with RSA public keys (section \ref{sec:blind-rsa-sign}). 1426 These keys are called denomination keys and they represent the coin value of the signed coins. 1427 The following information concerning the denomination keys are signed by the exchanges master key (citation from \cite{dold:the-gnu-taler-system} chapter 4.1.3): 1428 \begin{itemize} 1429 \item The RSA public key 1430 \item The start date, after which coins of this denomination can be withdrawn and deposited. 1431 \item The withdraw expiration date, after which coins cannot be withdrawn anymore, must be after the start date. 1432 \item The deposit expiration date, after which coins cannot be deposited anymore, must be after the withdraw expiration date. 1433 \item The legal expiration date, after which the exchange can delete all records about operations with coins of this denominations, must be (typically quite a long time!) after the deposit expiration date. 1434 \item The fees for a withdraw, deposit, refresh and refund operation with this coin, respectively. 1435 \end{itemize} 1436 1437 As mentioned, the denomination keys are signed by the exchanges \ac{MK} and also by the auditor. 1438 1439 \subsubsection{Merchant} 1440 The merchant has one Ed25519 public key. 1441 With that key the merchant authenticates to the exchange and signs responses to the customer. 1442 Depending on the jurisdiction, an exchange needs to comply to \ac{KYC} regulations. 1443 A merchant which accepts payments from all exchanges (audited by a trusted auditor) therefore needs to fulfill \ac{KYC} registration for all accepted exchange separately. 1444 This is needed to be legally compliant. \\ 1445 Like the customer, also the merchant is configured with a set of trusted auditors and exchanges. 1446 A merchant only accepts payments with coins of denominations from a trusted exchange which is audited by a trusted auditor. 1447 1448 For this reason Taler separates this service into an isolated service, similar to on-premise or external payment gateways, which are used by most e-commerce shops nowadays. 1449 1450 \subsubsection{Customer} 1451 A customer has private keys of reserves that they own to authenticate with the exchange. 1452 The public key was communicated to the exchange with the wire transfer. (A bank however is not part of Taler's \ac{PKI}.) 1453 A customer is therefore not registered with an exchange. 1454 1455 Further a customer possesses the private keys of his coins and stores them in a digital wallet. 1456 \subsubsection{Security Discussion} 1457 Taler's trust model is technically similar to the \ac{CA} trust model we know from TLS certificates. 1458 The trust anchor lies with the auditors, whose certificates are pre-configured by the merchant or customer respectively. 1459 However, trust is always somehow attackable. 1460 That does not mean that there is a security issue in the trust model. 1461 When the list of trusted auditor certs of a customer/merchant somehow can be manipulated, the trust model breaks for this entity. \\ 1462 One attack scenario would be to attack customers/merchants with a supply-chain attack on the wallets or merchant backends' implementation. 1463 With software supply-chain attacks on the rise in 2020/21 (although the concept is not new) such an attack could have a big impact. \\ 1464 Since auditor certs are coupled with the wallet (or merchant) implementation, a bank, country, central bank or auditor will most likely publish a wallet and a merchant implementation for the corresponding Taler ecosystem. 1465 %This would make it possible for the publisher to make changes on the Taler protocol for this specific implementation.