Polish up examples (somewhat)
- Mention them in the docs (arguably a bit hamfistedly).
- Make the README an RST.
- Make them pass flake8 and add flake8 to tox.ini
They should all be rewritten and made Python 3-friendly but that's out
of scope here.
diff --git a/examples/certgen.py b/examples/certgen.py
index da0624f..7b70e98 100644
--- a/examples/certgen.py
+++ b/examples/certgen.py
@@ -13,6 +13,7 @@
TYPE_RSA = crypto.TYPE_RSA
TYPE_DSA = crypto.TYPE_DSA
+
def createKeyPair(type, bits):
"""
Create a public/private key pair.
@@ -25,6 +26,7 @@
pkey.generate_key(type, bits)
return pkey
+
def createCertRequest(pkey, digest="sha256", **name):
"""
Create a certificate request.
@@ -52,7 +54,9 @@
req.sign(pkey, digest)
return req
-def createCertificate(req, issuerCertKey, serial, validityPeriod, digest="sha256"):
+
+def createCertificate(req, issuerCertKey, serial, validityPeriod,
+ digest="sha256"):
"""
Generate a certificate given a certificate request.
@@ -78,4 +82,3 @@
cert.set_pubkey(req.get_pubkey())
cert.sign(issuerKey, digest)
return cert
-