Thanks to visit codestin.com
Credit goes to github.com

Skip to content
This repository was archived by the owner on Jan 18, 2025. It is now read-only.
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 5 additions & 7 deletions oauth2client/service_account.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,16 +75,14 @@ def _generate_assertion(self):
}
payload.update(self._kwargs)

assertion_input = '%s.%s' % (
_urlsafe_b64encode(header),
_urlsafe_b64encode(payload))
assertion_input = assertion_input.encode('utf-8')
assertion_input = (_urlsafe_b64encode(header) + b'.' +
_urlsafe_b64encode(payload))

# Sign the assertion.
signature = bytes.decode(base64.urlsafe_b64encode(rsa.pkcs1.sign(
assertion_input, self._private_key, 'SHA-256'))).rstrip('=')
rsa_bytes = rsa.pkcs1.sign(assertion_input, self._private_key, 'SHA-256')
signature = base64.urlsafe_b64encode(rsa_bytes).rstrip(b'=')

return '%s.%s' % (assertion_input, signature)
return assertion_input + b'.' + signature

def sign_blob(self, blob):
# Ensure that it is bytes
Expand Down