2
$\begingroup$

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?

$\endgroup$
2
  • 1
    $\begingroup$ -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). $\endgroup$ Commented Apr 7, 2023 at 1:47
  • $\begingroup$ Thanks for the info @dave_thompson_085. $\endgroup$
    – JBaczuk
    Commented Apr 10, 2023 at 15:05

1 Answer 1

2
$\begingroup$

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.

$\endgroup$

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.