aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorPaul Kehrer <paul.l.kehrer@gmail.com>2014-11-26 10:59:03 -1000
committerPaul Kehrer <paul.l.kehrer@gmail.com>2014-12-15 15:49:48 -0600
commita9d78c13ea2996c896d3dfda8b7e887c444ec4cb (patch)
treebeebfb298c44439855ef12192c466f080e2c9ffe /src
parent016e08abddf9fdc507da4f6c6f548c3dfee1b389 (diff)
downloadcryptography-a9d78c13ea2996c896d3dfda8b7e887c444ec4cb.tar.gz
cryptography-a9d78c13ea2996c896d3dfda8b7e887c444ec4cb.tar.bz2
cryptography-a9d78c13ea2996c896d3dfda8b7e887c444ec4cb.zip
update docs, test invalid x509 version
Diffstat (limited to 'src')
-rw-r--r--src/cryptography/exceptions.py4
-rw-r--r--src/cryptography/hazmat/backends/openssl/x509.py5
2 files changed, 8 insertions, 1 deletions
diff --git a/src/cryptography/exceptions.py b/src/cryptography/exceptions.py
index b0e1a993..23edcd02 100644
--- a/src/cryptography/exceptions.py
+++ b/src/cryptography/exceptions.py
@@ -53,3 +53,7 @@ class InvalidKey(Exception):
class InvalidToken(Exception):
pass
+
+
+class InvalidX509Version(Exception):
+ pass
diff --git a/src/cryptography/hazmat/backends/openssl/x509.py b/src/cryptography/hazmat/backends/openssl/x509.py
index 0c6395f4..9f6f71d0 100644
--- a/src/cryptography/hazmat/backends/openssl/x509.py
+++ b/src/cryptography/hazmat/backends/openssl/x509.py
@@ -16,6 +16,7 @@ from __future__ import absolute_import, division, print_function
import datetime
from cryptography import utils, x509
+from cryptography.exceptions import InvalidX509Version
from cryptography.hazmat.primitives import hashes, interfaces
@@ -60,7 +61,9 @@ class _X509Certificate(object):
elif version == 2:
return x509.X509Version.v3
else:
- raise StandardError("TODO")
+ raise InvalidX509Version(
+ "{0} is not a valid X509 version", version
+ )
@property
def serial(self):