blob: d3798a32a0da1308de7d10f7c2fb61b5ce53a3a7 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
|
# $Id$
"""Exception definitions for RPKI modules."""
class NotInDatabase(Exception):
"""Lookup failed for an object expected to be in the database."""
class BadURISyntax(Exception):
"""Illegal syntax for a URI."""
class BadStatusCode(Exception):
"""Unrecognized protocol status code."""
class BadQuery(Exception):
"""Unexpected protocol query."""
class DBConsistancyError(Exception):
"""Found multiple matches for a database query that shouldn't ever return that."""
class CMSVerificationFailed(Exception):
"""Verification of a CMS message failed."""
class HTTPRequestFailed(Exception):
"""HTTP request failed."""
class DERObjectConversionError(Exception):
"""Error trying to convert a DER-based object from one representation to another."""
class NotACertificateChain(Exception):
"""Certificates don't form a proper chain."""
class BadContactURL(Exception):
"""Error trying to parse up-down protocol contact URL."""
class BadClassNameSyntax(Exception):
"""Illegal syntax for a class_name."""
class BadIssueResponse(Exception):
"""issue_response PDU with wrong number of classes or certificates."""
class NotImplementedYet(Exception):
"""Internal error -- not implemented yet."""
"o">.SO_REUSEADDR, 1)
s.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEPORT, 1)
print "Got connection %r from %r" % (s, addr)
ssl = POW.Ssl(POW.TLSV1_SERVER_METHOD)
ssl.useCertificate(cer)
ssl.useKey(key)
ssl.setVerifyMode(POW.SSL_VERIFY_PEER | POW.SSL_VERIFY_FAIL_IF_NO_PEER_CERT)
ssl.trustCertificate(ta)
ssl.setFd(s.fileno())
ssl.accept()
peer = ssl.peerCertificate()
if peer is not None:
print peer.pprint()
ssl.write("Hello, TLS")
print ssl.read(100)
|