Skip to content

Commit

Permalink
Use urllib3's DEFAULT_CIPHER without blocking required cipher.
Browse files Browse the repository at this point in the history
  • Loading branch information
jkuebart committed Feb 8, 2021
1 parent b8252d2 commit 7b9fecf
Showing 1 changed file with 6 additions and 15 deletions.
21 changes: 6 additions & 15 deletions gpsoauth/__init__.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import requests
import ssl
from urllib3.poolmanager import PoolManager
from urllib3.util.ssl_ import DEFAULT_CIPHERS

from ._version import __version__
from . import google
Expand All @@ -18,22 +19,12 @@
auth_url = 'https://android.clients.google.com/auth'
useragent = 'gpsoauth/' + __version__

# Certain ciphers cause Google to return 403 Bad Authentication.
# Blocking AESCCM in urllib3 > 1.26.3 causes Google to return 403 Bad
# Authentication.
CIPHERS = ":".join(
[
"ECDHE+AESGCM",
"ECDHE+CHACHA20",
"DHE+AESGCM",
"DHE+CHACHA20",
"ECDH+AES",
"DH+AES",
"RSA+AESGCM",
"RSA+AES",
"!aNULL",
"!eNULL",
"!MD5",
"!DSS",
]
cipher
for cipher in DEFAULT_CIPHERS.split(":")
if cipher != "!AESCCM"
)

class SSLContext(ssl.SSLContext):
Expand Down

0 comments on commit 7b9fecf

Please sign in to comment.