File tree 11 files changed +111
-0
lines changed 11 files changed +111
-0
lines changed Original file line number Diff line number Diff line change
1
+ #!/usr/bin/env python
2
+
3
+ import zmq
4
+ import zmq .auth
5
+
6
+ context = zmq .Context ()
7
+
8
+ socket = context .socket (zmq .REQ )
9
+ socket .curve_publickey , socket .curve_secretkey = zmq .auth .load_certificate ('keys/client.key_secret' )
10
+ socket .curve_serverkey , _ = zmq .auth .load_certificate ('keys/server.key' )
11
+ socket .connect ("tcp://localhost:{}" .format (53487 ))
12
+
13
+ socket .send (b'Hello' )
14
+ print (socket .recv ())
Original file line number Diff line number Diff line change
1
+ #!/usr/bin/env python
2
+
3
+ import zmq
4
+ import zmq .auth
5
+ from zmq .auth .thread import ThreadAuthenticator
6
+
7
+ context = zmq .Context ()
8
+ auth = ThreadAuthenticator (context )
9
+ auth .start ()
10
+ #auth.configure_curve(domain='*', location=zmq.auth.CURVE_ALLOW_ANY)
11
+ auth .configure_curve (domain = '*' , location = 'authorized_keys' )
12
+
13
+ socket = context .socket (zmq .REP )
14
+ socket .curve_server = True
15
+ socket .curve_publickey , socket .curve_secretkey = zmq .auth .load_certificate ('keys/server.key_secret' )
16
+ socket .bind ("tcp://*:{}" .format (53487 ))
17
+
18
+ while True :
19
+ msg = socket .recv ()
20
+ print ("Received request: " , msg )
21
+ socket .send (b'ok' )
22
+
23
+ auth .stop ()
Original file line number Diff line number Diff line change
1
+ # **** Generated on 2014-05-13 17:36:45.315366 by pyzmq ****
2
+ # ZeroMQ CURVE Public Certificate
3
+ # Exchange securely, or use a secure mechanism to verify the contents
4
+ # of this file after exchange. Store public certificates in your home
5
+ # directory, in the .curve subdirectory.
6
+
7
+ metadata
8
+ curve
9
+ public-key = "25m(@z#)Z:nkaJyXvhC)lS!vHgz8[ZXg=jMgi{+W"
Original file line number Diff line number Diff line change
1
+ #!/usr/bin/env python
2
+
3
+ import zmq
4
+
5
+ context = zmq .Context ()
6
+ socket = context .socket (zmq .REQ )
7
+ socket .connect ("tcp://localhost:{}" .format (53487 ))
8
+
9
+ socket .send (b'Hello' )
10
+ print (socket .recv ())
Original file line number Diff line number Diff line change
1
+ #!/usr/bin/env python
2
+
3
+ import zmq .auth
4
+
5
+ keys_dir = 'keys'
6
+ zmq .auth .create_certificates (keys_dir , 'server' )
7
+ zmq .auth .create_certificates (keys_dir , 'client' )
Original file line number Diff line number Diff line change
1
+ # **** Generated on 2014-05-13 17:36:45.315366 by pyzmq ****
2
+ # ZeroMQ CURVE Public Certificate
3
+ # Exchange securely, or use a secure mechanism to verify the contents
4
+ # of this file after exchange. Store public certificates in your home
5
+ # directory, in the .curve subdirectory.
6
+
7
+ metadata
8
+ curve
9
+ public-key = "25m(@z#)Z:nkaJyXvhC)lS!vHgz8[ZXg=jMgi{+W"
Original file line number Diff line number Diff line change
1
+ # **** Generated on 2014-05-13 17:36:45.315366 by pyzmq ****
2
+ # ZeroMQ CURVE **Secret** Certificate
3
+ # DO NOT PROVIDE THIS FILE TO OTHER USERS nor change its permissions.
4
+
5
+ metadata
6
+ curve
7
+ public-key = "25m(@z#)Z:nkaJyXvhC)lS!vHgz8[ZXg=jMgi{+W"
8
+ secret-key = "(<fK!2s%ZJ<ebKd?IF5l!kJJ(PPwk-cwOJUIEmAm"
Original file line number Diff line number Diff line change
1
+ # **** Generated on 2014-05-13 17:36:45.314747 by pyzmq ****
2
+ # ZeroMQ CURVE Public Certificate
3
+ # Exchange securely, or use a secure mechanism to verify the contents
4
+ # of this file after exchange. Store public certificates in your home
5
+ # directory, in the .curve subdirectory.
6
+
7
+ metadata
8
+ curve
9
+ public-key = "-zB.*[8*RUhCmp{[w0!R&n.E<fah.(wHo+dpuuvA"
Original file line number Diff line number Diff line change
1
+ # **** Generated on 2014-05-13 17:36:45.314747 by pyzmq ****
2
+ # ZeroMQ CURVE **Secret** Certificate
3
+ # DO NOT PROVIDE THIS FILE TO OTHER USERS nor change its permissions.
4
+
5
+ metadata
6
+ curve
7
+ public-key = "-zB.*[8*RUhCmp{[w0!R&n.E<fah.(wHo+dpuuvA"
8
+ secret-key = "aZ2Xu7-StY[4Sa(!+.1WHsV<bE$t+PB%(uQD&Fq?"
Original file line number Diff line number Diff line change
1
+ pyzmq == 14.3.0
Original file line number Diff line number Diff line change
1
+ #!/usr/bin/env python
2
+
3
+ import zmq
4
+
5
+ context = zmq .Context ()
6
+ socket = context .socket (zmq .REP )
7
+ #socket.bind("tcp://*:{}".format(53487))
8
+ socket .bind ("tcp://127.0.0.1:{}" .format (53487 ))
9
+
10
+ while True :
11
+ msg = socket .recv ()
12
+ print ("Received request: " , msg )
13
+ socket .send (b'ok' )
You can’t perform that action at this time.
0 commit comments