diff options
author | Paul Kehrer <paul.l.kehrer@gmail.com> | 2015-08-04 23:05:09 +0100 |
---|---|---|
committer | Paul Kehrer <paul.l.kehrer@gmail.com> | 2015-08-04 23:05:09 +0100 |
commit | 25f1922658fb3550d199486e2d05299d1454360f (patch) | |
tree | 5618940f63584c36f7276d67f49024a8b92e916f /src | |
parent | eca59b7064be4c2e0b7f8255431060e271a7f67d (diff) | |
download | cryptography-25f1922658fb3550d199486e2d05299d1454360f.tar.gz cryptography-25f1922658fb3550d199486e2d05299d1454360f.tar.bz2 cryptography-25f1922658fb3550d199486e2d05299d1454360f.zip |
check that required fields are present in builder when signing
Diffstat (limited to 'src')
-rw-r--r-- | src/cryptography/x509.py | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/src/cryptography/x509.py b/src/cryptography/x509.py index 978eb560..0ddff728 100644 --- a/src/cryptography/x509.py +++ b/src/cryptography/x509.py @@ -1752,4 +1752,22 @@ class CertificateBuilder(object): """ Signs the certificate using the CA's private key. """ + if self._subject_name is None: + raise ValueError("A certificate must have a subject name") + + if self._issuer_name is None: + raise ValueError("A certificate must have an issuer name") + + if self._serial_number is None: + raise ValueError("A certificate must have a serial number") + + if self._not_valid_before is None: + raise ValueError("A certificate must have a not valid before time") + + if self._not_valid_after is None: + raise ValueError("A certificate must have a not valid after time") + + if self._public_key is None: + raise ValueError("A certificate must have a public key") + return backend.sign_x509_certificate(self, private_key, algorithm) |