Score:2

How to create TLS 1.3 Key Derivation test cases

mx flag

I'm trying to create some test cases for a TLS library for the Key Derivation outlined in RFC 8446 7.1.

I tried to get this information from openssl using the following:

# Generate a ECDH private key

# generate the key to pem format
openssl genpkey -algorithm X25519 -out x25519.pem

# Connect using the private key and log the traffic secrets and display handshake messages
openssl s_client -connect google.com:443 -tls1_3 -keylogfile keys.log -key x25519.pem -msg -msgfile messages.log -state -ciphersuites TLS_AES_128_GCM_SHA256 -debug -keymatexport key_material -trace -nocommands -tlsextdebug

I was able to get many of the secrets in the keylogfile, but I can't find the initial ephemeral secret used for ECDHE. I noticed that the public key from the -key I passed in does not match the key share in the handshakes, so I don't think it used my generated private key for ECDHE. I'm having trouble finding info on what that -key parameter is.

Is there a way to get openssl to log the ephemeral private key used for the initial ECDHE? Or is there a better way to generate test cases for TLS 1.3 key derivation?

dave_thompson_085 avatar
cn flag
`-key` is the key _matching the cert for client authentication_ -- if server requests that, which google.com (and most other servers) does not, so here it is unused. This is sort of implicit in the man page statement "If [`-key` is] not specified the certificate file [i.e. `-cert`] will be used to read also the key" although it could be clearer. The last E in ECDHE (or DHE aka FFDHE) means 'ephemeral' which means NOT stored (with keylogfile being a deliberate violation of the security design of SSL/TLS).
JBaczuk avatar
mx flag
Thanks for the info @dave_thompson_085.
Score:2
mx flag

After some more searching, I came across RFC 8448, which was actually referenced in RFC 8446, and which contains test vectors for the key derivation and handshake messages.

Another item of interest, I came across ACVP, which seems helpful, but is a hosted service that requires explicit permission to use.

I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.