0

Because of the assumption of joint security, I want to use the same keypair for signing (ed22519) and encryption key exchange (x25519)

How can I share the same public key for my nacl.box.keyPair and nacl.sign.keyPair ?

As I understand it should be possible because both are on the same curve.

nacl seems to transform his ed22519 private key using this function:

  crypto_hash(d, sk, 32);
  d[0] &= 248;
  d[31] &= 127;
  d[31] |= 64;

A failed attempt

const nacl = require('tweetnacl')

seed = nacl.randomBytes(32)

box_keypair = nacl.box.keyPair.fromSecretKey(seed)

k = new Uint8Array(Buffer.concat([box_keypair.publicKey, box_keypair.secretKey])) sign_keypair = nacl.sign.keyPair.fromSecretKey(k)

msg = nacl.randomBytes(32) signed_msg = nacl.sign(msg, sign_keypair.secretKey) verif = nacl.sign.open(signed_msg, sign_keypair.publicKey) console.log(msg, signed_msg, verif) // null ```

t0staky
  • 1
  • 1

0 Answers0