Debian Codegraph @

pkg/crypto/signaturehash/select_13.go

raw symbols SCIP
1 // SPDX-FileCopyrightText: 2026 The Pion community <https://pion.ly>
2 // SPDX-License-Identifier: MIT
3
4 package signaturehashscip-go gomod github.com/pion/dtls/v3 . `github.com/pion/dtls/v3/pkg/crypto/signaturehash`/
5
6 import (
7 "cryptoscip-go gomod github.com/golang/go/src go1.24.0 crypto/"
8 )
9
10 // selectSignatureScheme13 returns most preferred and compatible scheme.
11 // It's compatible with all DTLS versions up to and including 1.3.
12 func selectSignatureScheme13scip-go gomod github.com/pion/dtls/v3 . `github.com/pion/dtls/v3/pkg/crypto/signaturehash`/selectSignatureScheme13().(sigs []Algorithmscip-go gomod github.com/pion/dtls/v3 . `github.com/pion/dtls/v3/pkg/crypto/signaturehash`/Algorithm#, privateKey cryptoscip-go gomod github.com/golang/go/src go1.24.0 crypto/.PrivateKeyscip-go gomod github.com/golang/go/src go1.24.0 crypto/PrivateKey#, is13 bool) (Algorithmscip-go gomod github.com/pion/dtls/v3 . `github.com/pion/dtls/v3/pkg/crypto/signaturehash`/Algorithm#, error) {
13 signer, ok := privateKey.(cryptoscip-go gomod github.com/golang/go/src go1.24.0 crypto/.Signerscip-go gomod github.com/golang/go/src go1.24.0 crypto/Signer#)
14 if !ok {
15 return Algorithmscip-go gomod github.com/pion/dtls/v3 . `github.com/pion/dtls/v3/pkg/crypto/signaturehash`/Algorithm#{}, errInvalidPrivateKeyscip-go gomod github.com/pion/dtls/v3 . `github.com/pion/dtls/v3/pkg/crypto/signaturehash`/errInvalidPrivateKey.
16 }
17 for _, ss := range sigs {
18 // Skip PSS schemes for DTLS 1.2 (PSS is only supported in DTLS 1.3)
19 if !is13 && ss.Signaturescip-go gomod github.com/pion/dtls/v3 . `github.com/pion/dtls/v3/pkg/crypto/signaturehash`/Algorithm#Signature..IsPSSscip-go gomod github.com/pion/dtls/v3 . `github.com/pion/dtls/v3/pkg/crypto/signature`/Algorithm#IsPSS().() {
20 continue
21 }
22 // Skip schemes understood but not supported by pion/dtls.
23 if ss.Signaturescip-go gomod github.com/pion/dtls/v3 . `github.com/pion/dtls/v3/pkg/crypto/signaturehash`/Algorithm#Signature..IsUnsupportedscip-go gomod github.com/pion/dtls/v3 . `github.com/pion/dtls/v3/pkg/crypto/signature`/Algorithm#IsUnsupported().() {
24 continue
25 }
26 if ss.isCompatiblescip-go gomod github.com/pion/dtls/v3 . `github.com/pion/dtls/v3/pkg/crypto/signaturehash`/Algorithm#isCompatible().(signer) {
27 return ss, nil
28 }
29 }
30
31 return Algorithmscip-go gomod github.com/pion/dtls/v3 . `github.com/pion/dtls/v3/pkg/crypto/signaturehash`/Algorithm#{}, errNoAvailableSignatureSchemesscip-go gomod github.com/pion/dtls/v3 . `github.com/pion/dtls/v3/pkg/crypto/signaturehash`/errNoAvailableSignatureSchemes.
32 }