david wong

Hey! I'm David, a security engineer at the Blockchain team of Facebook, previously a security consultant for the Cryptography Services of NCC Group. I'm also the author of the Real World Cryptography book. This is my blog about cryptography and security and other related topics that I find interesting.

Quick access to articles on this page:

more on the next page...

Hash-Based Signatures Part I: One-Time Signatures (OTS) posted December 2015

Lamport

On October 18th 1979, Leslie Lamport published his concept of One Time Signatures.

Most signature schemes rely in part on one-way functions, typically hash functions, for their security proofs. The beauty of Lamport scheme was that this signature was only relying on the security of these one-way functions.

lamport

here you have a very simple scheme, where \(x\) and \(y\) are both integers, and to sign a single bit:

  • if it's \(0\), publish \(x\)

  • if it's \(1\), publish \(y\)

Pretty simple right? Don't use it to sign twice obviously.

Now what happens if you want to sign multiple bits? What you could do is hash the message you want to sign (so that it has a predictible output length), for example with SHA-256.

Now you need 256 private key pairs:

lamport-full

and if you want to sign \(100110_2 \dots\),

you would publish \((y_0,x_1,x_2,y_3,y_4,x_5,\dots)\)

Winternitz OTS (WOTS)

A few months after Lamport's publication, Robert Winternitz of the Stanford Mathematics Department proposed to publish \(h^w(x)\) instead of publishing \(h(x)\|h(y)\).

wots

For example you could choose \(w=16\) and publish \(h^{16}(x)\) as your public key, and \(x\) would still be your secret key. Now imagine you want to sign the binary \(1001_2\) (\(9_{10}\)), just publish \(h^9(x)\).

Another problem now is that a malicious person could see this signature and hash it to retrieve \(h^{10}(x)\) for example and thus forge a valid signature for \(1010_2\) (\(10_{10}\)).

This can be circumvented by adding a short Checksum after the message (which you would have to sign as well).

Variant of Winternitz OTS

A long long time after, in 2011, Buchmann et al published an update on Winternitz OTS and introduced a new variant using families of functions parameterized by a key. Think of a MAC.

Now your private key is a list of keys that will be use in the MAC, and the message will dictates how many times we iterate the MAC. It's a particular iteration because the previous output is replacing the key, and we always use the same public input. Let's see an example:

wots variant

We have a message \(M = 1011_2 (= 11_{10})\) and let's say our variant of W-OTS works for messages in base 3 (in reality it can work for any base \(w\)). So we'll say \(M = (M_0, M_1, M_2) = (1, 0, 2)\) represents \(102_3\).

To sign this we will publish \((f_{sk_1}(x), sk_2, f^2_{sk_3}(x) = f_{f_{sk_3}(x)}(x))\)

Note that I don't talk about it here, but there is still a checksum applied to our message and that has to be signed. This is why it doesn't matter if the signature of \(M_2 = 2\) is already known in the public key.

Intuition tells me that a public key with another iteration would provide better security

note

here's Andreas Hulsing's answer after pointing me to his talk on the subject:

Why? For the 1 bit example: The checksum would be 0. Hence, to sign that message one needs to know a preimage of a public key element. That has to be exponentially hard in the security parameter for the scheme to be secure. Requiring an attacker to be able to invert the hash function on two values or twice on the same value only adds a factor 2 to the attack complexity. That's not making the scheme significantly more secure. In terms of bit security you might gain 1 bit (At the cost of ~doubling the runtime).

Winternitz OTS+ (WOTS+)

There's not much to say about the W-OTS+ scheme. Two years after the variant, Hulsing alone published an upgrade that shorten the signatures size and increase the security of the previous scheme. It uses a chaining function in addition to the family of keyed functions. This time the key is always the same and it's the input that is fed the previous output. Also a random value (or mask) is XORed before the one-way function is applied.

wots+

Some precisions from Hulsing about shortening the signatures size:

WOTS+ reduces the signature size because you can use a hash function with shorter outputs than in the other WOTS variants at the same level of security or longer hash chains. Put differently, using the same hash function with the same output length and the same Winternitz parameter w for all variants of WOTS, WOTS+ achieves higher security than the other schemes. This is important for example if you want to use a 128 bit hash function (remember that the original WOTS requires the hash function to be collision resistant, but our 2011 proposal as well as WOTS+ only require a PRF / a second-preimage resistant hash function, respectively). In this case the original WOTS only achieves 64 bits of security which is considered insecure. Our 2011 proposal and WOTS+ achieve 128 - f(m,w) bits of security. Now the difference between WOTS-2011 and WOTS+ is that f(m,w) for WOTS-2011 is linear in w and for WOTS+ it is logarithmic in w.

Other OTS

Here ends today's blogpost! There are many more one-time signature schemes, if you are interested here's a list, some of them are even more than one-time signatures because they can be used a few times. So we can call them few-times signatures schemes (FTS):

So far their applications seems to be reduce to be the basis of Hash-based signatures that are the current advised signature scheme for post quantum usage. See PQCrypto initial recommendations that was released a few months ago.

PS: Thanks to Andreas Hulsing for his comments

Part II of this series is here

1 comment

What kind of signature for a post-Quantum world? posted December 2015

What kind of signature should we choose for the future ?

PQCrypto's initial recommendation, published 3 months ago, recommend using hash-based signatures.

pqcrypto hashed based signatures

Hash-based signatures, or Merkle signatures

The Merkle signature scheme is a digital signature scheme based on hash trees (also called Merkle trees) and one-time signatures such as the Lamport signature scheme. It was developed by Ralph Merkle in the late 1970s and is an alternative to traditional digital signatures such as the Digital Signature Algorithm or RSA.

Reading the SPHINCS whitepaper (a hash-based signature), we can understand a bit more why hash-based signatures were considered by PQCrypto to replace our current quantum weak signatures.

– RSA and ECC are perceived today as being small and fast, but they are broken in polynomial time by Shor’s algorithm. The polynomial is so small that scaling up to secure parameters seems impossible.
– Lattice-based signature schemes are reasonably fast and provide reasonably small signatures and keys for proposed parameters. However, their quanti- tative security levels are highly unclear. It is unsurprising for a lattice-based scheme to promise “100-bit” security for a parameter set in 2012 and to correct this promise to only “75-80 bits” in 2013. Fur- thermore, both of these promises are only against pre-quantum attacks, and it seems likely that the same parameters will be breakable in practice by quantum computers.
– Multivariate-quadratic signature schemes have extremely short signatures, are reasonably fast, and in some cases have public keys short enough for typical applications. However, the long-term security of these schemes is even less clear than the security of lattice-based schemes.
– Code-based signature schemes provide short signatures, and in some cases have been studied enough to support quantitative security conjectures. How- ever, the schemes that have attracted the most security analysis have keys of many megabytes, and would need even larger keys to be secure against quantum computers.

A series of post on hash-based signatures is available here

comment on this story

Asiacrypt posted December 2015

Asiacrypt is currently going on in New Zealand (since when NZ is in Asia?)

Program is here (pdf): https://www.math.auckland.ac.nz/~sgal018/AC2015/AC-prog.pdf

it's a two-track event. There are some talks about everything. From Indistinghuishability Obfuscation to Multi Parti Computation. Seems like a good place to be! I'm waiting for videos/slides/reports about the event. Will edit this post accordingly.

comment on this story

Multilinear maps posted December 2015

I'm looking at Indistinghuishability Obfuscation (iO). Which seems to be coming from Fully Homomorphic Encryption (FHE), Functional Encryption (FE) and Multilinear Maps (MM).

Watching Sanjam Garg introduction to this iO, I noticed one interesting slide that puts things into context:

  • 2 parties key exchange in 1976 (DH)
  • 3 parties in 2000 (Joux)
  • X parties in 2013 (GGH)

history

Video here:

EDIT:

Apparently, @Leptan is telling me that all multiparty key exchange using multilinear maps are broken as of today. Cf Cryptanalysis of GGH Map

comment on this story

Mildly interesting stuff I screenshot posted November 2015

Sometimes I read something interesting, and so I take a screenshot of it. And I know some people glance at this blog hoping to read a short piece that will provide some good knowledge. So here you go.

Taken from a Dan Bernstein's blogpost:

ecc

some history on curves

ecc

some constant-time shenanigans

ecc

The following is taken from the wikipedia's page on cryptanalysis

crypta

some more:

crypta

and some more:

crypta

And now some history about how the word Entropy was "coined" by Shannon. Taken from Tobin - Entropy, Information, Landauer’s limit and Moore’s law

entropy

3 comments

Toilet paper and MIT students posted November 2015

It is possible to repeatedly fold a standard letter-sized sheet of paper at the midway point about six to seven times. In 2012, some MIT students were able to fold an 1.2 kilometer long toilet paper 13 times. And every time the paper was folded, the number of layers on top of each other doubled. Therefore, the MIT students ended up with 2^13 = 8192 layers of paper on top of each other. And poor Eve's job was to manually count all layers one by one.

From Solving the Discrete Logarithm of a 113-bit Koblitz Curve with an FPGA Cluster

comment on this story

/r/crypto wiki posted November 2015

There's a subreddit for crypto and it had an empty wiki.

So I filled it.

Below is a copy.

/r/crypto wiki

Please refer to this Wiki before asking questions that might have been asked before (use your common sense).

Cryptography is also usually more interesting than decrypting your random ciphertext, so consider that when posting, read what we are sharing first to see if it's really pertinent.

How to learn about Cryptography?

The first thing you should do, is to sign-up for Dan Boneh's course Crypto I on Coursera.

You do not have to finish it. Watching a few videos will already give you an idea of what is crypto and how easy/hard it is for you. If you can finish the course, and enjoy it at the same time, then you're in for a lot of fun.

Don't try signing-up for Crypto II though.

Alright, that was interesting, MOAR

There are many ways to learn more about crypto. Here's a non-exhaustive list:

But my favorite way: read whitepapers. Look at the ePrint archives and check what papers interest you. Often papers will come with an introduction section that explains the basics.

What about studying cryptography in a real school?

First, it's important to cultivate your new passion. Don't let your course get in the way of reading or building and doing side projects involving crypto.

Second, You need either a bachelor in mathematics or computer science. Depending on which part you find the more interesting in crypto. Usually Math => Theorical Cryptography, CS => Applied Cryptography.

Now either you don't have a master, and you could choose to do a cryptography master. There are a few: Rennes, Bordeaux, Limoges in France.Stanford, etc...

Or you can do a Computer Science or Number Theory oriented master and pick a crypto subject for a phd. Note that a phd will often lead you into theorical research in university, although some phd can be done within a company and might involve applied crypto. But companies around the world might find that relatively relevant (in France a phd will get you to some places).

It's important to know what you want to do, theorical or applied or in the middle? Usually finding an internship in a applied crypto company helps to get out of academia for a while. A good way to see what please you the most. And good news, in cryptography internships are pretty easy to find (at least at the moment).

Alright I'm studying crypto now, how to get more involved?

Cryptography is a big world, many things are happening and it's sometimes hard to follow everything. Especially some mediums give you a high noise-to-quality ratio. So here they are:

  • Check some mailing lists in your field of interest (metzdown, ietf, cfrg, curves, modern crypto, etc...)

  • Follow conventions (listed here on the IACR website). Look out for ECC, Crypto, Asiacrypt, Eurocrypt, Real World Crypto, CHES, etc...

  • Blogs

  • Twitter. Look for cryptographers and check out for interesting discussions and/or links they share.

  • CTFs (and their write-ups)

Where to work in crypto?

Now is your time to find an internship or a job? Apply everywhere, in the world. But where? Where other cryptographers are working, or have worked. You can find that on their published papers (usually written in the header), on Twitter, on Linkedin, etc...

Another good way is to check for "who's hiring" posts on hackernews or reddit

Iacr also list a number of positions here.

Finally, universities around the world usually have room for internships as long as you don't mind not being paid.

2 comments