diff --git a/eyespot/cipherts/ciphers.go b/eyespot/cipherts/ciphers.go new file mode 100644 index 0000000..de784f4 --- /dev/null +++ b/eyespot/cipherts/ciphers.go @@ -0,0 +1,43 @@ +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 +}