Skip to content
This repository has been archived by the owner on Jan 7, 2023. It is now read-only.

Enable PEM files with CRLF line endings to be used #10

Closed
stephaneberle9 opened this issue Oct 2, 2020 · 1 comment
Closed

Enable PEM files with CRLF line endings to be used #10

stephaneberle9 opened this issue Oct 2, 2020 · 1 comment

Comments

@stephaneberle9
Copy link

I was trying to run go-openssl under Windows and got in trouble with the server certificate and private key files to be loaded by the openssl.ListenAndServeTLS() function. Instead of starting up normally, the server process ended immediately with the following error: No PEM certificate found in 'server.crt'. At the end, it turned out that the only problem were the CRLF line endings in the server certificate and private key files. After having changed then to LF, everything worked like a charm.

Nevertheless, this is a non-obvious pitfall making go-openssl somewhat difficult to use under Windows. It therefore would be preferable to make it happen that PEM files used regardless whether their line ending is LF or CRLF. This seems also to be a common practice for most other TLS/SSL applications and libraries.

aschmahmann added a commit that referenced this issue Oct 16, 2020
Enabled PEM files with CRLF line endings to be used (#10)
@aschmahmann
Copy link

@stephaneberle9 merged your PR, but the regex that allows for arbitrary space and hyphens seems non-spec compliant #12 which we'll try and fix up before doing a release.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants