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)
| 57 | // log.Fatal("not a RSA public key") |
| 58 | // } |
| 59 | func 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. |
| 70 | func DeregisterServerPubKey(name string) { |