Javascript AES Encryption vs SSL
I found this open source Javascript AES implementation http://www.movable-type.co.uk/scripts/aes.html Is there a reason to use SSL if you can have AES with javascript? What besides the secure i开发者_如何学JAVAcon would be the advantage of paying for SSL with 256 bit encryption over using something like this?
SSL/TLS is so much more than just encryption. In fact, SSL doesn't even have to be encrypted at all (the ...WITH_NULL cipher suites). But here are some of the features besides encryption:
- server authentication
- client authentication
- resumable sessions
- negotiable cipher suites
- protection against man-in-the-middle attacks
- perfect forward secrecy (if you use Diffie-Hellman or Elliptic Curve Diffie-Hellman key exchange)
- ...
SSL/TLS on a high-level view can be thought of as a mixture of asymmetric cryptography (to establish a session key) and symmetric cryptography (the "encryption" part that uses the formerly established session key). The big advantage over let's say just using AES is that you don't need to establish the keys initially. In your case, how would you make sure that client and server are using the same key? How would you establish it? How would you secure it?
TLS takes care of all this for you. See also this post for more thoughts on a similar topic.
SSL does not only provide encryption; it also prevents a man-in-the-middle attack. That's what the certificate is for. Also, when you want to do encryption via JavaScript, an eavesdropper could listen in on the conversation and change the encryption algorithm while it is in transit. SSL provides encryption before the web page is sent.
The main difference is the fact, that SSL confirms the trust of your website for the user. What means he can definitely trust SSL, Javascript isn't as trustable.
精彩评论