diff options
author | Rob Austein <sra@hactrn.net> | 2008-04-29 22:16:17 +0000 |
---|---|---|
committer | Rob Austein <sra@hactrn.net> | 2008-04-29 22:16:17 +0000 |
commit | e76d57cb7685127521b2e53257851ad0e418861b (patch) | |
tree | 0d9f88ab94962aa78543935a35a08364dcb35f71 | |
parent | eb512a9ffd9b7fd8aec64bdcb0be9f9796895cc9 (diff) |
Add is_CA()
svn path=/rpkid/rpki/x509.py; revision=1724
-rw-r--r-- | rpkid/rpki/x509.py | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/rpkid/rpki/x509.py b/rpkid/rpki/x509.py index cd0bf917..be5ef1f4 100644 --- a/rpkid/rpki/x509.py +++ b/rpkid/rpki/x509.py @@ -189,6 +189,14 @@ class DER_object(object): """Get the SIA extension from this object. Only works for subclasses that support getExtension().""" return (self.get_POWpkix().getExtension(rpki.oids.name2oid["subjectInfoAccess"]) or ((), 0, None))[2] + def get_basicConstraints(self): + """Get the basicConstraints extension from this object. Only works for subclasses that support getExtension().""" + return (self.get_POWpkix().getExtension(rpki.oids.name2oid["basicConstraints"]) or ((), 0, None))[2] + + def is_CA(self): + """Return True if and only if object has the basicConstraints extension and its cA value is true.""" + return self.get_basicConstraints()[0] != 0 + def get_3779resources(self): """Get RFC 3779 resources as rpki.resource_set objects. Only works for subclasses that support getExtensions(). |