Source File
message_certificate_verify.go
Belonging Package
github.com/pion/dtls/v2/pkg/protocol/handshake
// SPDX-FileCopyrightText: 2023 The Pion community <https://pion.ly>// SPDX-License-Identifier: MITpackage handshakeimport ()// MessageCertificateVerify provide explicit verification of a// client certificate.//// https://tools.ietf.org/html/rfc5246#section-7.4.8type MessageCertificateVerify struct {HashAlgorithm hash.AlgorithmSignatureAlgorithm signature.AlgorithmSignature []byte}const handshakeMessageCertificateVerifyMinLength = 4// Type returns the Handshake Typefunc ( MessageCertificateVerify) () Type {return TypeCertificateVerify}// Marshal encodes the Handshakefunc ( *MessageCertificateVerify) () ([]byte, error) {:= make([]byte, 1+1+2+len(.Signature))[0] = byte(.HashAlgorithm)[1] = byte(.SignatureAlgorithm)binary.BigEndian.PutUint16([2:], uint16(len(.Signature)))copy([4:], .Signature)return , nil}// Unmarshal populates the message from encoded datafunc ( *MessageCertificateVerify) ( []byte) error {if len() < handshakeMessageCertificateVerifyMinLength {return errBufferTooSmall}.HashAlgorithm = hash.Algorithm([0])if , := hash.Algorithms()[.HashAlgorithm]; ! {return errInvalidHashAlgorithm}.SignatureAlgorithm = signature.Algorithm([1])if , := signature.Algorithms()[.SignatureAlgorithm]; ! {return errInvalidSignatureAlgorithm}:= int(binary.BigEndian.Uint16([2:]))if ( + 4) != len() {return errBufferTooSmall}.Signature = append([]byte{}, [4:]...)return 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. |