Skip to content

Support single-line PEM encoded RSA keys in RsaKeyConverters#18599

Merged
jzheaux merged 1 commit intospring-projects:mainfrom
earlgrey02:support-single-line-rsa-key
Feb 18, 2026
Merged

Support single-line PEM encoded RSA keys in RsaKeyConverters#18599
jzheaux merged 1 commit intospring-projects:mainfrom
earlgrey02:support-single-line-rsa-key

Conversation

@earlgrey02
Copy link
Copy Markdown
Contributor

RsaKeyConverters currently assumes that PEM-encoded RSA keys are provided in a multi-line format, where the PEM header, footer, and Base64-encoded content are separated across multiple lines.
However, in environment variable–based configurations (ex. .env files), PEM keys are commonly stored as single-line strings, with newline characters removed or escaped.

Examples:

  • -----BEGIN PUBLIC KEY-----MIIBIjANBgkq...IDAQAB-----END PUBLIC KEY-----
  • -----BEGIN PUBLIC KEY-----\nMIIBIjANBgkq...IDAQAB\n-----END PUBLIC KEY-----

While these representations are functionally equivalent to the traditional multi-line PEM format, they are currently not supported by RsaKeyConverters and result in conversion failures.
Therefore, this PR improves RsaKeyConverters to correctly handle single-line RSA keys while preserving the existing conversion structure.

Signed-off-by: earlgrey02 <san06036@naver.com>
@earlgrey02 earlgrey02 force-pushed the support-single-line-rsa-key branch from 2ab3976 to 93761f8 Compare January 27, 2026 08:54
@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged label Jan 27, 2026
@jzheaux jzheaux self-assigned this Feb 18, 2026
@jzheaux jzheaux added in: core An issue in spring-security-core type: enhancement A general enhancement and removed status: waiting-for-triage An issue we've not yet triaged labels Feb 18, 2026
@jzheaux jzheaux modified the milestone: 7.1.0-M3 Feb 18, 2026
@jzheaux jzheaux merged commit 5194826 into spring-projects:main Feb 18, 2026
6 checks passed
@jzheaux
Copy link
Copy Markdown
Contributor

jzheaux commented Feb 18, 2026

Thanks, @earlgrey02! This is now merged into main.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

in: core An issue in spring-security-core type: enhancement A general enhancement

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants