diff --git a/blogo-input/blogo.json b/blogo-input/blogo.json index 1b4bb97..8df3e50 100755 --- a/blogo-input/blogo.json +++ b/blogo-input/blogo.json @@ -1,21 +1,35 @@ { "title": "ArnauCube - Blog", "relativePath": "/blog", + "absoluteUrl": "https://arnaucube.com/blog", "postsDir": "posts", "indexTemplate": "index.html", "postThumbTemplate": "postThumbTemplate.html", + "metadescr": "arnaucube blog", + "metaimg": "img/logoArnauCube.png", "posts": [ + { + "thumb": "blind-signatures-ec_thumb.md", + "md": "blind-signatures-ec.md", + "metaimg": "img/posts/blind-signatures-ec/flow1.png", + "metadescr": "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." + }, { "thumb": "coffeeminer_thumb.md", - "md": "coffeeminer-hacking-wifi-cryptocurrency-miner.md" + "md": "coffeeminer-hacking-wifi-cryptocurrency-miner.md", + "metaimg": "img/posts/coffeeMiner/coffeeMiner-network-attack.png", + "metadescr": "The goal of this post, is to explain how can be done the attack of MITM (Machine-In-The-Middle) to inject some javascript in the html pages, to force all the machines connected to a WiFi network to be mining a cryptocurrency for the attacker." }, { "thumb": "flock-botnet_thumb.md", - "md": "flock-botnet.md" + "md": "flock-botnet.md", + "metaimg": "img/posts/flock-botnet/markovchain.png", + "metadescr": "Developing a twitter botnet with autonomous bots replying tweets with text generated based on probabilities in Markov chains" }, { "thumb": "blogo_thumb.md", - "md": "blogo.md" + "md": "blogo.md", + "metadescr": "How has this blog been made? In this post we will see how to develop a minimalistic static blog template engine with Go." } ], "copyRaw": [ diff --git a/blogo-input/css/Roboto-Regular.ttf b/blogo-input/css/Roboto-Regular.ttf new file mode 100644 index 0000000..2c97eea Binary files /dev/null and b/blogo-input/css/Roboto-Regular.ttf differ diff --git a/blogo-input/css/style.css b/blogo-input/css/style.css index 1e7e5f9..eabcaeb 100644 --- a/blogo-input/css/style.css +++ b/blogo-input/css/style.css @@ -1,11 +1,26 @@ -.o_gradient_background{ - background-color: #222222; - background-image: url('../img/gradient-background-2560x1600.jpg'); - background-position: center; - background-repeat: no-repeat; - background-attachment: fixed; +@font-face { + font-family: 'Roboto', monospace; + url(Roboto-Regular.ttf) format('truetype'); +} + +body { + font-family: 'Roboto', sans-serif; } a { text-decoration:none!important; } + +blockquote { + background: #f9f9f9; + border-left: 8px solid #ccc; + margin: 1.5em 10px; + padding: 0.5em 10px; +} + + +h1,h2, h3, h4, h5 { + border-bottom: 1px solid #cccccc; + padding-top: 20px; +} + diff --git a/blogo-input/img/gradient-line.jpg b/blogo-input/img/gradient-line.jpg new file mode 100644 index 0000000..2a037b9 Binary files /dev/null and b/blogo-input/img/gradient-line.jpg differ diff --git a/blogo-input/img/posts/blind-signatures-ec/flow0.png b/blogo-input/img/posts/blind-signatures-ec/flow0.png new file mode 100644 index 0000000..da322a5 Binary files /dev/null and b/blogo-input/img/posts/blind-signatures-ec/flow0.png differ diff --git a/blogo-input/img/posts/blind-signatures-ec/flow1.png b/blogo-input/img/posts/blind-signatures-ec/flow1.png new file mode 100644 index 0000000..37ef4ce Binary files /dev/null and b/blogo-input/img/posts/blind-signatures-ec/flow1.png differ diff --git a/blogo-input/index.html b/blogo-input/index.html index d0fa9c6..3c7d5ad 100644 --- a/blogo-input/index.html +++ b/blogo-input/index.html @@ -2,11 +2,24 @@ - + [blogo-title] + + + + + + + + + + + + + + - @@ -22,19 +35,19 @@ - + -
-
+
[blogo-content]
@@ -54,7 +67,7 @@
Blog made with Blogo + target="_blank" style="color: gray;text-decoration:none;">Blogo
@@ -66,20 +79,21 @@ + }); + + diff --git a/blogo-input/posts/blind-signatures-ec.md b/blogo-input/posts/blind-signatures-ec.md new file mode 100644 index 0000000..268bcb7 --- /dev/null +++ b/blogo-input/posts/blind-signatures-ec.md @@ -0,0 +1,107 @@ +# Notes on blind signatures over elliptic curves +*2021-07-30* + +> **Warning**: 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. + +#### Blind signatures + +Few years ago I read about the RSA blind signatures scheme (thanks to [Juan Hernández](https://futur.upc.edu/JuanBautistaHernandezSerrano) who discovered it to me) and I was amazed on such thing being possible. You can read the step by step of the *RSA blind signatures* scheme in [this Wikipedia article](https://en.wikipedia.org/wiki/Blind_signature#Blind_RSA_signatures). +The 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. + + +
+ + Diagram showing the described steps. +
+
+ + +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. + +As most of the current ongoing protocols are using *elliptic curve* cryptography instead of *RSA*, the mentioned *RSA blind signatures* scheme is not much plugable in the existing systems that use *elliptic curve* keys. That's why I got interested into reading and learning about schemes that provide blind signatures over *elliptic curve*. + +#### The scheme + +In this notes, we will cover the scheme proposed at *"[New Blind Signature Schemes Based on the (Elliptic Curve) Discrete Logarithm Problem](https://sci-hub.do/10.1109/ICCKE.2013.6682844)"* paper by Hamid Mala & Nafiseh Nezhadansari (thanks to [Daira Hopwood](https://twitter.com/feministPLT) who mentioned this paper in a Telegram group). + +First of all, the *signer* 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 *private key*. From $d$ they can compute the *public key* by $Q = dG$, where $G$ is the generator point of $\mathbb{G}$ (the elliptic curve group). + +Appart from their key pair, the *signer* will generate for each request of signature another random value $k \in \mathbb{Z}_n$, and its respective $R'=kG$. + +The *user* has a message *m* that which they want to get signed by the *signer* (without the *signer* knowing the content of *m*). 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 *blinding factor* $R=aR' + bG = (ak + b)G$, and as $R$ is a point we can get $R = (x, y)$. +The user can *blind* the message by computing $m' = a^{-1} \cdot x \cdot h(m)$, where $h(m)$ is the hash of the message. + +Then, the *user* sends the *blinded message* ($m'$) to the *signer*, who will perform the *blind signature* by computing $s' = d m' + k$, which is sent back to the *user*. + +The *user* can unblind the signature by $s = a s' + b$, and the complete signature will be $(R, s)$. + +And now, we are in a point where the signature can be verified by a third party for the *signer*'s public key by checking $sG == R + x h(m) Q$. + + +
+ + The previous diagram but with the operations from each step. +
+
+ + +From the verification $sG == R + x h(m) Q$, we can unroll it and check that: + +$$ +\fbox{sG} = (a s' + b) G = (a (d m' + k) + b) G\newline += (a d m' + ak + b) G = ((a d (a^{-1} x h(m))) + ak + b) G\newline += (d x h(m) + ak + b) G\newline += dG x h(m) + (ak + b)G = \fbox{R + x h(m) Q} +$$ + +#### Code +Here is an example of how this scheme on the [secp256k1](https://en.bitcoin.it/wiki/Secp256k1) curve could be used using the implementation from [go-blindsecp256k1](https://github.com/arnaucube/go-blindsecp256k1). + +```go +import ( + [...] + "github.com/arnaucube/go-blindsecp256k1" +) + +func main() { + // signer: create new signer key pair + sk := blindsecp256k1.NewPrivateKey() + signerPubK := sk.Public() + + // signer: when user requests new R parameter to blind a new msg, + // create new signerR (public) with its secret k + k, signerR := blindsecp256k1.NewRequestParameters() + + // user: blinds the msg using signer's R + msg := new(big.Int).SetBytes([]byte("test")) + msgBlinded, userSecretData, err := blindsecp256k1.Blind(msg, signerR) + if err != nil { + panic(err) + } + + // signer: signs the blinded message using its private key & secret k + sBlind, err := sk.BlindSign(msgBlinded, k) + if err != nil { + panic(err) + } + + // user: unblinds the blinded signature + sig := blindsecp256k1.Unblind(sBlind, userSecretData) + + // signature can be verified with signer PublicKey + verified := blindsecp256k1.Verify(msg, sig, signerPubK) + if !verified { + fmt.Println("verification failed") + } else { + fmt.Println("blind signature verified") + } +} +``` + +#### Conclusions + +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 [trusted setups](https://medium.com/qed-it/diving-into-the-snarks-setup-phase-b7660242a0d7). Although, for most of the cases zkSNARKs have more flexibility, and we could cover similar use cases by proving that the user knows some *private key* for which the corresponding *public key* is placed in a leaf of a *Merkle Tree* for a certain *Merkle Root* (but this would be out of scope for the current notes). + +An implementation of this scheme in Go can be found in: https://github.com/arnaucube/go-blindsecp256k1 (and a compatible Typescript implementation [blindsecp256k1-js](https://github.com/arnaucube/blindsecp256k1-js)). 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. + +*Special thanks to [@dhole](https://github.com/dhole) for reviewing this text.* diff --git a/blogo-input/posts/blind-signatures-ec_thumb.md b/blogo-input/posts/blind-signatures-ec_thumb.md new file mode 100644 index 0000000..bd50f9a --- /dev/null +++ b/blogo-input/posts/blind-signatures-ec_thumb.md @@ -0,0 +1,4 @@ +## Notes on blind signatures over elliptic curves +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. + +*2021-07-30* diff --git a/public/blind-signatures-ec.html b/public/blind-signatures-ec.html new file mode 100644 index 0000000..9c8c935 --- /dev/null +++ b/public/blind-signatures-ec.html @@ -0,0 +1,207 @@ + + + + + + + Notes on blind signatures over elliptic curves - ArnauCube - Blog + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+

Notes on blind signatures over elliptic curves

+ +

2021-07-30

+ +
+

Warning: 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.

+
+ +

Blind signatures

+ +

Few years ago I read about the RSA blind signatures scheme (thanks to Juan Hernández who discovered it to me) and I was amazed on such thing being possible. You can read the step by step of the RSA blind signatures scheme in this Wikipedia article. +The 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.

+ +

+ + Diagram showing the described steps. +
+

+ +

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.

+ +

As most of the current ongoing protocols are using elliptic curve cryptography instead of RSA, the mentioned RSA blind signatures scheme is not much plugable in the existing systems that use elliptic curve keys. That’s why I got interested into reading and learning about schemes that provide blind signatures over elliptic curve.

+ +

The scheme

+ +

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 (thanks to Daira Hopwood who mentioned this paper in a Telegram group).

+ +

First of all, the signer 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 private key. From $d$ they can compute the public key by $Q = dG$, where $G$ is the generator point of $\mathbb{G}$ (the elliptic curve group).

+ +

Appart from their key pair, the signer will generate for each request of signature another random value $k \in \mathbb{Z}_n$, and its respective $R’=kG$.

+ +

The user has a message m that which they want to get signed by the signer (without the signer knowing the content of m). 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 blinding factor $R=aR’ + bG = (ak + b)G$, and as $R$ is a point we can get $R = (x, y)$. +The user can blind the message by computing $m’ = a^{-1} \cdot x \cdot h(m)$, where $h(m)$ is the hash of the message.

+ +

Then, the user sends the blinded message ($m’$) to the signer, who will perform the blind signature by computing $s’ = d m’ + k$, which is sent back to the user.

+ +

The user can unblind the signature by $s = a s’ + b$, and the complete signature will be $(R, s)$.

+ +

And now, we are in a point where the signature can be verified by a third party for the signer’s public key by checking $sG == R + x h(m) Q$.

+ +

+ + The previous diagram but with the operations from each step. +
+

+ +

From the verification $sG == R + x h(m) Q$, we can unroll it and check that:

+ +

$$ +\fbox{sG} = (a s’ + b) G = (a (d m’ + k) + b) G\newline += (a d m’ + ak + b) G = ((a d (a^{-1} x h(m))) + ak + b) G\newline += (d x h(m) + ak + b) G\newline += dG x h(m) + (ak + b)G = \fbox{R + x h(m) Q} +$$

+ +

Code

+ +

Here is an example of how this scheme on the secp256k1 curve could be used using the implementation from go-blindsecp256k1.

+ +
import (
+	[...]
+	"github.com/arnaucube/go-blindsecp256k1"
+)
+
+func main() {
+    // signer: create new signer key pair
+    sk := blindsecp256k1.NewPrivateKey()
+    signerPubK := sk.Public()
+
+    // signer: when user requests new R parameter to blind a new msg,
+    // create new signerR (public) with its secret k
+    k, signerR := blindsecp256k1.NewRequestParameters()
+
+    // user: blinds the msg using signer's R
+    msg := new(big.Int).SetBytes([]byte("test"))
+    msgBlinded, userSecretData, err := blindsecp256k1.Blind(msg, signerR)
+    if err != nil {
+	panic(err)
+    }
+
+    // signer: signs the blinded message using its private key & secret k
+    sBlind, err := sk.BlindSign(msgBlinded, k)
+    if err != nil {
+	panic(err)
+    }
+
+    // user: unblinds the blinded signature
+    sig := blindsecp256k1.Unblind(sBlind, userSecretData)
+
+    // signature can be verified with signer PublicKey
+    verified := blindsecp256k1.Verify(msg, sig, signerPubK)
+    if !verified {
+	fmt.Println("verification failed")
+    } else {
+	fmt.Println("blind signature verified")
+    }
+}
+
+ +

Conclusions

+ +

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 trusted setups. Although, for most of the cases zkSNARKs have more flexibility, and we could cover similar use cases by proving that the user knows some private key for which the corresponding public key is placed in a leaf of a Merkle Tree for a certain Merkle Root (but this would be out of scope for the current notes).

+ +

An implementation of this scheme in Go can be found in: https://github.com/arnaucube/go-blindsecp256k1 (and a compatible Typescript implementation blindsecp256k1-js). 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.

+ +

Special thanks to @dhole for reviewing this text.

+ +
+ + + + + + + + + + + + + + + diff --git a/public/blogo.html b/public/blogo.html index 83620eb..4cd7c9c 100644 --- a/public/blogo.html +++ b/public/blogo.html @@ -2,11 +2,24 @@ - + Static blog template engine implementation in Go - ArnauCube - Blog + + + + + + + + + + + + + + - @@ -22,19 +35,19 @@ - + -
-
+

Static blog template engine implementation in Go

2017-12-26

@@ -407,7 +420,7 @@ func putHTMLToTemplate(template string, m map[string]string) string {
Blog made with Blogo + target="_blank" style="color: gray;text-decoration:none;">Blogo
@@ -419,20 +432,21 @@ func putHTMLToTemplate(template string, m map[string]string) string { + }); + + diff --git a/public/coffeeminer-hacking-wifi-cryptocurrency-miner.html b/public/coffeeminer-hacking-wifi-cryptocurrency-miner.html index 9b513ca..b73b167 100644 --- a/public/coffeeminer-hacking-wifi-cryptocurrency-miner.html +++ b/public/coffeeminer-hacking-wifi-cryptocurrency-miner.html @@ -2,11 +2,24 @@ - + CoffeeMiner: Hacking WiFi to inject cryptocurrency miner to HTML requests - ArnauCube - Blog + + + + + + + + + + + + + + - @@ -22,19 +35,19 @@ - + -
-
+

CoffeeMiner: Hacking WiFi to inject cryptocurrency miner to HTML requests

2018-01-04

@@ -546,7 +559,7 @@ def start():
Blog made with Blogo + target="_blank" style="color: gray;text-decoration:none;">Blogo
@@ -558,20 +571,21 @@ def start(): + }); + + diff --git a/public/css/Roboto-Regular.ttf b/public/css/Roboto-Regular.ttf new file mode 100644 index 0000000..2c97eea Binary files /dev/null and b/public/css/Roboto-Regular.ttf differ diff --git a/public/css/style.css b/public/css/style.css index 1e7e5f9..eabcaeb 100644 --- a/public/css/style.css +++ b/public/css/style.css @@ -1,11 +1,26 @@ -.o_gradient_background{ - background-color: #222222; - background-image: url('../img/gradient-background-2560x1600.jpg'); - background-position: center; - background-repeat: no-repeat; - background-attachment: fixed; +@font-face { + font-family: 'Roboto', monospace; + url(Roboto-Regular.ttf) format('truetype'); +} + +body { + font-family: 'Roboto', sans-serif; } a { text-decoration:none!important; } + +blockquote { + background: #f9f9f9; + border-left: 8px solid #ccc; + margin: 1.5em 10px; + padding: 0.5em 10px; +} + + +h1,h2, h3, h4, h5 { + border-bottom: 1px solid #cccccc; + padding-top: 20px; +} + diff --git a/public/flock-botnet.html b/public/flock-botnet.html index 122011f..aceecb2 100644 --- a/public/flock-botnet.html +++ b/public/flock-botnet.html @@ -2,11 +2,24 @@ - + Auto generated tweets from Markov chains - ArnauCube - Blog + + + + + + + + + + + + + + - @@ -22,19 +35,19 @@ - + -
-
+

Auto generated tweets from Markov chains

2017-12-29

@@ -332,7 +345,7 @@
Blog made with Blogo + target="_blank" style="color: gray;text-decoration:none;">Blogo
@@ -344,20 +357,21 @@ + }); + + diff --git a/public/img/gradient-line.jpg b/public/img/gradient-line.jpg new file mode 100644 index 0000000..2a037b9 Binary files /dev/null and b/public/img/gradient-line.jpg differ diff --git a/public/img/posts/blind-signatures-ec/flow0.png b/public/img/posts/blind-signatures-ec/flow0.png new file mode 100644 index 0000000..da322a5 Binary files /dev/null and b/public/img/posts/blind-signatures-ec/flow0.png differ diff --git a/public/img/posts/blind-signatures-ec/flow1.png b/public/img/posts/blind-signatures-ec/flow1.png new file mode 100644 index 0000000..37ef4ce Binary files /dev/null and b/public/img/posts/blind-signatures-ec/flow1.png differ diff --git a/public/index.html b/public/index.html index 206f256..7687935 100644 --- a/public/index.html +++ b/public/index.html @@ -2,11 +2,24 @@ - + ArnauCube - Blog + + + + + + + + + + + + + + - @@ -22,20 +35,30 @@ - + -
-
-
+ @@ -96,20 +119,21 @@ + }); + +