cipher_suite_go114.go 1.0 KB

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