github.com/pion/dtls/v2@v2.2.12/pkg/protocol/handshake/message_finished.go (about)

     1  // SPDX-FileCopyrightText: 2023 The Pion community <https://pion.ly>
     2  // SPDX-License-Identifier: MIT
     3  
     4  package handshake
     5  
     6  // MessageFinished is a DTLS Handshake Message
     7  // this message is the first one protected with the just
     8  // negotiated algorithms, keys, and secrets.  Recipients of Finished
     9  // messages MUST verify that the contents are correct.
    10  //
    11  // https://tools.ietf.org/html/rfc5246#section-7.4.9
    12  type MessageFinished struct {
    13  	VerifyData []byte
    14  }
    15  
    16  // Type returns the Handshake Type
    17  func (m MessageFinished) Type() Type {
    18  	return TypeFinished
    19  }
    20  
    21  // Marshal encodes the Handshake
    22  func (m *MessageFinished) Marshal() ([]byte, error) {
    23  	return append([]byte{}, m.VerifyData...), nil
    24  }
    25  
    26  // Unmarshal populates the message from encoded data
    27  func (m *MessageFinished) Unmarshal(data []byte) error {
    28  	m.VerifyData = append([]byte{}, data...)
    29  	return nil
    30  }