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

Function RegisterServerPubKey

auth.go:59–67  ·  view source on GitHub ↗

RegisterServerPubKey registers a server RSA public key which can be used to send data in a secure manner to the server without receiving the public key in a potentially insecure way from the server first. Registered keys can afterwards be used adding serverPubKey=<name> to the DSN. Note: The provid

(name string, pubKey *rsa.PublicKey)

Source from the content-addressed store, hash-verified

57// log.Fatal("not a RSA public key")
58// }
59func RegisterServerPubKey(name string, pubKey *rsa.PublicKey) {
60 serverPubKeyLock.Lock()
61 if serverPubKeyRegistry == nil {
62 serverPubKeyRegistry = make(map[string]*rsa.PublicKey)
63 }
64
65 serverPubKeyRegistry[name] = pubKey
66 serverPubKeyLock.Unlock()
67}
68
69// DeregisterServerPubKey removes the public key registered with the given name.
70func DeregisterServerPubKey(name string) {

Callers 3

TestDSNServerPubKeyFunction · 0.85
TestCloneConfigFunction · 0.85

Calls 2

LockMethod · 0.80
UnlockMethod · 0.80

Tested by 3

TestDSNServerPubKeyFunction · 0.68
TestCloneConfigFunction · 0.68