github.com/pion/dtls/v2@v2.2.12/cipher_suite_go114.go (about)

     1  // SPDX-FileCopyrightText: 2023 The Pion community <https://pion.ly>
     2  // SPDX-License-Identifier: MIT
     3  
     4  //go:build go1.14
     5  // +build go1.14
     6  
     7  package dtls
     8  
     9  import (
    10  	"crypto/tls"
    11  )
    12  
    13  // VersionDTLS12 is the DTLS version in the same style as
    14  // VersionTLSXX from crypto/tls
    15  const VersionDTLS12 = 0xfefd
    16  
    17  // Convert from our cipherSuite interface to a tls.CipherSuite struct
    18  func toTLSCipherSuite(c CipherSuite) *tls.CipherSuite {
    19  	return &tls.CipherSuite{
    20  		ID:                uint16(c.ID()),
    21  		Name:              c.String(),
    22  		SupportedVersions: []uint16{VersionDTLS12},
    23  		Insecure:          false,
    24  	}
    25  }
    26  
    27  // CipherSuites returns a list of cipher suites currently implemented by this
    28  // package, excluding those with security issues, which are returned by
    29  // InsecureCipherSuites.
    30  func CipherSuites() []*tls.CipherSuite {
    31  	suites := allCipherSuites()
    32  	res := make([]*tls.CipherSuite, len(suites))
    33  	for i, c := range suites {
    34  		res[i] = toTLSCipherSuite(c)
    35  	}
    36  	return res
    37  }
    38  
    39  // InsecureCipherSuites returns a list of cipher suites currently implemented by
    40  // this package and which have security issues.
    41  func InsecureCipherSuites() []*tls.CipherSuite {
    42  	var res []*tls.CipherSuite
    43  	return res
    44  }