0
$\begingroup$

As far as my understanding of the ECDH goes, after systems are encrypted using ECDH protocol, any data that comes out of the first system will be encrypted and can only be decrypted at the receiving end. Literature says that ECDH is used for the purpose of key exchange(when data is encrypted using symmetric encryption methods like AES) but can I not communicate application data via ECDH (regardless of whether or not I'm further encrypting the data at application layer using something like AES-CTR or DES) ? PS: I'm trying to establish encrypted communication between 2 BLE devices.

$\endgroup$
  • 2
    $\begingroup$ ECDH is a key-agreement protocol. There is no encryption done in ECDH, i.e. the phrase "systems are encrypted using ECDH protocol" does not make any sense. I think you confuse this with RSA key exchange where a key is basically determined by the client and transferred to the server encrypted with its public key. ECDH and DH are completely different. $\endgroup$ – Steffen Ullrich Jul 20 '20 at 7:51
  • $\begingroup$ By systems are encrypted using ECDH I mean that the link is encrypted using ECDH with ECC backend. When I encrypt the peers at the link layer (of BLE) all data that crosses it will be encrpted with the DH Key. I have a running example where I exchange DH Keys between 2 systems and if I sniff the data packets exchanges post DH Key exchange step , the sniffer is unable to read it while the receiving device correctly decrypts it. $\endgroup$ – Manish Kaul Jul 20 '20 at 8:45
  • 2
    $\begingroup$ BLE is a mess of a protocol stack. You need someone who knows BLE to answer this, because generic answers about cryptography, what DH is, what ECDH is, how result of DH is used to generate keys and nonces for AEAD, etc. won't help you find specific answers for BLE. In very general terms, data sent over an encrypted channel is encrypted and protected from tampering using an AEAD (AESGCM, AES-CTR-HMAC-SHA-256, etc). The keys for the AEAD are generated from the shared secret that is the result of a DH operation. $\endgroup$ – Z.T. Jul 20 '20 at 12:09
  • $\begingroup$ DH (and ECDH) is an asymmetric cryptography operation in which two sides generate random key pairs, send each other the public key shares over a clear channel and both compute the same secret shared value while an eavesdropper who has a full transcript of the exchange cannot compute the shared secret value. The shared secret value is then used in simple symmetric cryptography. The data is encrypted and protected by symmetric cryptography, the keys were generated using ECDH. Breaking the DH will let an attacker decrypt the data. $\endgroup$ – Z.T. Jul 20 '20 at 12:16
  • $\begingroup$ Very likely, you need help with a specific API, not with implementing any of this yourself, and thus if this very general help is not enough to figure out the API, you need help with that specific API. A stackoverflow question for that specific API might help. Search for the library and the functions first. $\endgroup$ – Z.T. Jul 20 '20 at 12:16
3
$\begingroup$

As far as my understanding of the ECDH goes, after systems are encrypted using ECDH protocol

Stop right here, you cannot encrypt data using ECDH. ECDH is an algorithm, not a full fledged transport protocol (or protocol for securing data at rest, for that matter).

Literature says that ECDH is used for the purpose of key exchange(when data is encrypted using symmetric encryption methods like AES) but can I not communicate application data via ECDH

That's correct. The only thing that is required for ECDH is the public key, and - in specific situations - a nonce. The public key of the sender / receiver is send to the other party for key agreement. Anything else is outside of the ECDH algorithm, and you cannot use the public key to encrypt data directly.

PS: I'm trying to establish encrypted communication between 2 BLE devices.

Right, so you need to follow the Bluetooth protocols and ask us crypto specific questions about it, or ask StackOverflow when it comes to implementation specific questions. The IT security site can be asked about things like key management and practical security of the protocol.

If you want to encrypt just a specific message you may need to look at (EC)IES which uses ECDH for message based encryption. Beware that the scheme requires a trusted, static public key though (otherwise you obviously don't know who can decrypt, and you're therefore susceptible to MitM attacks).

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.