BIP32-Ed25519 Dmitry Khovratovich Jason Law University of - - PowerPoint PPT Presentation

bip32 ed25519
SMART_READER_LITE
LIVE PREVIEW

BIP32-Ed25519 Dmitry Khovratovich Jason Law University of - - PowerPoint PPT Presentation

BIP32-Ed25519 Dmitry Khovratovich Jason Law University of Luxembourg Evernym, Inc. April 30th, 2017 Story of BIP32 Bitcoin wallet: Need of multiple addresses to minimize privacy leakage, every address is used just once; Single secret


slide-1
SLIDE 1

BIP32-Ed25519

Dmitry Khovratovich Jason Law

University of Luxembourg Evernym, Inc.

April 30th, 2017

slide-2
SLIDE 2

Story of BIP32

Bitcoin wallet:

  • Need of multiple addresses to minimize privacy leakage, every

address is used just once;

  • Single secret to derive all private keys;
  • Public key generation can be delegated to third parties

(example: web-shops);

  • Hierarchy or its part can be proven without disclosing the

seed.

slide-3
SLIDE 3

Bitcoin curve linearity

Bitcoin uses the secp256k1 curve:

  • Base point B;
  • Private-public key pair: (k, [k] · B);
  • ECDSA signature needs a fresh randomness for each message;
  • Linearity property: for any a the pair (k + a, [k]B + [a] · B) is

a valid keypair.

slide-4
SLIDE 4

BIP32 standard

Hierarchy of keys:

  • Exploit the linearity of secp256k1 to generate arbitrarily many

keypairs: (kpriv, kpub) = (k + a, [k]B + [a] · B).

  • Generate a′

i ← F(kpub, i, c) to get hierarchy indexed by i and

controlled by the chain code c (can be disclosed if needed);

  • Branches for i ≥ 231 are called hardened as they need the

private key to be produced. Drawbacks:

  • No design rationale;
  • Too heavy primitives (HMAC instead of hash etc.)
slide-5
SLIDE 5

Ed25519/EdDSA

EdDSA:

  • Based on the curve used for the DH handshake;
  • Public design rationale;
  • Security by design;
  • Schnorr signatures: deterministic generation;
  • Better performance;
  • Non-trivial private key derivation from a master secret;
  • Non-linear key space.

The EdDSA standard allows reusing the public keys as encryption keys derived from the DH handshake on Curve25519. This is (to some extent) used in SC4 and X3DH protocols.

slide-6
SLIDE 6

Ed25519 signature generation

  • k

H for public key for signatures

B

kL

A

M H message H public key

R

s signature kL

Byte 0 * * * * * Byte 1 Byte 31 * 1 * * * * *

r x kR

setting bits

slide-7
SLIDE 7

Need in BIP32-Ed25519

Many systems need both hierarchical keys and fast/secure signatures:

  • Tor key blinding (in response to hidden services

deanonymization attacks).

  • Zcash decided to use the Bitcoin curve partly because no

derivation scheme was proposed for Ed25519.

  • Sovrin, the identity ledger, uses Ed25519 signatures and needs

key derivation for users.

slide-8
SLIDE 8

Possible to combine?

BIP32-Ed25519, minimum requirements:

  • Hierarchical key derivation;
  • Signatures verification compatible with existing API of

Ed25519-supporting libraries. Additional requirements:

  • Maximum compatibility with existing BIP32 code;
  • Signature generation compatible with the existing API;
  • Keypairs compatible with Curve25519;
  • No potential vulnerabilities introduced.
slide-9
SLIDE 9

Main problems

  • Master secret undergoes hashing in Ed25519;
  • The private key space is nonlinear;
  • The BIP32 code generates 256-bit scalars for private keys,

whereas we might need more.

  • k

H for public key for signatures

B

kL

A

M H message H public key

R

s signature kL

Byte 0 * * * * * Byte 1 Byte 31 * 1 * * * * *

r x kR

setting bits

slide-10
SLIDE 10

Main problems

  • Master secret undergoes hashing in Ed25519;
  • The private key space is nonlinear;
  • The BIP32 code generates 256-bit scalars for private keys,

whereas we might need more. Mitigations:

  • Work on extended private keys rather than on master secrets;
  • Filtering master secrets to ensure key space linearity;
  • Cloning HMAC calls.
slide-11
SLIDE 11

Our solution

  • k

H for public key for signatures

B

kL

A

M H message H public key

R

s signature child index private child key derivation kL

28 bytes 32bytes

Byte 0 * * * * * Byte 1 Byte 31 1 * * * * *

r x kR

setting bits

ZL ZR

H chain code HMAC

reject if bit is not zero

slide-12
SLIDE 12

Chain v1

Independently of us, the Chain team released their own version of BIP32-Ed25519 in the fall of 2016. Main highlights:

  • No extra bit zeroed/checked in the private key, so easy
  • verflows.
  • As a result, side-channel timing leakage, thus timing attacks
  • n the key generation are possible.
  • The signature procedure incompatible with the EdDSA

procedure (an extra HMAC call in the beginning).

  • Some key parts are exposed to the public for the unknown

reasons.

slide-13
SLIDE 13

Chain v2

After a conversation with us Chain released an updated version in March 2017.

  • k

for public key for signatures

B

kL

A

M H message H public key

R

s child string private child key derivation kL

prune high and low bits 32bytes

Byte 0 * * * * * Byte 1 Byte 31 1 * * * * *

r x kR

setting bits

ZL ZR

HMAC

set bit to zero

HMAC HMAC

slide-14
SLIDE 14

Chain v2

  • k

for public key for signatures

B

kL

A

M H message H public key

R

s signature child string private child key derivation kL

prune high and low bits 32bytes

Byte 0 * * * * * Byte 1 Byte 31 1 * * * * *

r x kR

setting bits

ZL ZR

HMAC

set bit to zero

HMAC HMAC

Crucial points: no more timing leakage, replacing the chain code with a key-derived value. However, more intrusive: an extra HMAC call for the master secret, still incompatibility in the signature process.

slide-15
SLIDE 15

Possible workaround

Both worlds combined:

  • k

for public key for signatures

B A

M H message H public key

R

s signature child string private child key derivation kL

prune high and low bits 32bytes

Byte 0 * * * * * Byte 1 Byte 31 1 * * * * *

r x kR

setting bits

ZL ZR

HMAC

set bit to zero or reject

H H

slide-16
SLIDE 16

Need for feedback

1 Other applications that need hierarchical keys; 2 Should the new private keys be compatible with Ed25519

private keys?

3 Will the new private keys be used for the DH handshake? 4 Should the signature generation process be the same as in

Ed25519?

5 How much can we deviate from BIP32? Drop HMACs?