diff options
author | Jim Shaver <dcypherd@gmail.com> | 2015-04-25 17:31:22 -0400 |
---|---|---|
committer | Jim Shaver <dcypherd@gmail.com> | 2015-04-25 17:31:22 -0400 |
commit | 4ca59a170411bc2da184a92055f3adfae504a98e (patch) | |
tree | 6b6456a55801783ab91efc9678ac836a23b4b14f /examples | |
parent | 9a2c732e5102bf03845f79d8271f7b66021200f6 (diff) | |
download | pyopenssl-git-4ca59a170411bc2da184a92055f3adfae504a98e.tar.gz |
md5->sha256, 1024->2048. Also added print statements to tell the story.
Diffstat (limited to 'examples')
-rw-r--r-- | examples/certgen.py | 2 | ||||
-rw-r--r-- | examples/mk_simple_certs.py | 8 |
2 files changed, 7 insertions, 3 deletions
diff --git a/examples/certgen.py b/examples/certgen.py index f157235..28bdf80 100644 --- a/examples/certgen.py +++ b/examples/certgen.py @@ -25,7 +25,7 @@ def createKeyPair(type, bits): pkey.generate_key(type, bits) return pkey -def createCertRequest(pkey, digest="md5", **name): +def createCertRequest(pkey, digest="sha256", **name): """ Create a certificate request. diff --git a/examples/mk_simple_certs.py b/examples/mk_simple_certs.py index 9dfdd2e..3d166ee 100644 --- a/examples/mk_simple_certs.py +++ b/examples/mk_simple_certs.py @@ -4,14 +4,18 @@ Create certificates and private keys for the 'simple' example. from OpenSSL import crypto from certgen import * # yes yes, I know, I'm lazy -cakey = createKeyPair(TYPE_RSA, 1024) +cakey = createKeyPair(TYPE_RSA, 2048) careq = createCertRequest(cakey, CN='Certificate Authority') cacert = createCertificate(careq, (careq, cakey), 0, (0, 60*60*24*365*5)) # five years +print('Creating Certificate Authority private key in \"simple/CA.pkey\"') open('simple/CA.pkey', 'w').write(crypto.dump_privatekey(crypto.FILETYPE_PEM, cakey)) +print('Creating Certificate Authority certificate in \"simple/CA.cert\"') open('simple/CA.cert', 'w').write(crypto.dump_certificate(crypto.FILETYPE_PEM, cacert)) for (fname, cname) in [('client', 'Simple Client'), ('server', 'Simple Server')]: - pkey = createKeyPair(TYPE_RSA, 1024) + pkey = createKeyPair(TYPE_RSA, 2048) req = createCertRequest(pkey, CN=cname) cert = createCertificate(req, (cacert, cakey), 1, (0, 60*60*24*365*5)) # five years + print('Creating Certificate %s private key in \"simple/%s.pkey\"' % (fname, fname)) open('simple/%s.pkey' % (fname,), 'w').write(crypto.dump_privatekey(crypto.FILETYPE_PEM, pkey)) + print('Creating Certificate %s certificate in \"simple/%s.cert\"' % (fname, fname)) open('simple/%s.cert' % (fname,), 'w').write(crypto.dump_certificate(crypto.FILETYPE_PEM, cert)) |