I have been reading about SHA-2 family and I found a lot of in depth details, but I am confused about how it is related to TLS and AES. TLS encrypts data between server and client, but does it make use of SHA and for what, like what kind of data?

  • $\begingroup$ TLS usually uses some SHA algorithm, e.g. in certificates. However, AES should not be used "for passwords". The difference between different versions of AES is explained in: crypto.stackexchange.com/questions/20/… $\endgroup$
    – otus
    Commented Sep 2, 2014 at 5:38
  • $\begingroup$ Because of the question I linked above, I've removed the second part of your question. If you feel it doesn't answer what you were asking, feel free to revert my edit or ask a new question about that. $\endgroup$
    – otus
    Commented Sep 2, 2014 at 9:16
  • $\begingroup$ Sure. Thank you for the answer, I am getting more clarity about it. I will go at a steady pace so that I don't get confused. If I get more questions, I will post for sure. $\endgroup$ Commented Sep 2, 2014 at 9:18

1 Answer 1


SHA is related to AES in that they are both US government standards. They are not similar algorithmically.

SHA and AES are cryptographic primitives, TLS is a protocol. As the name describes SHA is a family of hash algorithms. AES is a block cipher. TLS uses many encryption algorithms, including AES in various modes, and several hash algorithms, including those in the SHA family. TLS may also use encryption algorithms not based on a block cipher, such as RC4.

TLS uses hash algorithms in order to provide message authenticity when the encryption algorithm does not provide authenticated encryption, via HMAC. SHA may also be used during client-server key exchange to compute the shared master secret, as a component of some PRF, generally also HMAC. TLS encrypts passwords in transit between client and server using the selected encryption algorithm, which could be AES.

SHA is also used in server certificates in order to verify their authenticity so a TLS connection is not created to an imposter. Verification is apparently not implemented well in a wide variety of systems.

I would suggest reading RFC 5246 in order to get a better idea of how TLS operates.

  • $\begingroup$ Thank you for your detailed answer, the following are my questions 1)MAC is used under SSL uses a secure key that is used for sharing this as well as verification for preserving the data integrity in SSL, so HMAC which uses a hashed algorithm and a key is in what way different in TLS? 2)The key used in HMAC is appended into the message, so the same key is shared between the users to preserve the integrity, but where is hashed algorithm used into HMAC. $\endgroup$ Commented Sep 2, 2014 at 10:06
  • $\begingroup$ "The key used in HMAC is appended into the message". That is not quite how HMAC works. HMAC uses a hash algorithm internally, and the key changes the initial value of the hash, twice. This requires the key to be extended to the block size. $\endgroup$ Commented Sep 2, 2014 at 10:53
  • $\begingroup$ Thank you for the answer. I saw a similar diagram based on what you have explained on Wikipedia. I didn't understand it still, can you elaborate on it a bit more, please $\endgroup$ Commented Sep 2, 2014 at 10:55
  • $\begingroup$ "in what way different in TLS?" TLS uses different keys for client and server encryption and MAC, and this is generated from the shared secret. TLS specifies a PRF which makes use of HMAC and a seed to generate arbitrary data lengths, similar to a hash based KDF. Authenticated encryption modes only need 1 key per party. $\endgroup$ Commented Sep 2, 2014 at 11:06
  • $\begingroup$ If the HMAC diagrams do not make sense, you will need to gain a better understanding of how MD type hash functions work. Try reading the pseudocode $\endgroup$ Commented Sep 2, 2014 at 11:11

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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