CurvePrivateKey

From SQRLauth.net
Revision as of 09:27, 23 March 2015 by Adam Comley (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

SQRL mostly uses Ed25519 signing keys, but for certain parts of the Identity Lock Protocol, we need to use the Diffie-Hellman key agreement. This requires specially crafted keys. To create a Curve25519 private key, we must tweak a few bits of the key. A Curve key can be created from an Ed key, but the reverse is not necessarily possible.

function CurvePrivateKey( key )
{
  key[0] &= 248;
  key[31] &= 127;
  key[31] |= 64;
  return key;
}