SSL_write() extended to handle ctypes.Array as data
* dtls/openssl.py: SSL_write() can handle ctypes.Array data * dtls/sslconnection.py: Added missing import ERR_BOTH_KEY_CERT_FILES * dtls/test/simple_client.py: Added basic test client to use with dtls/test/echo_seq.py
This commit is contained in:
1 parent
b4911f4949
commit
d601774e24
5 files changed
+45
-19
No files matched your search
@@ -36,12 +36,13 @@ import socket
|
||||
from os import path
|
||||
from logging import basicConfig, DEBUG
|
||||
basicConfig(level=DEBUG) # set now for dtls import code
|
||||
from dtls.sslconnection import SSLConnection
|
||||
from dtls.err import SSLError, SSL_ERROR_WANT_READ, SSL_ERROR_ZERO_RETURN
|
||||
|
||||
def main():
|
||||
sck = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
|
||||
sck.bind(("127.0.0.1", 28000))
|
||||
from dtls.sslconnection import SSLConnection
|
||||
from dtls.err import SSLError, SSL_ERROR_WANT_READ, SSL_ERROR_ZERO_RETURN
|
||||
|
||||
|
||||
def main():
|
||||
sck = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
|
||||
sck.bind(("127.0.0.1", 28000))
|
||||
sck.settimeout(30)
|
||||
cert_path = path.join(path.abspath(path.dirname(__file__)), "certs")
|
||||
scn = SSLConnection(
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
from os import path
|
||||
import ssl
|
||||
from socket import socket, AF_INET, SOCK_DGRAM, SHUT_RDWR
|
||||
from logging import basicConfig, DEBUG
|
||||
basicConfig(level=DEBUG) # set now for dtls import code
|
||||
from dtls import do_patch
|
||||
do_patch()
|
||||
|
||||
cert_path = path.join(path.abspath(path.dirname(__file__)), "certs")
|
||||
sock = ssl.wrap_socket(socket(AF_INET, SOCK_DGRAM), cert_reqs=ssl.CERT_REQUIRED, ca_certs=path.join(cert_path, "ca-cert.pem"))
|
||||
sock.connect(('localhost', 28000))
|
||||
sock.send('Hi there')
|
||||
print sock.recv()
|
||||
sock.unwrap()
|
||||
sock.shutdown(SHUT_RDWR)
|
||||
Reference in new issue
Block a user