diff options
author | Brendan McCollam <brendan@mccoll.am> | 2015-09-07 19:55:09 -0500 |
---|---|---|
committer | Brendan McCollam <brendan@mccoll.am> | 2015-09-07 19:55:09 -0500 |
commit | ae454130b0bbdbb60e9d2081eca6d181eb6fa686 (patch) | |
tree | 70004a36b926fa4f187bc02d185aab27e4cbc17c /docs/x509/tutorial.rst | |
parent | 1b3b3ce19d76ef3d1d492db6d85fd2df52781e2c (diff) | |
parent | 786ded65fd2f7a2ef851e9f6f132f5fc5bc962d9 (diff) | |
download | cryptography-ae454130b0bbdbb60e9d2081eca6d181eb6fa686.tar.gz cryptography-ae454130b0bbdbb60e9d2081eca6d181eb6fa686.tar.bz2 cryptography-ae454130b0bbdbb60e9d2081eca6d181eb6fa686.zip |
Merge branch 'master' into add_name_to_oids
Diffstat (limited to 'docs/x509/tutorial.rst')
-rw-r--r-- | docs/x509/tutorial.rst | 19 |
1 files changed, 11 insertions, 8 deletions
diff --git a/docs/x509/tutorial.rst b/docs/x509/tutorial.rst index 6e587d8b..0fa061a2 100644 --- a/docs/x509/tutorial.rst +++ b/docs/x509/tutorial.rst @@ -37,7 +37,7 @@ are the most common types of keys on the web right now): ... backend=default_backend() ... ) >>> # Write our key to disk for safe keeping - >>> with open("path/to/store/key.pem", "w") as f: + >>> with open("path/to/store/key.pem", "wb") as f: ... f.write(key.private_bytes( ... encoding=serialization.Encoding.PEM, ... format=serialization.PrivateFormat.TraditionalOpenSSL, @@ -67,15 +67,18 @@ a few details: ... x509.NameAttribute(NameOID.LOCALITY_NAME, u"San Francisco"), ... x509.NameAttribute(NameOID.ORGANIZATION_NAME, u"My Company"), ... x509.NameAttribute(NameOID.COMMON_NAME, u"mysite.com"), - ... ])).add_extension(x509.SubjectAlternativeName([ - ... # Describe what sites we want this certificate for. - ... x509.DNSName(u"mysite.com"), - ... x509.DNSName(u"www.mysite.com"), - ... x509.DNSName(u"subdomain.mysite.com"), + ... ])).add_extension( + ... x509.SubjectAlternativeName([ + ... # Describe what sites we want this certificate for. + ... x509.DNSName(u"mysite.com"), + ... x509.DNSName(u"www.mysite.com"), + ... x509.DNSName(u"subdomain.mysite.com"), + ... ]), + ... critical=False, ... # Sign the CSR with our private key. - ... ])).sign(key, hashes.SHA256(), default_backend()) + ... ).sign(key, hashes.SHA256(), default_backend()) >>> # Write our CSR out to disk. - >>> with open("path/to/csr.pem", "w") as f: + >>> with open("path/to/csr.pem", "wb") as f: ... f.write(csr.public_bytes(serialization.Encoding.PEM)) Now we can give our CSR to a CA, who will give a certificate to us in return. |