1
0
MOVED:
* This codebase was originally part of r00t2.io/sysutils but has been
  split off to its own library.
This commit is contained in:
brent saner
2024-10-17 15:45:53 -04:00
commit bf887ce948
11 changed files with 1810 additions and 0 deletions

37
funcs_test.go Normal file
View 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
}