v0.0.1
MOVED: * This codebase was originally part of r00t2.io/sysutils but has been split off to its own library.
This commit is contained in:
37
funcs_test.go
Normal file
37
funcs_test.go
Normal file
@@ -0,0 +1,37 @@
|
||||
package cryptparse
|
||||
|
||||
import (
|
||||
`crypto/tls`
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestCiphers(t *testing.T) {
|
||||
|
||||
var err error
|
||||
var cs *tls.CipherSuite
|
||||
|
||||
// Good ciphers
|
||||
for _, cn := range []string{
|
||||
"TLS_ECDHE_ECDSA_WITH_CHACHA20_POLY1305_SHA256",
|
||||
"tls ecdhe ecdsa with chacha20 poly1305 sha256",
|
||||
} {
|
||||
if cs, err = ParseTlsCipherSuiteStrict(cn); err != nil {
|
||||
t.Fatalf("ERROR parsing good cipher '%s': %v", cn, err)
|
||||
}
|
||||
if cs.Name != cn {
|
||||
t.Logf("Cipher name change: '%s' => '%s'", cn, cs.Name)
|
||||
}
|
||||
t.Logf("Cipher for '%s':\n%#v", cn, cs)
|
||||
}
|
||||
|
||||
// Bad ciphers
|
||||
for _, cn := range []string{
|
||||
"TLS_BAD_CIPHER",
|
||||
} {
|
||||
if cs, err = ParseTlsCipherSuiteStrict(cn); err == nil {
|
||||
t.Fatalf("ERROR parsing bad cipher '%s'; err is nil", cn)
|
||||
}
|
||||
}
|
||||
|
||||
_ = cs
|
||||
}
|
||||
Reference in New Issue
Block a user