ssl_
assert_fingerprint(cert, fingerprint)
Checks if given fingerprint matches the supplied certificate.
:param cert: Certificate as bytes object. :param fingerprint: Fingerprint as string of hexdigits, can be interspersed by colons.
Source code in client/ayon_fusion/vendor/urllib3/util/ssl_.py
182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 |
|
create_urllib3_context(ssl_version=None, cert_reqs=None, options=None, ciphers=None)
All arguments have the same meaning as ssl_wrap_socket
.
By default, this function does a lot of the same work that ssl.create_default_context
does on Python 3.4+. It:
- Disables SSLv2, SSLv3, and compression
- Sets a restricted set of server ciphers
If you wish to enable SSLv3, you can do::
from urllib3.util import ssl_
context = ssl_.create_urllib3_context()
context.options &= ~ssl_.OP_NO_SSLv3
You can do the same to enable compression (substituting COMPRESSION
for SSLv3
in the last line above).
:param ssl_version: The desired protocol version to use. This will default to PROTOCOL_SSLv23 which will negotiate the highest protocol that both the server and your installation of OpenSSL support. :param cert_reqs: Whether to require the certificate verification. This defaults to ssl.CERT_REQUIRED
. :param options: Specific OpenSSL options. These default to ssl.OP_NO_SSLv2
, ssl.OP_NO_SSLv3
, ssl.OP_NO_COMPRESSION
, and ssl.OP_NO_TICKET
. :param ciphers: Which cipher suites to allow the server to select. :returns: Constructed SSLContext object with specified options :rtype: SSLContext
Source code in client/ayon_fusion/vendor/urllib3/util/ssl_.py
250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 |
|
is_ipaddress(hostname)
Detects whether the hostname given is an IPv4 or IPv6 address. Also detects IPv6 addresses with Zone IDs.
:param str hostname: Hostname to examine. :return: True if the hostname is an IP address, False otherwise.
Source code in client/ayon_fusion/vendor/urllib3/util/ssl_.py
457 458 459 460 461 462 463 464 465 466 467 |
|
resolve_cert_reqs(candidate)
Resolves the argument to a numeric constant, which can be passed to the wrap_socket function/method from the ssl module. Defaults to :data:ssl.CERT_REQUIRED
. If given a string it is assumed to be the name of the constant in the :mod:ssl
module or its abbreviation. (So you can specify REQUIRED
instead of CERT_REQUIRED
. If it's neither None
nor a string we assume it is already the numeric constant which can directly be passed to wrap_socket.
Source code in client/ayon_fusion/vendor/urllib3/util/ssl_.py
211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 |
|
resolve_ssl_version(candidate)
like resolve_cert_reqs
Source code in client/ayon_fusion/vendor/urllib3/util/ssl_.py
234 235 236 237 238 239 240 241 242 243 244 245 246 247 |
|
ssl_wrap_socket(sock, keyfile=None, certfile=None, cert_reqs=None, ca_certs=None, server_hostname=None, ssl_version=None, ciphers=None, ssl_context=None, ca_cert_dir=None, key_password=None, ca_cert_data=None, tls_in_tls=False)
All arguments except for server_hostname, ssl_context, and ca_cert_dir have the same meaning as they do when using :func:ssl.wrap_socket
.
:param server_hostname: When SNI is supported, the expected hostname of the certificate :param ssl_context: A pre-made :class:SSLContext
object. If none is provided, one will be created using :func:create_urllib3_context
. :param ciphers: A string of ciphers we wish the client to support. :param ca_cert_dir: A directory containing CA certificates in multiple separate files, as supported by OpenSSL's -CApath flag or the capath argument to SSLContext.load_verify_locations(). :param key_password: Optional password if the keyfile is encrypted. :param ca_cert_data: Optional string containing CA certificates in PEM format suitable for passing as the cadata parameter to SSLContext.load_verify_locations() :param tls_in_tls: Use SSLTransport to wrap the existing socket.
Source code in client/ayon_fusion/vendor/urllib3/util/ssl_.py
355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 |
|