I'm currently trying to implement DTLS 1.0 and I'm stuck at the finished message of the handshake. It seems that my calculation of the verify_data is wrong.

RFC 4347 says in 4.2.6.

Finished messages have the same format as in TLS.  However, in order
to remove sensitivity to fragmentation, the Finished MAC MUST be
computed as if each handshake message had been sent as a single

Does that mean that the reassembled handshake messages are hashed as if they where TLS handshake messages? I.e. with header but without the message_seq, fragment_offset and fragment_length fields? Or are they hashed without the handshake header at all? Or is each handshake message containing a fragment concatenated?

PS: I can't tag it DTLS because I don't have enough reputation :/

  • If you don't get a satisfactory answer here, you can check with Stackoverflow instead. They will have much better programming related answers than this SE.
    – Limit
    Commented Nov 13, 2016 at 17:32

1 Answer 1


I read as if ... a single fragment to mean you format each message as one fragment that contains the whole message, that is, fragoff=0 fraglen=totlen. The BouncyCastle Java implementation (as of 1.55) agrees with this, and I think someone would have noticed if it didn't interoperate:

package org.bouncycastle.crypto.tls;
class DTLSReliableHandshake {
private Message updateHandshakeMessagesDigest(Message message)
    throws IOException
    if (message.getType() != HandshakeType.hello_request)
        byte[] body = message.getBody();
        byte[] buf = new byte[12];
        TlsUtils.writeUint8(message.getType(), buf, 0);
        TlsUtils.writeUint24(body.length, buf, 1);
        TlsUtils.writeUint16(message.getSeq(), buf, 4);
        TlsUtils.writeUint24(0, buf, 6);
        TlsUtils.writeUint24(body.length, buf, 9);
        handshakeHash.update(buf, 0, buf.length);
        handshakeHash.update(body, 0, body.length);
    return message;
  • You're right and I would have noticed sooner if I had not had a serialization error in my code.
    – maufl
    Commented Nov 18, 2016 at 19:01

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .