If the signing cert URL is not from SNS fail.
427769
private void assertIsFromSns(URI certUrl) {
        if (!endpoint.equals(certUrl.getHost())) {
            throw new SdkClientException(
                String.format("SigningCertUrl does not match expected endpoint. Expected %s but received endpoint was %s.",
                              endpoint, certUrl.getHost()));

        }
    }
597585
def __valid_url(cls, url):
        """"""
        bits = urlparse(url)
        return ((bits.scheme == "http" or bits.scheme == "https") and
                _PATTERN_URL_PART.match(bits.netloc) and
                _PATTERN_URL_PART.match(bits.path))
1276199
def _check_certificate(self):
        
        if (self.file_name.startswith("jdk-") and self.repo == "sbo" and
                self.downder == "wget"):
            certificate = (' --no-check-certificate --header="Cookie: '
                           'oraclelicense=accept-securebackup-cookie"')
            self.msg.template(78)
            print("| '{0}' need to go ahead downloading".format(
                certificate[:23].strip()))
            self.msg.template(78)
            print("")
            self.downder_options += certificate
            if not self.msg.answer() in ["y", "Y"]:
                raise SystemExit()
766132
static void verifyCAKeyUsage(X509Certificate cert)
            throws CertPathValidatorException {
        String msg = "CA key usage";
        if (debug != null) {
            debug.println("KeyChecker.verifyCAKeyUsage() ---checking " + msg
                          + "...");
        }

        boolean[] keyUsageBits = cert.getKeyUsage();

        // getKeyUsage returns null if the KeyUsage extension is not present
        // in the certificate - in which case there is nothing to check
        if (keyUsageBits == null) {
            return;
        }

        // throw an exception if the keyCertSign bit is not set
        if (!keyUsageBits[KEY_CERT_SIGN]) {
            throw new CertPathValidatorException
                (msg + " check failed: keyCertSign bit is not set", null,
                 null, -1, PKIXReason.INVALID_KEY_USAGE);
        }

        if (debug != null) {
            debug.println("KeyChecker.verifyCAKeyUsage() " + msg
                          + " verified.");
        }
    }
520365
def handle_error(self, failure):
        
        self.logger.error(repr(failure))

        if failure.check(HttpError):
            response = failure.value.response
            self.logger.error(u'HttpError on %s', response.url)
            self.logger.error(u'HttpError Code: %s', response.status)
            if response.status in (401, 403):
                # If the error is from invalid login, tell the user
                self.logger.error(
                    "Credentials failed. Either add/update the current credentials "
                    "or remove them to enable auto auth"
                )
        elif failure.check(DNSLookupError):
            request = failure.request
            self.logger.error(u'DNSLookupError on %s', request.url)
729117
def _conditional_error(self, req, response):
        
        if not req or req.sent_headers:
            return

        try:
            req.simple_response(response)
        except errors.FatalSSLAlert:
            pass
        except errors.NoSSLError:
            self._handle_no_ssl(req)
952404
def _sign(self, certificate_request, password):
        
        if self.service.portal is None:
            raise BadCertificateRequest("This agent cannot sign certificates.")

        subj = certificate_request.getSubject()

        sk = subj.keys()
        if 'commonName' not in sk:
            raise BadCertificateRequest(
                "Certificate requested with bad subject: %s" % (sk,))

        uandd = subj.commonName.split("@")
        if len(uandd) != 2:
            raise BadCertificateRequest(
                "Won't sign certificates for other domains"
            )
        domain = uandd[1]

        CS = self.service.certificateStorage
        ourCert = CS.getPrivateCertificate(domain)

        D = self.service.portal.login(
            UsernameShadowPassword(subj.commonName, password),
            self,
            ivertex.IQ2QUser)

        def _(ial):
            (iface, aspect, logout) = ial
            ser = CS.genSerial(domain)
            return dict(certificate=aspect.signCertificateRequest(
                    certificate_request, ourCert, ser))

        return D.addCallback(_)
1195419
def _try_inject_s3_credentials(url):
    
    assert url.startswith('s3://')
    path = url[5:]
    # Check if the path already contains credentials
    tokens = path.split(':')
    # If there are two ':', its possible that we have already injected credentials
    if len(tokens) == 3:
        # Edge case: there are exactly two ':'s in the object key which is a false alarm.
        # We prevent this by checking that '/' is not in the assumed key and id.
        if ('/' not in tokens[0]) and ('/' not in tokens[1]):
            return url

    # S3 url does not contain secret key/id pair, query the environment variables
    (k, v) = _get_aws_credentials()
    return 's3://' + k + ':' + v + ':' + path
1094729
def _get_ssl_validation(self, value):
        
        return self._get_ssl_attribute(value, compatibility.SSL_CERT_MAP,
                                       ssl.CERT_NONE,
                                       'ssl_options: cert_reqs \'%s\' not '
                                       'found falling back to CERT_NONE.')
98667
def verify_signature(key, qs):
    """"""
    unsigned_qs = re.sub(r'&?sig=[^&]*', '', qs)
    sig = derive_signature(key, unsigned_qs)
    return urlparse.parse_qs(qs).get("sig", [None])[0] == sig
899038
static boolean certCanSignCrl(X509Certificate cert) {
        // if the cert doesn't include the key usage ext, or
        // the key usage ext asserts cRLSigning, return true,
        // otherwise return false.
        boolean[] keyUsage = cert.getKeyUsage();
        if (keyUsage != null) {
            return keyUsage[6];
        }
        return false;
    }
1012124
def is_ssl_error(error=None):
    """"""
    exc_types = (ssl.SSLError,)
    try:
        from OpenSSL.SSL import Error

        exc_types += (Error,)
    except ImportError:
        pass

    if error is None:
        error = sys.exc_info()[1]
    return isinstance(error, exc_types)
1148491
private static HttpResponse fail(ServiceRequestContext ctx, Throwable cause) {
        logger.trace("{} Cannot initiate SAML authentication", ctx, cause);
        return HttpResponse.of(HttpStatus.UNAUTHORIZED);
    }
1085837
def cli(env, identifier):
    """"""

    manager = SoftLayer.SSLManager(env.client)
    if not (env.skip_confirmations or formatting.no_going_back('yes')):
        raise exceptions.CLIAbort("Aborted.")

    manager.remove_certificate(identifier)
868389
def validate_ssl_certificate(self, client):
        
        response = client.request('GET', 'https://api.twilio.com:8443')

        if response.status_code < 200 or response.status_code >= 300:
            raise TwilioRestException(response.status_code, 'https://api.twilio.com:8443', 'Failed to validate SSL certificate')
67004
def is_ssl_error(error=None):
    """"""
    if error is None:
        error = sys.exc_info()[1]
    from OpenSSL import SSL
    return isinstance(error, SSL.Error)
967403
def sni_certs(self):
		
		if not g_ssl_has_server_sni or self._ssl_sni_entries is None:
			return tuple()
		return tuple(entry.certificate for entry in self._ssl_sni_entries.values())