Skip to content

support generic pem format#58

Closed
Khushalijp wants to merge 3 commits into
mainfrom
fix/support-generic-pem-format
Closed

support generic pem format#58
Khushalijp wants to merge 3 commits into
mainfrom
fix/support-generic-pem-format

Conversation

@Khushalijp
Copy link
Copy Markdown

No description provided.

@Khushalijp Khushalijp marked this pull request as ready for review May 21, 2026 21:29
Copilot AI review requested due to automatic review settings May 21, 2026 21:29
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Updates the key-formatting utility to accept and normalize more generic PEM boundary labels (instead of only RSA PRIVATE KEY), improving compatibility with different private-key PEM encodings used via environment configuration.

Changes:

  • Replaced hard-coded RSA PEM header/footer constants with a regex that detects generic PEM BEGIN/END boundaries.
  • Updated to_rsa_format to preserve already-newlined PEM inputs and to reconstruct headers/footers dynamically when boundaries are present.
  • Kept an RSA-private-key fallback when no PEM boundaries are detected.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread mauth_client/utils.py
Comment thread mauth_client/utils.py
Comment on lines 61 to +65
if " " in body or "\t" in body:
body = re.sub(r'\s+', '\n', body)
body = re.sub(r"\s+", "\n", body)
else:
# PEM-encoded keys are typically split into lines of 64 characters as per RFC 7468 (section 2)
body = '\n'.join(body[i:i + 64] for i in range(0, len(body), 64))
body = "\n".join(body[i : i + 64] for i in range(0, len(body), 64))
@Khushalijp Khushalijp closed this May 22, 2026
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.

4 participants