1833 "because it uses a critical extension that pkg5 cannot " |
1833 "because it uses a critical extension that pkg5 cannot " |
1834 "handle yet.\nExtension name:%(name)s\nExtension " |
1834 "handle yet.\nExtension name:%(name)s\nExtension " |
1835 "value:%(val)s") % {"cert": self.cert.get_subject(), |
1835 "value:%(val)s") % {"cert": self.cert.get_subject(), |
1836 "name":self.ext.get_name(), "val":self.ext.get_value()} |
1836 "name":self.ext.get_name(), "val":self.ext.get_value()} |
1837 |
1837 |
1838 |
1838 class UnsupportedExtensionValue(SigningException): |
|
1839 """Exception used when a certificate in the chain of trust has an |
|
1840 extension with a value pkg5 doesn't understand.""" |
|
1841 |
|
1842 def __init__(self, cert, ext, bad_val=None): |
|
1843 SigningException.__init__(self) |
|
1844 self.cert = cert |
|
1845 self.ext = ext |
|
1846 self.bad_val = bad_val |
|
1847 |
|
1848 def __str__(self): |
|
1849 s = _("The certificate whose subject is %(cert)s could not be " |
|
1850 "verified because it has an extension with a value that " |
|
1851 "pkg(5) does not understand." |
|
1852 "\nExtension name:%(name)s\nExtension value:%(val)s") % \ |
|
1853 {"cert": self.cert.get_subject(), |
|
1854 "name":self.ext.get_name(), "val":self.ext.get_value()} |
|
1855 if self.bad_val: |
|
1856 s += _("\nProblematic Value:%s") % (self.bad_val,) |
|
1857 return s |
|
1858 |
|
1859 class InappropriateCertificateUse(SigningException): |
|
1860 """Exception used when a certificate in the chain of trust has been used |
|
1861 inappropriately. An example would be a certificate which was only |
|
1862 supposed to be used to sign code being used to sign other certificates. |
|
1863 """ |
|
1864 |
|
1865 def __init__(self, cert, ext, use): |
|
1866 SigningException.__init__(self) |
|
1867 self.cert = cert |
|
1868 self.ext = ext |
|
1869 self.use = use |
|
1870 |
|
1871 def __str__(self): |
|
1872 return _("The certificate whose subject is %(cert)s could not " |
|
1873 "be verified because it has been used inappropriately. " |
|
1874 "The way it is used means that the value for extension " |
|
1875 "%(name)s must include '%(use)s' but the value was " |
|
1876 "'%(val)s'.") % {"cert": self.cert.get_subject(), |
|
1877 "use": self.use, "name":self.ext.get_name(), |
|
1878 "val":self.ext.get_value()} |
|
1879 |
1839 class InvalidPropertyValue(ApiException): |
1880 class InvalidPropertyValue(ApiException): |
1840 """Exception used when a property was set to an invalid value.""" |
1881 """Exception used when a property was set to an invalid value.""" |
1841 |
1882 |
1842 def __init__(self, s): |
1883 def __init__(self, s): |
1843 ApiException.__init__(self) |
1884 ApiException.__init__(self) |