Private key a random integer d∈[1,n−1] with n the order of the sub-group.
Public keyP=kG, where G is base point, or generator of the group
Encryption with Elliptic Curve Diffie-Hellman (ECDH)
DH is a method for two parties to securely exchange keys.
Alice
Bob
Create key pair Pa=ka.G
Create key pair Pb=kb.G
Sends Bob Pa
Sends Alice Pb
Calc Ps=ka.Hb=ka.kb.G
Calc Ps=kb.Ha=ka.kb.G
Ps is a shared secret than an eavesdropper has no practical hope of figuring out.
Signing and verifying messages
Alice wants to sign a message, m, that Bob (or anyone else) can verify with her public key, Pa.
EdDSA algorithm
Signing
Alice has her public and private keys Pa=kaG
Calculate a temporary key from random nonce j: R=rG
Calc e=Hash(R∣∣m)
Calc s=r+eka
Send m, R and s to Bob
EdDSA Verification
Bob has s, R, m, and Pa.
He doesn't know ka or r.
s.G=(r+eka)G=rG+ekaG=R+ePa
So Bob calculates s.G and e, and compares it to R+ePa.
If they match, he knows that Alice signed the message.
Note: Disclaimer. This is a rough guide for engineers wanting to get their hands wet with the nuts and bolts
of the cryptographic math behind blockchain security. Therefore I may be loosy goosy with some terminology
and most of the concepts oversimplified, so excuse that. However, if there are any _egregious_ errors in this
presentation, please [open an issue](https://github.com/tari-labs/tari-university/issues) on github.
Note: You can forget about all this technical detail. It's just included here for completeness.
note: Now that the abstract algebra stuff is largely out of the way, we can do some cryptography!
note: This should make sense now based on all the preliminary discussion. _k_ is kept secret, _kG_ is relatively
easy to calculate, giving you a public key, but finding _k_ from _kG_ involves solving the discrete logarithm problem.
note:
- When creating their keys, Alice and Bob use the same curve parameters: same curve, _G_ etc.
- When they exchange public keys, it can be over an insecure channel
note: This is a simplified algorithm. There are a few details ommitted,
like always using modular arithmetic at limits on the choice of nonce.