Package nss :: Module error :: Class CertVerifyError
[hide private]
[frames] | no frames]

type CertVerifyError

              object --+            
                       |            
exceptions.BaseException --+        
                           |        
        exceptions.Exception --+    
                               |    
                       NSPRError --+
                                   |
                                  CertVerifyError

CertVerifyError(error_message=None, error_code=None, usages=None, log=None)

Exception object (derived from NSPRError), raised when an error occurs during certificate verification.

Raised internally, there should be no need to raise this exception from with a Python program using python-nss.

Certificate verification presents a problem for the normal error handling model whereby any error returned from an underlying C function causes a NSPRError exception to be raised. When an exception is raised the return values are lost. It is unusual for a function to have useful return values when the function also returns an error.

The certificate verification functions are one such example. If verification fails useful information concerning validated usages and the verification log need to be available. But to be consistent with model of always raising an exception on an error return some other mechanism is needed to return the extra information. The solution is to embed the information which normally would have been in the return values in the exception object where it can be queried. The CertVerifyError contails the returned usages bitmask and optionally the CertVerifyLog verification log object if requested.

In addtion to the attributes in a NSPRError a CertVerifyError contains the following attributes:

usages
The retured usages bitmask (unsigned int) from the Certificate verification function.
log
The (optional) CertVerifyLog object which contains the diagnostic information for why a certificate failed to validate.
Instance Methods [hide private]
 
__init__(error_message=None, error_code=None, usages=None, log=None)
x.__init__(...) initializes x; see help(type(x)) for signature
 
__str__(x)
str(x)

Inherited from exceptions.Exception: __new__

Inherited from exceptions.BaseException: __delattr__, __getattribute__, __getitem__, __getslice__, __reduce__, __repr__, __setattr__, __setstate__, __unicode__

Properties [hide private]
  log
verifcation log, see CertVerifyLog
  usages
usages returned by NSS

Inherited from NSPRError: errno, error_code, error_desc, error_message, strerror

Inherited from exceptions.BaseException: args, message

Method Details [hide private]

__init__(error_message=None, error_code=None, usages=None, log=None)
(Constructor)

 
x.__init__(...) initializes x; see help(type(x)) for signature
Parameters:
  • error_message (string) - Detail message specific to this error.
  • error_code (int) - NSS or NSPR error value, if None get current error
  • usages (int) - The returned usages bitmaks from the verify function.
  • log (CertVerifyLog object) - The verification log generated during the verification operation.
Overrides: exceptions.BaseException.__init__

__str__(x)
(Informal representation operator)

 
str(x)
Overrides: exceptions.BaseException.__str__