aboutsummaryrefslogtreecommitdiff
path: root/scripts/http-server.py
blob: 7716d5edcca0c7fdec101001ceaff8be248484d4 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
# $Id$

import rpki.https, tlslite.api, rpki.config

cfg = rpki.config.parser("http-demo.conf")
section = "server"

privateKey = rpki.x509.RSA(PEM_file = cfg.get(section, "https-key"))

certChain = rpki.x509.X509_chain()
certChain.load_from_PEM(cfg.multiget(section, "https-cert"))

def handler(query, path):
  return 200, "Path:    %s\nQuery:   %s" % (path, query)

rpki.https.server(privateKey=privateKey, certChain=certChain, handlers=handler)