1
$\begingroup$

Basically, the question above...

I'm trying to implement encryption on the server, and I have another webserver that I can share a secret key with via TLS/SSL/HTTPS, so I do not really need asymmetric encryption.

There are many many different algorithms, but I'm looking for one that has balanced encryption and decryption performance since I'm gonna do both on the server...performance-wise, what are my options?

Thank you.

$\endgroup$
  • 1
    $\begingroup$ What's wrong with using TLS/SSL/HTTPS that you plan to use for key exchange to perform the bulk of the transmission? Also, are you among the rare exceptions to the rule that people asking for encryption additionally need to authenticate the data? Without knowing if the targeted hardware supports AES-NI, a correct answer could need a fork on that. I'm not sure this is on-topic. $\endgroup$ – fgrieu Jun 6 '17 at 6:18
  • $\begingroup$ @fgrieu I guess I'm one of those special little boys :) Yes, this data is coming from a UDP socket, so it needs to be authenticated, I would do that by encrypting the session ID + extra data with a shared key that I send beforehand via https with my webserver, so it is 100% secret and also safe, (atleast from M-I-T-M Interceptions), but authenticating every packet for session IDs is heavy esp when you are receiving thousands (potentially...), so I need something quite fast $\endgroup$ – Whiteclaws Jun 6 '17 at 6:35
  • $\begingroup$ "I'm trying to implement encryption..." Implementing encryption yourself is a bad idea in general - in contrast to using any proper cryptographic library. I would suggest reading this article: If You’re Typing the Letters A-E-S Into Your Code You’re Doing It Wrong - and using your own encryption is a lot worse than the pitfalls mentioned there. $\endgroup$ – tylo Jun 6 '17 at 11:41
  • $\begingroup$ @tylo Never said I was gonna write my own algorithms, I said I was gonna implement an encryption algorithm, and I wanted to see the choices of the ones that fit the bill :) $\endgroup$ – Whiteclaws Jun 6 '17 at 18:18
  • $\begingroup$ @tylo I am most likely gonna use OpenSSL as my encryption library, for the record $\endgroup$ – Whiteclaws Jun 6 '17 at 18:21
2
$\begingroup$

AES-GCM can be used as it provide Authenticated Encryption, no need to separately calculate MAC as the same same algorithm does that in parallel.This is hardware efficient.

For software you can use ChaCha(which is a Salsa variant stream cipher) along with Poly1305 , this combination also provide AEAD.

$\endgroup$
  • 1
    $\begingroup$ If it is certain that AES-NI is available, AES-GCM can be secure, and likely will be the fastest; otherwise , it could be vulnerable to cache-timing attack or other side channel, require significant memory per active key, and be slower than ChaCha-Poly1035. Beware that as is, neither protect you against replay or packet reordering. $\endgroup$ – fgrieu Jun 6 '17 at 10:08

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.