nDPId icon indicating copy to clipboard operation
nDPId copied to clipboard

Encrypt the json

Open UnveilTech opened this issue 1 year ago • 12 comments

Hi Toni, another suggestion is to encrypt the json sent to the sock/UDP client.

  • architecture: nDPId -> internet -> client (sock/UDP)

  • issue: the json is clear text and could be intercepted by anyone json part contains important data that can not be visible by all

  • solution/proposal: encrypt with openssl (ex: cipher method AES-128-CTR) using a special encryption text encrypted json must be decrypted by the client (sock/UDP) using C, Go, PHP, etc...

  • ndpid.conf: passkey="blablabla..." # take care the value should double quoted because spaces could be allowed #'passkey' or whatever you think it'll be the best way #argument (ex: -P "blablabla...") also in the command line

what do you think ?

bye Fred

UnveilTech avatar Oct 23 '24 09:10 UnveilTech

That is an idea that I already had in my mind. (See: https://github.com/utoni/nDPId/milestone/3) I wanted to encrypt the nDPIsrvd connections to it's distributor clients. But doing this within nDPId UDP send is also something I'll consider as it should be more easy to implement as kinda "first crypto support".

utoni avatar Oct 23 '24 13:10 utoni

excellent ! we'll be happy for testing it as soon as it'll be available...

bye Fred

UnveilTech avatar Oct 23 '24 13:10 UnveilTech

Toni, but think that our proposal is a bit different what you mean with the milestone 1.8 or maybe we're wrong here ;o) the idea is that the nDPId sends encrypted json to another daemon (ex: ncat, socat, personal tool, etc...)

bye Fred

UnveilTech avatar Oct 23 '24 13:10 UnveilTech

The idea is bit similar so far as it's the same JSON messages which are getting encrypted, but by a different application.

I'll probably start with the nDPId UDP encryption as this might be easier to achieve and may also be reused for other applications such as nDPIsrvd.

utoni avatar Oct 24 '24 15:10 utoni

you rock man !!! we would be happy to test it 👍

bye Fred

UnveilTech avatar Oct 24 '24 18:10 UnveilTech

Hi Toni, we've tested the OpenSSL part to encrypt the Json: x.zip

we have tested the process and it works fine... so if you could add that to your source code it'll be cool :o)

bye Fred

UnveilTech avatar Oct 29 '24 13:10 UnveilTech

Hi Fred,

thanks for your proposal. Is there any reason why you've used aes256-cbc and not an AEAD i.e. aes256-gcm ?

utoni avatar Oct 29 '24 15:10 utoni

Toni, that's the source from Mistral (French IA, https://mistral.ai/) that we have modified a bit. we don't care if CBC or GCM, use the mode you think is the best... the only point we take care is that it must be Go langage compatible, we do use Go as our receiver daemon (nDPId -> Go daemon) anyway, CBC or GCM or etc..., I think we should find the way with Go :o)

bye Fred

UnveilTech avatar Oct 29 '24 15:10 UnveilTech

Hi Toni,

happy new year 2025 !!

any update regarding this case ?

bye Fred

UnveilTech avatar Jan 06 '25 16:01 UnveilTech

The PR #54 can be already used for testing. But it does currently only provide a C API as example (examples/c-decrypt). It's not stable and subject to change. I am also investigating currently an issue with OpenSSL.

utoni avatar Jan 07 '25 20:01 utoni

Toni, why not using a basis and simple way as explained here (https://github.com/utoni/nDPId/issues/47#issuecomment-2444171554) ?

bye Fred

UnveilTech avatar Jan 08 '25 13:01 UnveilTech

why not using a basis and simple way as explained here (https://github.com/utoni/nDPId/issues/47#issuecomment-2444171554) ?

It does not protect the payload from being tampered by a third party. That is not the security that I would like to have.

utoni avatar Jan 08 '25 15:01 utoni

Hi Tony, any updates ?

bye Fred

UnveilTech avatar May 28 '25 06:05 UnveilTech

Hey @UnveilTech , thanks for asking. I am still working on this. But at the moment I am almost completely occupied with paid work. :/

utoni avatar May 28 '25 10:05 utoni

ok no problem, have fun. bye Fred

UnveilTech avatar May 28 '25 12:05 UnveilTech

@UnveilTech sorry for beeing late, nDPId now supports standardized TLS channels, nDPId's UDP was replaced by TLS

utoni avatar Sep 03 '25 18:09 utoni

I'll fix the CI pipelines in the upcoming days, #54 can be already tested

utoni avatar Sep 03 '25 18:09 utoni

done; #54

utoni avatar Sep 15 '25 14:09 utoni

Toni, great news ! we'll try to test by tomorrow morning :o)

bye Fred

UnveilTech avatar Sep 15 '25 17:09 UnveilTech

Hi Toni, maybe we missed a step somewhere, we saw options -k, -K and -F are here about our request if we enable CRYPTO, but what about if we set CRYPTO=OFF, will it work as previously with UDP ? we have re-compiled with CRYPTO=OFF but not UDP traffic anymore, what we did wrong ?

regards, Bye Fred

UnveilTech avatar Sep 18 '25 07:09 UnveilTech

Hi Fred,

I removed UDP support in favor of TCP only. The reason behind it was IP fragmentation together with UDP, which is a message based protocol. It resulted quite often in out-of-order JSON messages, which is not good for the JSON stream protocol used, where messages are expected to be in order.

But in theory, w/ ENABLE_CRYPTO=OFF you should still be able to use an unencrypted TCP connection via -c.

utoni avatar Sep 24 '25 07:09 utoni