return _tlspool._prng(label, opt_ctxvalue, prng_len, prng_buf, ctlkey)
_prng = _tlspool._prng
+def tlspool_configvar(cfgfile, varname):
+ return _tlspool.tlspool_configvar(cfgfile, varname)
+tlspool_configvar = _tlspool.tlspool_configvar
+
def raise_errno():
return _tlspool.raise_errno()
raise_errno = _tlspool.raise_errno
def make_tlsdata (localid='', remoteid='',
flags=0, local_flags=0,
ipproto=socket.IPPROTO_TCP, streamid=0, service='',
- timeout=0, ctlkey=None):
+ timeout=0, ctlkey='TODOTODOTODOTODO'):
"""Make a new tlsdata structure, based the fields that may be supplied
as flags, or otherwise as defaults. Note that the field "local" is
renamed to "local_flags" for reasons of clarity. This helper function
The procedure has been described in RFC 5705.
#TODO# Find a way to return the random bytes, and use the length
"""
+ assert (length > 0)
+ assert (1 <= len (label) <= 254)
+ assert (1 <= len (ctxvalue or 'X') <= 254)
buf = prng_data ()
- rv = _prng (label, ctxvalue, length, buf, self.tlsdata.ctlkey)
+# buf.in1_len = len (label)
+# buf.in2_len = len (ctxvalue) if ctxvalue is not None else 255
+# buf.prng_len = length
+ rv = _prng (label, ctxvalue, length, buf.buffer, self.tlsdata.ctlkey)
if rv < 0:
_tlspool.raise_errno ()
else:
- return buf
+ return buf.buffer [:length]
def control_detach (self):
"""Detach control of this connection. Although the connection
else:
self.request = sox2
self.handle_secure ()
+ sox2.close ()
def startssh (self):
raise NotImplementedError ("Python wrapper does not implement STARTSSH")
does nothing but invoke starttls(), which in turn invokes
handle_secure() after the TLS handshake has succeeded.
"""
- print 'STARTTLS.BEGIN'
self.starttls ()
- print 'STARTTLS.END'
def handle_secure (self):
"""This method may be overridden to handle the secure part of the