cipher_suite_go114.go 1.2 KB

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