Add list cipher suites support

This commit is contained in:
Cameron Moore 2019-12-03 21:35:16 -06:00
parent 997db04b9f
commit f1003560f1
3 changed files with 35 additions and 0 deletions

24
tls.go
View file

@ -2,10 +2,34 @@ package main
import (
"crypto/tls"
"io"
"log"
"strings"
)
func writeTLSSupportedCipherStrings(w io.Writer, min uint16) error {
for _, c := range CipherSuites() {
var found bool
for _, v := range c.SupportedVersions {
if v >= min {
found = true
}
}
if !found {
continue
}
_, err := w.Write([]byte(c.Name + "\n"))
if err != nil {
return err
}
}
return nil
}
// getTLSMinVersion converts a version string into a TLS version ID.
func getTLSMinVersion(v string) uint16 {
switch v {