Пример #1
0
 def checkServerTrusted(self, chain, auth_type):
     for trust_manager in self.trust_managers:
         try:
             trustManager.checkServerTrusted(chain, auth_type);
             return
         except CertificateException:
             pass
     raise CertificateException("None of the TrustManagers trust this certificate chain")
Пример #2
0
    def checkServerTrusted(self, chain, auth_type):
        for trust_manager in self.trust_managers:
            try:
                trust_manager.checkServerTrusted(chain, auth_type)
                return
            except CertificateException:
                continue
            except RuntimeException as err:
                # special-case to raise proper CertificateException ;)
                if isinstance(err.getCause(), InvalidAlgorithmParameterException):
                    if err.getCause().getMessage() == u'the trustAnchors parameter must be non-empty':
                        continue
                raise

        raise CertificateException("certificate verify failed")