Perform cipher tests
This commit is contained in:
parent
04c5eca30b
commit
e2bc8eb5b4
43
eyespot/cipherts/ciphers.go
Normal file
43
eyespot/cipherts/ciphers.go
Normal file
@ -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
|
||||
}
|
Loading…
Reference in New Issue
Block a user