[GH-ISSUE #759] RSA key check fails if header is -----BEGIN PRIVATE KEY----- #643

Closed
opened 2026-02-26 06:33:48 +03:00 by kerem · 7 comments
Owner

Originally created by @gparmeggiani on GitHub (Dec 5, 2020).
Original GitHub issue: https://github.com/NginxProxyManager/nginx-proxy-manager/issues/759

Hi,
I'm using Nginx Proxy Manager version 2.7.1 (latest pulled from dockerhub)

When uploading a custom SSL certificate an error occurs if the private key has the -----BEGIN PRIVATE KEY----- instead of the -----BEGIN RSA PRIVATE KEY-----

By looking at the code, the following line in certificate.js is responsible for the error
let key_type = private_key.includes('-----BEGIN RSA') ? 'rsa' : 'ec';
This causes the check to fail because the key is interpreted as ec instead of rsa.
I tried to manually run the openssl check command with my key and I get the expected result: RSA key ok

Originally created by @gparmeggiani on GitHub (Dec 5, 2020). Original GitHub issue: https://github.com/NginxProxyManager/nginx-proxy-manager/issues/759 Hi, I'm using Nginx Proxy Manager version 2.7.1 (latest pulled from dockerhub) When uploading a custom SSL certificate an error occurs if the private key has the `-----BEGIN PRIVATE KEY-----` instead of the `-----BEGIN RSA PRIVATE KEY-----` By looking at the code, the following line in `certificate.js` is responsible for the error `let key_type = private_key.includes('-----BEGIN RSA') ? 'rsa' : 'ec';` This causes the check to fail because the key is interpreted as ec instead of rsa. I tried to manually run the openssl check command with my key and I get the expected result: RSA key ok
kerem 2026-02-26 06:33:48 +03:00
  • closed this issue
  • added the
    bug
    label
Author
Owner

@BobWs commented on GitHub (Dec 12, 2020):

will this fixed in the next update? I also facing the same problem, had to reverted backup to version jlesage/nginx-proxy-manager:v1.10.2

<!-- gh-comment-id:743787326 --> @BobWs commented on GitHub (Dec 12, 2020): will this fixed in the next update? I also facing the same problem, had to reverted backup to version jlesage/nginx-proxy-manager:v1.10.2
Author
Owner

@tbringuier commented on GitHub (Dec 12, 2020):

For now, you can just replace with -----BEGIN RSA PRIVATE KEY----- but yeah, can u update docker image ? :(

<!-- gh-comment-id:743841378 --> @tbringuier commented on GitHub (Dec 12, 2020): For now, you can just replace with `-----BEGIN RSA PRIVATE KEY-----` but yeah, can u update docker image ? :(
Author
Owner

@BobWs commented on GitHub (Dec 14, 2020):

For now, you can just replace with -----BEGIN RSA PRIVATE KEY----- but yeah, can u update docker image ? :(

Where and What do I need to replace with? I'm sorry but it is not totally clear to me

<!-- gh-comment-id:744256869 --> @BobWs commented on GitHub (Dec 14, 2020): > For now, you can just replace with `-----BEGIN RSA PRIVATE KEY-----` but yeah, can u update docker image ? :( Where and What do I need to replace with? I'm sorry but it is not totally clear to me
Author
Owner

@gparmeggiani commented on GitHub (Dec 14, 2020):

Just open the private key you are trying to upload with a text editor and edit the header text so that it reads -----BEGIN RSA PRIVATE KEY-----. You might need to update the footer text too

<!-- gh-comment-id:744342471 --> @gparmeggiani commented on GitHub (Dec 14, 2020): Just open the private key you are trying to upload with a text editor and edit the header text so that it reads `-----BEGIN RSA PRIVATE KEY-----`. You might need to update the footer text too
Author
Owner

@BobWs commented on GitHub (Dec 14, 2020):

Just open the private key you are trying to upload with a text editor and edit the header text so that it reads -----BEGIN RSA PRIVATE KEY-----. You might need to update the footer text too

Thanks for explaining. It worked! Hopefully it will be fix soon.

<!-- gh-comment-id:744386663 --> @BobWs commented on GitHub (Dec 14, 2020): > Just open the private key you are trying to upload with a text editor and edit the header text so that it reads `-----BEGIN RSA PRIVATE KEY-----`. You might need to update the footer text too Thanks for explaining. It worked! Hopefully it will be fix soon.
Author
Owner

@chaptergy commented on GitHub (Dec 14, 2020):

Could you please check whether the issue still persists in this new pull request?
Use image jc21/nginx-proxy-manager:github-pr-774 for this. Just change the tag from :latest to :github-pr-774 in your docker-compose file.

<!-- gh-comment-id:744403354 --> @chaptergy commented on GitHub (Dec 14, 2020): Could you please check whether the issue still persists in this new pull request? Use image `jc21/nginx-proxy-manager:github-pr-774` for this. Just change the tag from `:latest` to `:github-pr-774` in your docker-compose file.
Author
Owner

@goncaloGIT commented on GitHub (Dec 22, 2020):

This image ( jc21/nginx-proxy-manager:github-pr-774 ) worked for me , thank you

<!-- gh-comment-id:749714805 --> @goncaloGIT commented on GitHub (Dec 22, 2020): This image ( jc21/nginx-proxy-manager:github-pr-774 ) worked for me , thank you
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/nginx-proxy-manager-NginxProxyManager#643
No description provided.