Changeset 2958


Ignore:
Timestamp:
16/10/07 15:14:10 (12 years ago)
Author:
pjkersha
Message:

ndg.security.common/ndg/security/common/X509.py: X509Stack.verifyCertChain - increment number of certs to validate for when x509Cert2Verify is input.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • TI12-security/trunk/python/ndg.security.common/ndg/security/common/X509.py

    r2957 r2958  
    456456        @type rejectSelfSignedCert: bool""" 
    457457         
    458          
    459         if x509Cert2Verify is None: 
    460             if not len(self): 
     458        n2Validate = len(self) 
     459        if x509Cert2Verify: 
     460            # One more to validate in addition to stack content 
     461            n2Validate += 1 
     462        else: 
     463            # Validate starting from last on stack - but check first that it's 
     464            # populated 
     465            if n2Validate == 0: 
    461466                raise X509StackError, \ 
    462467                "Empty stack and no x509Cert2Verify set: no cert.s to verify" 
    463468 
    464469            x509Cert2Verify = self[-1] 
    465              
     470              
     471                 
    466472        # Exit loop if all certs have been validated or if find a self  
    467473        # signed cert. 
    468474        nValidated = 0 
    469475        issuerX509Cert = None 
    470         while nValidated < len(self):                 
     476        while nValidated < n2Validate:                 
    471477            issuerX509Cert = None 
    472478            issuerDN = x509Cert2Verify.issuer 
Note: See TracChangeset for help on using the changeset viewer.