Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NET - Make research on encryption #88

Closed
wkargul opened this issue Feb 9, 2022 · 5 comments
Closed

NET - Make research on encryption #88

wkargul opened this issue Feb 9, 2022 · 5 comments
Assignees

Comments

@wkargul
Copy link
Contributor

wkargul commented Feb 9, 2022

Why:

  • we want to have secure connections

What:

  • research protocol changees that have to be made
  • make changes being backward compatible
@nieznanysprawiciel nieznanysprawiciel self-assigned this Feb 25, 2022
@nieznanysprawiciel
Copy link
Contributor

nieznanysprawiciel commented Feb 28, 2022

Solution:

  • Protocol messages aren't encrypted, they are only signed (they reveal mainly public information)
  • Forward messages (Payload) are encrypted using symmetric encryption
  • Symmetric key will be generated using private/public key pair
  • Both reliable and unreliable forwarding is encrypted

P2P encryption:

  • Initiating Node sends encryption flag
  • Receiver should follow with the same flag, if he supports encryption
  • If Receiver doesn't send encryption flag, communication won't be encrypted
  • Nodes are using session key generated from public/private key pair (doesn't require explicit key exchange)

Relay forwarding encryption (end-to-end encryption):

  • Node encrypts messages, if target Node has encryption algorithm specified in Node Info returned from server
  • Nodes are using session key generated from public/private key pair (doesn't require explicit key exchange)
    • No need for additional initialization protocol between Nodes
  • Node knows if it should decrypt message, because of encryption flag set in Forward packet
    • which algorithm should it use?? - In the first release: algorithm declared on relay server

Changes:

  • Add encryption flag in Session message
  • We should include encryption algorithm field (Can be added later)
  • Extend Node information with encryption info (supports or not, algorithm)
    • We should use list of possible algorithms in the future
  • Adjust UDP max packets size, since encrypted data will be longer (can be added later)
  • Forward packet should contain flag, when it's encrypted

Compatibility considerations:

  • First few releases introducing encryption should always propose encryption and omit it only if other Node is unable to decrypt
  • After few releases Nodes should require encryption and won't talk with Nodes not using it
  • In the future we need to think, how can we change or negotiate encryption algorithm between newer and older Nodes

@jiivan
Copy link
Contributor

jiivan commented Mar 3, 2022

👍

I would add explicit information whether information forwarded by relay/repeater is end-to-end encrypted. If only one node supports encryption, we could introduce partial encryption only on node <-> relay path.

Also special care should be taken to handle change of size of packet before and after encryption. (Would encrypted data be longer than unencrypted? Will it still fit within packet limits?)

@nieznanysprawiciel
Copy link
Contributor

nieznanysprawiciel commented Mar 3, 2022

I would add explicit information whether information forwarded by relay/repeater is end-to-end encrypted.

Edited

If only one node supports encryption, we could introduce partial encryption only on node <-> relay path.

Supporting both versions isn't a goal. We expect that at some point all Nodes will update yagna and whole communication will be encrypted. This solution is only for transitional period

size of packet before and after encryption

Already included: Adjust UDP max packets size

@maaktweluit maaktweluit linked a pull request Mar 4, 2022 that will close this issue
@maaktweluit maaktweluit removed a link to a pull request Mar 4, 2022
@mfranciszkiewicz
Copy link
Contributor

The possible encryption scheme set is limited to those relying on a derived shared secret. We should either:

  • allow exchanging extra session information (e.g. Diffie-Hellman key exchange)
  • decide on only supporting derived secret-based algorithms

@nieznanysprawiciel
Copy link
Contributor

The possible encryption scheme set is limited to those relying on a derived shared secret. We should either:

* allow exchanging extra session information (e.g. Diffie-Hellman key exchange)

* decide on only supporting derived secret-based algorithms

We will rely only on secret-based algorithm at this point

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants