Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Had some trouble using sign_key with a PEM encode public key. #91

Open
bartvanhoutte opened this issue Mar 10, 2025 · 2 comments
Open

Comments

@bartvanhoutte
Copy link

bartvanhoutte commented Mar 10, 2025

Have been using double quotes for multiline values and got an error saying my key was an invalid PEM key.
I think the issue was tabs (\t) being inserted by the editor. Removing the \t on each line so the first letter hugs the left side of your editor without whitespace seemed to solve the issue.

Maybe remove all whitespace from the key before parsing it? Somewhere around here?

if len(signKey) == 0 {

@ggicci
Copy link
Owner

ggicci commented Mar 12, 2025

Thanks for the report :) However, I don’t think this should be handled by the plugin itself. The issue arises because the plugin expects a valid PEM, but the user-provided input is invalid due to extra whitespace inserted within the data.


I would not recommend implementing the tricks here. As the logic is already super clear and clean -- it expects a PEM and as long as the given data is not PEM due to any reason, it throws an error.

@bartvanhoutte
Copy link
Author

Well, following your own logic you could delete line 516 as well ;)

I have no particular investment in this so feel free to ignore my opinion but removing whitespace would'nt have any impact on runtime performance as the PEM is validated on startup (this is right, right?) but would make the software more robust to use.

The alternative - aside from not changing anything - could be to add a remark in the FAQ in the README.md but I don't quite feel this is a good developer experience.

Thanks for your quick response!

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

No branches or pull requests

2 participants