eyespot/eyespot/cipherts/ciphers.go

44 lines
1.0 KiB
Go

package cipherts
import (
"crypto/tls"
)
func Run(protocol string, host string) (map[uint16]bool) {
result := map[uint16]bool{}
for _, c := range []uint16{
tls.TLS_RSA_WITH_RC4_128_SHA,
tls.TLS_RSA_WITH_3DES_EDE_CBC_SHA,
tls.TLS_RSA_WITH_AES_128_CBC_SHA,
tls.TLS_RSA_WITH_AES_256_CBC_SHA,
tls.TLS_ECDHE_ECDSA_WITH_RC4_128_SHA,
tls.TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA,
tls.TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA,
tls.TLS_ECDHE_RSA_WITH_RC4_128_SHA,
tls.TLS_ECDHE_RSA_WITH_3DES_EDE_CBC_SHA,
tls.TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA,
tls.TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA,
tls.TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256,
tls.TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256,
} {
r, _ := test(protocol, host, c)
result[c] = r
}
return result
}
func test(protocol string, host string, cipher uint16) (bool, error) {
conn, err := tls.Dial(protocol, host, &tls.Config{
CipherSuites: []uint16{cipher},
InsecureSkipVerify: true,
})
if err != nil {
return false, err
}
defer conn.Close();
return true, nil
}