FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

Remove any combination of CR/LF line endings when reading private key by jeecha · Pull Request #105 · Mastercard/client-encryption-java · GitHub

Remove any combination of CR/LF line endings when reading private key - #105

Merged
danny-gallagher merged 1 commit into
Mastercard:mainfrom
jeecha:patch-1
Nov 28, 2024
Merged

Remove any combination of CR/LF line endings when reading private key#105
danny-gallagher merged 1 commit into
Mastercard:mainfrom
jeecha:patch-1

Conversation

jeecha commented Nov 26, 2024
edited
Loading

Copy link
Copy Markdown
Contributor

Link to issue/feature request: #104

Description

RFC 7468 permits LF, CR or CRLF line endings in PEM files.

Current code first removes LF (\n) and then tries to remove CRLF (\r\n), so the CR (\n) characters are left in the file and key Base64 cannot be decoded. Because of this private key files generated/saved on Windows with CRLF line endings cannot be loaded into library.

The updated code handles CR and LF separately, so any combination of these characters will get removed from PEM data.

… from PEM

RFC 7468 permits LF, CR or CRLF line endings in PEM files.

Current code first removes LF (\n) and then tries to remove CRLF (\r\n), so the CR (\n) characters are left in the file and key Base64 cannot be decoded. Because of this private key files generated/saved on Windows with CRLF line endings cannot be loaded into library.
danny-gallagher added the safe The PR has been reviewed by Mastercard and has been validated to be safe label Nov 28, 2024
danny-gallagher self-requested a review November 28, 2024 11:23

Copy link
Copy Markdown
Contributor

LGTM 🚀

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

Labels

safe The PR has been reviewed by Mastercard and has been validated to be safe

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants


Back | FazBrowse Home | New Git URL