github.com/pion/dtls/v2@v2.2.12/pkg/protocol/extension/supported_signature_algorithms_test.go (about) 1 // SPDX-FileCopyrightText: 2023 The Pion community <https://pion.ly> 2 // SPDX-License-Identifier: MIT 3 4 package extension 5 6 import ( 7 "reflect" 8 "testing" 9 10 "github.com/pion/dtls/v2/pkg/crypto/hash" 11 "github.com/pion/dtls/v2/pkg/crypto/signature" 12 "github.com/pion/dtls/v2/pkg/crypto/signaturehash" 13 ) 14 15 func TestExtensionSupportedSignatureAlgorithms(t *testing.T) { 16 rawExtensionSupportedSignatureAlgorithms := []byte{ 17 0x00, 0x0d, 18 0x00, 0x08, 19 0x00, 0x06, 20 0x04, 0x03, 21 0x05, 0x03, 22 0x06, 0x03, 23 } 24 parsedExtensionSupportedSignatureAlgorithms := &SupportedSignatureAlgorithms{ 25 SignatureHashAlgorithms: []signaturehash.Algorithm{ 26 {Hash: hash.SHA256, Signature: signature.ECDSA}, 27 {Hash: hash.SHA384, Signature: signature.ECDSA}, 28 {Hash: hash.SHA512, Signature: signature.ECDSA}, 29 }, 30 } 31 32 raw, err := parsedExtensionSupportedSignatureAlgorithms.Marshal() 33 if err != nil { 34 t.Error(err) 35 } else if !reflect.DeepEqual(raw, rawExtensionSupportedSignatureAlgorithms) { 36 t.Errorf("extensionSupportedSignatureAlgorithms marshal: got %#v, want %#v", raw, rawExtensionSupportedSignatureAlgorithms) 37 } 38 }