<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Tue, Dec 10, 2013 at 9:41 AM, Phil Mayers <span dir="ltr"><<a href="mailto:p.mayers@imperial.ac.uk" target="_blank">p.mayers@imperial.ac.uk</a>></span> wrote:<br>



<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
Unless you set the appropriate verify options on the server side too, the client cert isn't available for inspection.<br>
</blockquote><div><br></div><div>A-ha! But I want to do TOFU-POP; the certs are generated by the client, and there's little point in me signing them (I don't need to be able to verify that I ever signed them somewhere else).<br>

<br></div><div>The context factory I got from PrivateCertificate.options() doesn't seem to do what I want, so I wrote my own SSL ContextFactory like it's 1999; I used VERIFY_PEER with a callback that always claims it validated:<br>

<br>class ContextFactory(object):<br>    def getContext(self):<br>        ctx = Context(TLSv1_METHOD)<br>        ctx.use_certificate_file("cert.pem")<br>        ctx.use_privatekey_file("key.pem")<br>        ctx.set_verify(VERIFY_PEER, _verify)<br>

        return ctx<br><br><br><br>def _verify(connection, x509, errorNumber, errorDepth, returnCode):<br>    """Always pretend the certificate verified.<br><br>    """<br>    return True<br>
<br>
<br></div><div>Does that sound about right, or is there an easier way to do this? (Yeah, yeah, don't hardcode paths etc :))<br></div><div><br></div><div>cheers<br>lvh<br></div></div></div></div>