What is the size of key material required for generating MAC keys, encryption keys and IV when use TLS_DHE_RSA_WITH_AES_256_CBC_SHA ? How to calculate it?

  • $\begingroup$ I think you need to be more specific. There are master secrets and other intermediate key material involved. If it is just for the message handling then you would simply get to 256 (obviously, for AES) and 160 bits for a HMAC-SHA1 key for message authentication, and double that to handle both incoming and outgoing messages. That would be 832 bit if I'm not mistaken. The IV is not considered "key material" at all and should definitely not be part of it. $\endgroup$ – Maarten Bodewes Sep 5 '19 at 20:45


  • 256-bit AES encryption
  • SHA-1 message authentication
  • Ephemeral Diffie-Hellman key exchange
  • Signed with an RSA certificate

We can find the answer in rfc5246

                        Key      IV   Block
Cipher        Type    Material  Size  Size
------------  ------  --------  ----  -----
NULL          Stream      0       0    N/A
RC4_128       Stream     16       0    N/A
3DES_EDE_CBC  Block      24       8      8
AES_128_CBC   Block      16      16     16
AES_256_CBC   Block      32      16     16

MAC       Algorithm    mac_length  mac_key_length
--------  -----------  ----------  --------------
NULL      N/A              0             0
MD5       HMAC-MD5        16            16
SHA       HMAC-SHA1       20            20
SHA256    HMAC-SHA256     32            32
| improve this answer | |
  • 1
    $\begingroup$ This is brilliant. Thank you! $\endgroup$ – Zubayr Khalid Sep 4 '19 at 19:02
  • 1
    $\begingroup$ Note in TLS1.0 (and SSL3) the first IV (the initial initial vector!) is generated by the PRF, but in 1.1 and 1.2 it is chosen separately and not stored, so it doesn't affect most measures of key material. (And as you say in 1.3 CBC is gone altogether.) $\endgroup$ – dave_thompson_085 Sep 5 '19 at 1:44
  • $\begingroup$ Is this the key material in one direction or in two directions? That seems to be missing in the answer (and it is even in my initial comment!). $\endgroup$ – Maarten Bodewes Sep 9 '19 at 9:32
  • $\begingroup$ @MaartenBodewes Are you talking about the key size for DHE? Well, that key size changed a lot since defined. $\endgroup$ – kelalaka Sep 9 '19 at 9:43
  • $\begingroup$ No, I'm asking if separate symmetric keys are used for sender & receiver... $\endgroup$ – Maarten Bodewes Sep 9 '19 at 9:51

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.