diff options
author | Alex Gaynor <alex.gaynor@gmail.com> | 2015-08-26 13:41:40 -0400 |
---|---|---|
committer | Alex Gaynor <alex.gaynor@gmail.com> | 2015-08-26 13:41:40 -0400 |
commit | 33e56c1c8fbabdfa39428720656e26dbe1ef39f5 (patch) | |
tree | b07f0e99573451c8dbc4a05653806cb40090ae56 /docs/x509 | |
parent | 42cf0b52bc14bac916460ffaee92c1994444c4cb (diff) | |
parent | e7820613494bd856a84e46333b43716e5028bdbc (diff) | |
download | cryptography-33e56c1c8fbabdfa39428720656e26dbe1ef39f5.tar.gz cryptography-33e56c1c8fbabdfa39428720656e26dbe1ef39f5.tar.bz2 cryptography-33e56c1c8fbabdfa39428720656e26dbe1ef39f5.zip |
Merge pull request #2298 from timbuchwaldt/patch-1
Documentation: Write as key/CSR binary
Diffstat (limited to 'docs/x509')
-rw-r--r-- | docs/x509/tutorial.rst | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/docs/x509/tutorial.rst b/docs/x509/tutorial.rst index 6e587d8b..d1c8ba14 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, @@ -75,7 +75,7 @@ a few details: ... # Sign the CSR with our private key. ... ])).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. |