support generic pem format#58
Closed
Khushalijp wants to merge 3 commits into
Closed
Conversation
Contributor
There was a problem hiding this comment.
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_formatto 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 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)) |
…newlines Agent-Logs-Url: https://github.com/mdsol/mauth-client-python/sessions/ab575d3d-0d12-451b-847e-81a6c2b696e2 Co-authored-by: Khushalijp <105746972+Khushalijp@users.noreply.github.com>
mpmeyer
approved these changes
May 21, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.