Source File
use_master_secret.go
Belonging Package
github.com/pion/dtls/v3/pkg/protocol/extension
// SPDX-FileCopyrightText: 2023 The Pion community <https://pion.ly>// SPDX-License-Identifier: MITpackage extensionimportconst (useExtendedMasterSecretHeaderSize = 4)// UseExtendedMasterSecret defines a TLS extension that contextually binds the// master secret to a log of the full handshake that computes it, thus// preventing MITM attacks.type UseExtendedMasterSecret struct {Supported bool}// TypeValue returns the extension TypeValue.func ( UseExtendedMasterSecret) () TypeValue {return UseExtendedMasterSecretTypeValue}// Marshal encodes the extension.func ( *UseExtendedMasterSecret) () ([]byte, error) {if !.Supported {return []byte{}, nil}:= make([]byte, useExtendedMasterSecretHeaderSize)binary.BigEndian.PutUint16(, uint16(.TypeValue()))binary.BigEndian.PutUint16([2:], uint16(0)) // lengthreturn , nil}// Unmarshal populates the extension from encoded data.func ( *UseExtendedMasterSecret) ( []byte) error {if len() < useExtendedMasterSecretHeaderSize {return errBufferTooSmall} else if TypeValue(binary.BigEndian.Uint16()) != .TypeValue() {return errInvalidExtensionType}.Supported = truereturn nil}
![]() |
The pages are generated with Golds v0.8.2. (GOOS=linux GOARCH=amd64) Golds is a Go 101 project developed by Tapir Liu. PR and bug reports are welcome and can be submitted to the issue list. Please follow @zigo_101 (reachable from the left QR code) to get the latest news of Golds. |