DTLS is probably the best solution, however it looks very poorly documented. I searched for a similar solution for a while, and all the links that I saw on the OpenSSL DTLS implementation show that you will need to dig through OpenSSL examples and source code to figure out how to use it ... which, for me, means that i am going to make 10 serious security errors when i try to configure it. Also, I don't think pyOpenSSL libary exports this functionality.
An alternative that I considered is Secure Remote Password Protocol . The advantage of this solution is that it gives you strong mutual authentication (along with Kerberos security as documented) and, which is also important in your case, provides both ends with a shared session key that can be used for encryption,
Given a shared key, each packet may contain AES256_CBC( <random starter block for CBC><user-id><sequence_number><application data> ) . If decryption succeeds in providing the expected user ID, the packet is authenticated as outgoing from your user, and the sequence number can be used to prevent repeated attacks.
One drawback of SRP is that in Python, the number of crunches is rather slow. I changed the Python demo code to something more convenient and found that it took about 300 ms to complete a single SRP client server (2 GHz processor). However, a straightforward C ++ implementation of the SRP algorithm using BigNumber support in OpenSSL took only 2 ms. Therefore, if you intend to take this route, I highly recommend using an implementation of the algorithm to create code in C / C ++. Otherwise, you will probably be able to process multiple logins per second.
Rakis
source share