connectors/PYRO/PSK_Adapter.py
changeset 2313 2eaf235270f8
parent 2312 84b3cc18893b
child 2314 e927c101ce6d
equal deleted inserted replaced
2312:84b3cc18893b 2313:2eaf235270f8
       
     1 from __future__ import absolute_import
       
     2 from __future__ import print_function
     1 
     3 
       
     4 import socket
     2 import sslpsk
     5 import sslpsk
     3 import Pyro
     6 import Pyro
     4 from Pyro.protocol import _connect_socket,TCPConnection,PYROAdapter
     7 from Pyro.protocol import _connect_socket,TCPConnection,PYROAdapter
     5 from Pyro.errors import ConnectionDeniedError, ProtocolError
     8 from Pyro.errors import ConnectionDeniedError, ProtocolError
     6 from Pyro.util import Log
     9 from Pyro.util import Log
    20 
    23 
    21                 # This are the statements that differ from Pyro/protocol.py
    24                 # This are the statements that differ from Pyro/protocol.py
    22                 raw_sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
    25                 raw_sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
    23                 _connect_socket(raw_sock, URI.address, URI.port, self.timeout)
    26                 _connect_socket(raw_sock, URI.address, URI.port, self.timeout)
    24                 sock = sslpsk.wrap_socket(
    27                 sock = sslpsk.wrap_socket(
    25                     raw_sock, psk=Pyro.config.PYROPSK, server_side=False)
    28                     raw_sock, psk=Pyro.config.PYROPSK, server_side=False,
       
    29                     ciphers="PSK-AES256-GCM-SHA384:PSK-AES256-CBC-SHA")
    26                 # all the rest is the same as in Pyro/protocol.py 
    30                 # all the rest is the same as in Pyro/protocol.py 
    27 
    31 
    28                 conn=TCPConnection(sock, sock.getpeername())
    32                 conn=TCPConnection(sock, sock.getpeername())
    29                 # receive the authentication challenge string, and use that to build the actual identification string.
    33                 # receive the authentication challenge string, and use that to build the actual identification string.
    30                 try:
    34                 try: