aboutsummaryrefslogtreecommitdiffstats
path: root/docs/x509/tutorial.rst
diff options
context:
space:
mode:
authorPaul Kehrer <paul.l.kehrer@gmail.com>2017-05-24 19:24:54 -0700
committerAlex Gaynor <alex.gaynor@gmail.com>2017-05-24 21:24:54 -0500
commit136b3242148abc1059661284196c772471ff9ca5 (patch)
tree60692ede5c5349c83552e84c5252d2ae097b433a /docs/x509/tutorial.rst
parent9bab8bd3c0ca26a83151c12fd2fb7f5fb0929b4a (diff)
downloadcryptography-136b3242148abc1059661284196c772471ff9ca5.tar.gz
cryptography-136b3242148abc1059661284196c772471ff9ca5.tar.bz2
cryptography-136b3242148abc1059661284196c772471ff9ca5.zip
add some explicit instructions on determining key type in a cert (#3596)
* add some explicit instructions on determining key type in a cert * can't call it a CSR
Diffstat (limited to 'docs/x509/tutorial.rst')
-rw-r--r--docs/x509/tutorial.rst17
1 files changed, 17 insertions, 0 deletions
diff --git a/docs/x509/tutorial.rst b/docs/x509/tutorial.rst
index 372d78a4..d34b3504 100644
--- a/docs/x509/tutorial.rst
+++ b/docs/x509/tutorial.rst
@@ -152,3 +152,20 @@ Then we generate the certificate itself:
And now we have a private key and certificate that can be used for local
testing.
+
+Determining Certificate or Certificate Signing Request Key Type
+---------------------------------------------------------------
+
+Certificates and certificate signing requests can be issued with multiple
+key types. You can determine what the key type is by using ``isinstance``
+checks:
+
+.. code-block:: pycon
+
+ >>> public_key = cert.public_key()
+ >>> if isinstance(public_key, rsa.RSAPublicKey):
+ ... # Do something RSA specific
+ ... elif isinstance(public_key, ec.EllipticCurvePublicKey):
+ ... # Do something EC specific
+ ... else:
+ ... # Remember to handle this case