arnaucube.com/public/blind-signatures-ec.html
public/blind-signatures-ec.htmlRaw
1<!DOCTYPE html>
2<html lang="en">
3
4 <head>
5 <meta name="description" content="In this notes, we will cover the scheme proposed at 'New Blind Signature Schemes Based on the (Elliptic Curve) Discrete Logarithm Problem' paper by Hamid Mala & Nafiseh Nezhadansari." />
6 <meta charset="utf-8">
7 <title> Notes on blind signatures over elliptic curves - arnaucube - blog</title>
8 <meta name="title" content=" Notes on blind signatures over elliptic curves - arnaucube - blog">
9 <meta name="description" content="In this notes, we will cover the scheme proposed at 'New Blind Signature Schemes Based on the (Elliptic Curve) Discrete Logarithm Problem' paper by Hamid Mala & Nafiseh Nezhadansari.">
10
11 <meta property="og:title" content=" Notes on blind signatures over elliptic curves - arnaucube - blog" />
12 <meta property="og:description" content="In this notes, we will cover the scheme proposed at 'New Blind Signature Schemes Based on the (Elliptic Curve) Discrete Logarithm Problem' paper by Hamid Mala & Nafiseh Nezhadansari." />
13 <meta property="og:url" content="https://arnaucube.com/blog/blind-signatures-ec.html" />
14 <meta property="og:type" content="article" />
15 <meta property="og:image" content="https://arnaucube.com/blog/img/posts/blind-signatures-ec/flow1.png" />
16 <meta name="twitter:title" content=" Notes on blind signatures over elliptic curves - arnaucube - blog">
17 <meta name="twitter:description" content="In this notes, we will cover the scheme proposed at 'New Blind Signature Schemes Based on the (Elliptic Curve) Discrete Logarithm Problem' paper by Hamid Mala & Nafiseh Nezhadansari.">
18 <meta name="twitter:image" content="https://arnaucube.com/blog/img/posts/blind-signatures-ec/flow1.png">
19 <meta name="twitter:card" content="summary_large_image">
20 <meta name="author" content="arnaucube">
21
22 <meta name="viewport" content="width=device-width, initial-scale=1">
23
24 <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.0.2/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-EVSTQN3/azprG1Anm3QDgpJLIm9Nao0Yz1ztcQTwFspd3yD65VohhpuuCOmLASjC" crossorigin="anonymous">
25 <link rel="stylesheet" href="css/style.css">
26
27 <!-- highlightjs -->
28 <!-- <link rel="stylesheet" href="js/highlightjs/atom-one-dark.css"> -->
29 <link rel="stylesheet" href="js/highlightjs/gruvbox-dark.css">
30 <script src="js/highlightjs/highlight.pack.js"></script>
31
32 <!-- katex -->
33 <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/katex@0.13.11/dist/katex.min.css" integrity="sha384-Um5gpz1odJg5Z4HAmzPtgZKdTBHZdw8S29IecapCSB31ligYPhHQZMIlWLYQGVoc" crossorigin="anonymous">
34 </head>
35
36 <body>
37
38 <!-- o_gradient_background" -->
39 <nav id="mainNav" class="navbar navbar-default navbar-fixed-top"
40 style="height:50px;font-size:130%;">
41 <div class="container">
42 <a href="/blog" style="color:#000;">Blog index</a>
43 <div style="float:right;">
44 <a href="/" style="color:#000;display:inline-block;">arnaucube.com</a>
45 <div class="onoffswitch" style="margin:10px;display:inline-block;" title="change theme">
46 <input onclick="switchTheme()" type="checkbox" name="onoffswitch" class="onoffswitch-checkbox"
47 id="themeSwitcher">
48 <label class="onoffswitch-label" for="themeSwitcher"></label>
49 </div>
50 </div>
51 </div>
52 <img style="height:5px; width:100%; margin-top:8px;" src="img/gradient-line.jpg" />
53 </nav>
54
55
56
57 <div class="container" style="margin-top:40px;max-width:800px;">
58 <h1>Notes on blind signatures over elliptic curves</h1>
59
60<p><em>2021-07-30</em></p>
61
62<blockquote>
63<p><strong>Warning</strong>: I want to state clearly that I’m not a mathematician, I’m just an amateur on math studying in my free time, and this article is just an attempt to try to sort the notes that I took while reading about the blind signatures over elliptic curves.</p>
64</blockquote>
65
66<h4>Blind signatures</h4>
67
68<p>Few years ago I read about the RSA blind signatures scheme (thanks to <a href="https://futur.upc.edu/JuanBautistaHernandezSerrano">Juan Hernández</a> who discovered it to me) and I was amazed on such thing being possible. You can read the step by step of the <em>RSA blind signatures</em> scheme in <a href="https://en.wikipedia.org/wiki/Blind_signature#Blind_RSA_signatures">this Wikipedia article</a>.
69The main idea is that one party has a message and blinds it, then sends the blinded message to a signer. The signer generates a signature of that blinded message, who sends it to the initial party, who unblinds the signature, obtaining a valid signature for the original message, while the signer does not know what it is signing, but the signature can be verified for the original message for the signer’s public key.</p>
70
71<p><div style="text-align:center; font-size:80%;">
72 <img style="padding:50px;max-width:100%;" src="img/posts/blind-signatures-ec/flow0.png" />
73 <i>Diagram showing the described steps.</i>
74</div>
75<br></p>
76
77<p>This has many applications, one of them could be to authenticate users in a ‘traditional’ way (by user&password, or by public key & signature) in the Certification Authority (CA), and once the user is authenticated, the user can create a new key pair (ephemeral key), for which public key gets blinded and sent to the CA. The CA performs a blind signature on it, and sends the result back to the user. Then, the user can unblind the signature, and as result has their public key signed by the CA, but the CA does not know which is the public key (but the CA knows that the user while being authenticated by their ‘traditional’ login, generated a new identity (key pair) and sent the public key blinded to the CA, who blindly signed it and returned the signature back to the user). Then the user has the ephemeral public key which is signed by the CA, and can use it to enter the system authenticating that they are an approved user without revealing which user they are.</p>
78
79<p>As most of the current ongoing protocols are using <em>elliptic curve</em> cryptography instead of <em>RSA</em>, the mentioned <em>RSA blind signatures</em> scheme is not much plugable in the existing systems that use <em>elliptic curve</em> keys. That’s why I got interested into reading and learning about schemes that provide blind signatures over <em>elliptic curve</em>.</p>
80
81<h4>The scheme</h4>
82
83<p>In this notes, we will cover the scheme proposed at <em>“<a href="https://sci-hub.do/10.1109/ICCKE.2013.6682844">New Blind Signature Schemes Based on the (Elliptic Curve) Discrete Logarithm Problem</a>”</em> paper by Hamid Mala & Nafiseh Nezhadansari (thanks to <a href="https://twitter.com/feministPLT">Daira Hopwood</a> who mentioned this paper in a Telegram group).</p>
84
85<p>First of all, the <em>signer</em> generates their key pair by generating a random scalar $d \in \mathbb{Z}_n$ (where $\mathbb{Z}_n$ is the elliptic curve field), which will be the <em>private key</em>. From $d$ they can compute the <em>public key</em> by $Q = dG$, where $G$ is the generator point of $\mathbb{G}$ (the elliptic curve group).</p>
86
87<p>Appart from their key pair, the <em>signer</em> will generate for each request of signature another random value $k \in \mathbb{Z}_n$, and its respective $R’=kG$.</p>
88
89<p>The <em>user</em> has a message <em>m</em> that which they want to get signed by the <em>signer</em> (without the <em>signer</em> knowing the content of <em>m</em>). In order to achieve that, the user will generate a coupe of random values $a, b \in \mathbb{Z}_n$, and from these parameters will compute the <em>blinding factor</em> $R=aR’ + bG = (ak + b)G$, and as $R$ is a point we can get $R = (x, y)$.
90The user can <em>blind</em> the message by computing $m’ = a^{-1} \cdot x \cdot h(m)$, where $h(m)$ is the hash of the message.</p>
91
92<p>Then, the <em>user</em> sends the <em>blinded message</em> ($m’$) to the <em>signer</em>, who will perform the <em>blind signature</em> by computing $s’ = d m’ + k$, which is sent back to the <em>user</em>.</p>
93
94<p>The <em>user</em> can unblind the signature by $s = a s’ + b$, and the complete signature will be $(R, s)$.</p>
95
96<p>And now, we are in a point where the signature can be verified by a third party for the <em>signer</em>’s public key by checking $sG == R + x h(m) Q$.</p>
97
98<p><div style="text-align:center; font-size:80%;">
99 <img style="padding:50px;max-width:100%;" src="img/posts/blind-signatures-ec/flow1.png" />
100 <i>The previous diagram but with the operations from each step.</i>
101</div>
102<br></p>
103
104<p>From the verification $sG == R + x h(m) Q$, we can unroll it and check that:</p>
105
106<p>$$
107\fbox{sG} = (a s’ + b) G = (a (d m’ + k) + b) G\newline
108= (a d m’ + ak + b) G = ((a d (a^{-1} x h(m))) + ak + b) G\newline
109= (d x h(m) + ak + b) G\newline
110= dG x h(m) + (ak + b)G = \fbox{R + x h(m) Q}
111$$</p>
112
113<h4>Code</h4>
114
115<p>Here is an example of how this scheme on the <a href="https://en.bitcoin.it/wiki/Secp256k1">secp256k1</a> curve could be used using the implementation from <a href="https://github.com/arnaucube/go-blindsecp256k1">go-blindsecp256k1</a>.</p>
116
117<pre><code class="language-go">import (
118 [...]
119 "github.com/arnaucube/go-blindsecp256k1"
120)
121
122func main() {
123 // signer: create new signer key pair
124 sk := blindsecp256k1.NewPrivateKey()
125 signerPubK := sk.Public()
126
127 // signer: when user requests new R parameter to blind a new msg,
128 // create new signerR (public) with its secret k
129 k, signerR := blindsecp256k1.NewRequestParameters()
130
131 // user: blinds the msg using signer's R
132 msg := new(big.Int).SetBytes([]byte("test"))
133 msgBlinded, userSecretData, err := blindsecp256k1.Blind(msg, signerR)
134 if err != nil {
135 panic(err)
136 }
137
138 // signer: signs the blinded message using its private key & secret k
139 sBlind, err := sk.BlindSign(msgBlinded, k)
140 if err != nil {
141 panic(err)
142 }
143
144 // user: unblinds the blinded signature
145 sig := blindsecp256k1.Unblind(sBlind, userSecretData)
146
147 // signature can be verified with signer PublicKey
148 verified := blindsecp256k1.Verify(msg, sig, signerPubK)
149 if !verified {
150 fmt.Println("verification failed")
151 } else {
152 fmt.Println("blind signature verified")
153 }
154}
155</code></pre>
156
157<h4>Conclusions</h4>
158
159<p>Blind signatures are an interesting concept, which can be used in some use cases specially on voting systems. As we’ve seen, the math background behind it’s not quite complex compared for example to zkSNARKs, and it does not require <a href="https://medium.com/qed-it/diving-into-the-snarks-setup-phase-b7660242a0d7">trusted setups</a>. Although, for most of the cases zkSNARKs have more flexibility, and we could cover similar use cases by proving that the user knows some <em>private key</em> for which the corresponding <em>public key</em> is placed in a leaf of a <em>Merkle Tree</em> for a certain <em>Merkle Root</em> (but this would be out of scope for the current notes).</p>
160
161<p>An implementation of this scheme in Go can be found in: <a href="https://github.com/arnaucube/go-blindsecp256k1">https://github.com/arnaucube/go-blindsecp256k1</a> (and a compatible Typescript implementation <a href="https://github.com/arnaucube/blindsecp256k1-js">blindsecp256k1-js</a>). A next iteration could be to abstract the curve & keys structures, to use the generic Go ones, so other curves and already existing keys could be used with the same code.</p>
162
163<p><em>Special thanks to <a href="https://github.com/dhole">@dhole</a> for reviewing this text.</em></p>
164
165 </div>
166
167 <footer style="text-align:center; margin-top:100px;margin-bottom:50px;">
168 <div class="container">
169 <div class="row">
170 <ul class="list-inline">
171 <li><a href="https://twitter.com/arnaucube"
172 style="color:gray;text-decoration:none;"
173 target="_blank">twitter.com/arnaucube</a>
174 </li>
175 <li><a href="https://github.com/arnaucube"
176 style="color:gray;text-decoration:none;"
177 target="_blank">github.com/arnaucube</a>
178 </li>
179 </ul>
180 </div>
181 <div class="row" style="display:inline-block;">
182 Blog made with <a href="http://github.com/arnaucube/blogo/"
183 target="_blank" style="color: gray;text-decoration:none;">Blogo</a>
184 </div>
185 </div>
186 </footer>
187
188 <script>
189 </script>
190 <script src="js/external-links.js"></script>
191 <script>hljs.initHighlightingOnLoad();</script>
192 <script defer src="https://cdn.jsdelivr.net/npm/katex@0.13.11/dist/katex.min.js" integrity="sha384-YNHdsYkH6gMx9y3mRkmcJ2mFUjTd0qNQQvY9VYZgQd7DcN7env35GzlmFaZ23JGp" crossorigin="anonymous"></script>
193 <script defer src="https://cdn.jsdelivr.net/npm/katex@0.13.11/dist/contrib/auto-render.min.js" integrity="sha384-vZTG03m+2yp6N6BNi5iM4rW4oIwk5DfcNdFfxkk9ZWpDriOkXX8voJBFrAO7MpVl" crossorigin="anonymous"></script>
194 <script>
195 document.addEventListener("DOMContentLoaded", function() {
196 renderMathInElement(document.body, {
197 displayMode: false,
198 // customised options
199 // • auto-render specific keys, e.g.:
200 delimiters: [
201 {left: '$$', right: '$$', display: true},
202 {left: '$', right: '$', display: false},
203 ],
204 // • rendering keys, e.g.:
205 throwOnError : true
206 });
207 });
208
209 ///
210 let theme = localStorage.getItem("theme");
211 if ((theme === "light-theme")||(theme==null)) {
212 theme = "light-theme";
213 document.getElementById("themeSwitcher").checked = false;
214 } else if (theme === "dark-theme") {
215 theme = "dark-theme";
216 document.getElementById("themeSwitcher").checked = true;
217 }
218 document.body.className = theme;
219 localStorage.setItem("theme", theme);
220
221 function switchTheme() {
222 theme = localStorage.getItem("theme");
223 if (theme === "light-theme") {
224 theme = "dark-theme";
225 document.getElementById("themeSwitcher").checked = true;
226 } else {
227 theme = "light-theme";
228 document.getElementById("themeSwitcher").checked = false;
229 }
230 document.body.className = theme;
231 localStorage.setItem("theme", theme);
232
233 console.log(theme);
234 }
235 </script>
236 <script>
237 function tagLinks(tagName) {
238 var tags = document.getElementsByTagName(tagName);
239 for (var i=0, hElem; hElem = tags[i]; i++) {
240 if (hElem.parentNode.className=="row postThumb") {
241 continue;
242 }
243 hElem.id = hElem.innerHTML.toLowerCase().replace(" ", "-");
244 hElem.innerHTML = "<a style='text-decoration:none;color:black;' href='#"+hElem.id+"'>"+hElem.innerHTML+"</a>";
245 }
246 }
247 tagLinks("h2");
248 tagLinks("h3");
249 tagLinks("h4");
250 tagLinks("h5");
251 </script>
252 <script src="https://cdn.jsdelivr.net/npm/mermaid/dist/mermaid.min.js"></script>
253
254
255 </body>
256</html>
257