Beispiel #1
0
func initSecurity(private_key_path string, server_key_path string, sock *zmq.Socket) {
	zmq.AuthStart()
	private_key, public_key, err := keyloader.InitKeys(private_key_path)
	condlog.Fatal(err, fmt.Sprintf("Unable to read key pair for private key '%v'", private_key_path))
	zmq.AuthCurveAdd("scrabble", public_key)

	err = keyloader.CheckPermissions(server_key_path)
	condlog.Fatal(err, "Untrustworthy key file")
	server_key_buf, err := ioutil.ReadFile(server_key_path)
	condlog.Fatal(err, fmt.Sprintf("Unable to load public server key '%v'", server_key_path))
	server_key := string(server_key_buf)
	sock.ClientAuthCurve(server_key, public_key, private_key)
}