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

Encryption #11

Merged
merged 3 commits into from
Dec 20, 2021
Merged

Encryption #11

merged 3 commits into from
Dec 20, 2021

Conversation

zbalkan
Copy link
Contributor

@zbalkan zbalkan commented Dec 19, 2021

Solves #1

  • CryptoFormatter is a wrapper around any Formatter. So it can be extended. The formatted is provided as a parameter.

  • CryptoFormatter utilizes Diffie-Hellman Key Exchange Algorithm for key Exchange and SuiteB class of SecurityDriven.Inferno for encryption. Integrity is provided by hashing.

  1. When connected to a server, the client creates a KeyPair and sends the public key to the server.
  2. When a client is connected, the server creates a KeyPair and sends the public key to the client.
  3. Each pair generates a shared key based on their private keys and the other side's public keys.
  4. Until this step, the communication is plain text. When each side generates the shared key and assigns it to the CryptoFormatter's Key property, the connection starts to be encrypted.
  5. For encryption SecurityDriven.Inferno library provides AEAD. I also create an HMACSHA384 hash and concatenate it with the encrypted messages. The receiver validates the message by first splitting the ciphertext and message, calculating the hash of ciphertext, and comparing them. Both confidentiality and integrity are provided.
  6. When the server or client is disconnected, the KeyPair is null'ed. Since each named pipe connection has a separate KeyPair, there is no threat of a lateral movement.

@zbalkan
Copy link
Contributor Author

zbalkan commented Dec 20, 2021

By the way, the sample console app probably needs some refactoring. Pending your review.

@HavenDV
Copy link
Owner

HavenDV commented Dec 20, 2021

Thank you for the 2 PR. I will consider and accept this a little later.

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

Successfully merging this pull request may close these issues.

None yet

2 participants