MCPcopy
hub / github.com/go-sql-driver/mysql / TestAuthFastSHA256PasswordRSAWithKey

Function TestAuthFastSHA256PasswordRSAWithKey

auth_test.go:629–657  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

627}
628
629func TestAuthFastSHA256PasswordRSAWithKey(t *testing.T) {
630 conn, mc := newRWMockConn(1)
631 mc.cfg.User = "root"
632 mc.cfg.Passwd = "secret"
633 mc.cfg.pubKey = testPubKeyRSA
634
635 authData := []byte{6, 81, 96, 114, 14, 42, 50, 30, 76, 47, 1, 95, 126, 81,
636 62, 94, 83, 80, 52, 85}
637 plugin := "sha256_password"
638
639 // Send Client Authentication Packet
640 authResp, err := mc.auth(authData, plugin)
641 if err != nil {
642 t.Fatal(err)
643 }
644 err = mc.writeHandshakeResponsePacket(authResp, plugin)
645 if err != nil {
646 t.Fatal(err)
647 }
648
649 // auth response (OK)
650 conn.data = []byte{7, 0, 0, 2, 0, 0, 0, 2, 0, 0, 0}
651 conn.maxReads = 1
652
653 // Handle response to auth packet
654 if err := mc.handleAuthResult(authData, plugin); err != nil {
655 t.Errorf("got error: %v", err)
656 }
657}
658
659func TestAuthFastSHA256PasswordSecure(t *testing.T) {
660 conn, mc := newRWMockConn(1)

Callers

nothing calls this directly

Calls 4

newRWMockConnFunction · 0.85
authMethod · 0.80
handleAuthResultMethod · 0.80

Tested by

no test coverage detected