diff options
author | Rob Austein <sra@hactrn.net> | 2007-08-08 16:20:27 +0000 |
---|---|---|
committer | Rob Austein <sra@hactrn.net> | 2007-08-08 16:20:27 +0000 |
commit | 7a4d92a49f2f270e6adada0fec4c3ca994d1b96b (patch) | |
tree | cd5a98319b235d576609008d4afb9b8526ff283a /scripts/http-client.py | |
parent | 9be98cafee7a8995e05af666c13ae97e33154d58 (diff) |
Checkpoint
svn path=/scripts/http-client.py; revision=843
Diffstat (limited to 'scripts/http-client.py')
-rw-r--r-- | scripts/http-client.py | 40 |
1 files changed, 3 insertions, 37 deletions
diff --git a/scripts/http-client.py b/scripts/http-client.py index 02af3659..ed1019fa 100644 --- a/scripts/http-client.py +++ b/scripts/http-client.py @@ -1,40 +1,6 @@ # $Id$ -import httplib, tlslite.api +import rpki.https -certChain = [] -for file in ("biz-certs/Dave-EE.cer", "biz-certs/Dave-CA.cer"): - f = open(file, "r") - x509 = tlslite.api.X509() - x509.parse(f.read()) - f.close() - certChain.append(x509) -certChain = tlslite.api.X509CertChain(certChain) - -f = open("biz-certs/Dave-EE.key", "r") -privateKey = tlslite.api.parsePEMKey(f.read(), private=True) -f.close() - -x509TrustList = [] -for file in ("biz-certs/Alice-Root.cer", "biz-certs/Bob-Root.cer", "biz-certs/Carol-Root.cer"): - f = open(file, "r") - x509 = tlslite.api.X509() - x509.parse(f.read()) - f.close() - x509TrustList.append(x509) - -https = tlslite.api.HTTPTLSConnection(host="localhost", port=4433, certChain=certChain, privateKey=privateKey, x509TrustList=x509TrustList) - -https.connect() -https.request("POST", "/", "This is a test. This is only a test. Had this been real you would now be really confused.\n", {"Content-Type":"application/wombat"}) -response = https.getresponse() - -for h in response.getheaders(): - print "%s: %s" % h -print -if response.status == httplib.OK: - print "OK" -else: - print "Ouch" -print -print response.read() +certInfo = rpki.https.CertInfo("Dave") +print rpki.https.client(certInfo=certInfo, msg="This is a test. This is only a test. Had this been real you would now be really confused.\n") |