A patch implementation is provided, which augments and alters the Python
standard library's ssl module to support passing of datagram sockets, in which
case this package's DTLS protocol support will be activated. The ssl module's
interface is intended to operate identically regardless of whether the DTLS
protocol or another protocol is chosen.
The following features of the ssl module are explicitly supported with
datagram sockets:
    * socket wrapping, unwrapping, and re-wrapping
    * threaded UDP servers
    * asynchronous UDP servers (asyncore integration)
    * socket servers (SocketServer integration)
The following modules have been added:
    * dtls.patch: standard library module patching code and substitution
                  functions and methods
    * unit.py:    this is a port of the standard library's testing module
                  test_ssl.py for datagram sockets; all tests pass at this time;
                  a couple of inapplicable tests have been dropped; a few other
                  tests have been added
Also note that the err module's exception raising mechanism has been
augmented so as to raise exceptions of type ssl.SSLError (as opposed to
dtls.err.SSLError) when instructed to do so through activation of the patching
mechanism. This allows code written against the standard library module's
interface to remain unchanged. In some cases, types derived from
ssl.SSLError are raised.
		
	
			
		
			
				
	
	
		
			20 lines
		
	
	
		
			763 B
		
	
	
	
		
			Python
		
	
	
	
	
	
			
		
		
	
	
			20 lines
		
	
	
		
			763 B
		
	
	
	
		
			Python
		
	
	
	
	
	
| # PyDTLS: datagram TLS for Python. Written by Ray Brown.
 | |
| """PyDTLS package
 | |
| 
 | |
| This package exports OpenSSL's DTLS support to Python. Calling its patch
 | |
| function will add the constant PROTOCOL_DTLSv1 to the Python standard library's
 | |
| ssl module.  Subsequently passing a datagram socket to that module's
 | |
| wrap_socket function (or instantiating its SSLSocket class with a datagram
 | |
| socket) will activate this module's DTLS implementation for the returned
 | |
| SSLSocket instance.
 | |
| 
 | |
| Instead of or in addition to invoking the patch functionality, the
 | |
| SSLConnection class can be used directly for secure communication over datagram
 | |
| sockets.
 | |
| 
 | |
| wrap_socket's parameters and their semantics have been maintained.
 | |
| """
 | |
| 
 | |
| from patch import do_patch
 | |
| from sslconnection import SSLConnection
 |