Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix GA_KEY_CONTENT OpenSSL crypto error #44

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

kleberbaum
Copy link

Checklist:

  • Have you added an explanation of what your changes do and why you'd like them to be included?
  • Have you updated or added documentation for the change?
  • Have you tested your changes with successful results?

Type of Changes:

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

What is the current behavior? (link to any open issues here)

What is the new behavior (if this is a feature change)?

Other information:
I wasn't able to get it working without my fix.

OpenSSL.crypto.load_privatekey can't detect start line due to a
str.replace() for '\n' and '\r'.
json.loads() can't handle '\n' and '\r' cause it thinks they are
control character.
Therefore '\n' and '\r' have to be double escape rather than deleted.
OpenSSL.crypto.load_privatekey() can't handle '\r' either,
so a private_key with '\r' wouldn't work anyway. ¯\_(ツ)_/¯

Error:
OpenSSL.crypto.Error: [('PEM routines', 'get_name', 'no start line')]

Ref:
tomdyson#25
https://stackoverflow.com/a/45571017
cspollar added a commit to CCITatBCM/wagalytics that referenced this pull request Jun 29, 2020
@diogosilva30
Copy link

diogosilva30 commented Oct 2, 2021

When will this be merged?

EDIT:
Actually I tested your proposed changes, and they don't seem to work.
However adding the following seems to work:

# Construct a credentials objects from the key data and OAuth2 scope.
keyDict = json.loads(ga_key_content, strict=False)

Source: https://stackoverflow.com/a/29827074/11122248

diogosilva30 added a commit to diogosilva30/wagalytics that referenced this pull request Oct 2, 2021
Forked because original maintainer is not review pull requests
This is the change proposed in:
tomdyson#44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Error: [('PEM routines', 'PEM_read_bio', 'no start line')]
2 participants