cipher_suite_go114.go 1.1 KB

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