@@ -341,6 +341,32 @@ func ensureMasterSecret(state *dtlsstate.State13) ([]byte, error) {
341341 return masterSecret , nil
342342}
343343
344+ // ClientHandshakeFinishedBaseKey returns the client handshake traffic secret,
345+ // which is the TLS 1.3 Finished base key for the client's Finished message.
346+ func ClientHandshakeFinishedBaseKey (state * dtlsstate.State13 ) ([]byte , error ) {
347+ if state == nil {
348+ return nil , dtlserrors .ErrCipherSuiteNotSet
349+ }
350+ if len (state .KeySchedule .HandshakeTraffic .Client ) == 0 {
351+ return nil , dtlserrors .ErrLengthMismatch
352+ }
353+
354+ return state .KeySchedule .HandshakeTraffic .Client , nil
355+ }
356+
357+ // ServerHandshakeFinishedBaseKey returns the server handshake traffic secret,
358+ // which is the TLS 1.3 Finished base key for the server's Finished message.
359+ func ServerHandshakeFinishedBaseKey (state * dtlsstate.State13 ) ([]byte , error ) {
360+ if state == nil {
361+ return nil , dtlserrors .ErrCipherSuiteNotSet
362+ }
363+ if len (state .KeySchedule .HandshakeTraffic .Server ) == 0 {
364+ return nil , dtlserrors .ErrLengthMismatch
365+ }
366+
367+ return state .KeySchedule .HandshakeTraffic .Server , nil
368+ }
369+
344370// CertificateVerifyInputFromTranscript returns the TLS 1.3 CertificateVerify
345371// input for the current transcript snapshot.
346372func CertificateVerifyInputFromTranscript (
@@ -462,8 +488,7 @@ func verifyFinishedData(hashFunc func() hash.Hash, baseKey, transcriptHash, veri
462488}
463489
464490// VerifyFinishedDataFromTranscript verifies TLS 1.3 Finished verify_data
465- // against the current transcript snapshot. It does not commit the Finished
466- // message to the transcript.
491+ // against the current transcript snapshot.
467492func VerifyFinishedDataFromTranscript (
468493 hashFunc func () hash.Hash ,
469494 baseKey []byte ,
0 commit comments