Skip to content

Added passphrase to _libssh2_pem_parse_memory - #1746

Merged
willco007 merged 5 commits into
libssh2:masterfrom
LarsNordin-LNdata:handle-passphrase-in-pem_parse_memory-and-WinCNG-fixes
Apr 6, 2026
Merged

willco007 merged 5 commits into
libssh2:masterfrom
LarsNordin-LNdata:handle-passphrase-in-pem_parse_memory-and-WinCNG-fixes

Conversation

@LarsNordin-LNdata

@LarsNordin-LNdata LarsNordin-LNdata commented Nov 27, 2025 •

Copy link
Copy Markdown
Contributor

Added passphrase to libssh2_pem_parse_memory() and made _libssh2_pem_parse() call this function. Added two error's when algoritm not supported or MD5 not supported during PEM parse Updated wincng.h to enable MD5

This resolves issue #1047

Added passphrase to libssh2_pem_parse_memory() and made _libssh2_pem_parse() call  this function.
Added two error's when algoritm not suuported or MD5 not supported during PEM parse
Updated wincng.h to enable MD5
@willco007

Copy link
Copy Markdown
Member

@LarsNordin-LNdata It looks like this resolves #1047, is that right? Could you pull this up to master, thanks again.

@LarsNordin-LNdata

Copy link
Copy Markdown
Contributor Author

Yes it fixes #1047, my comment was not including this info...

Byt can I pull up to libssh2:master?

@willco007

Copy link
Copy Markdown
Member

This is now conflicting which needs to be resolved before it can be merged.

@willco007
willco007 merged commit 141b035 into libssh2:master Apr 6, 2026
82 checks passed
willco007 added a commit to willco007/libssh2 that referenced this pull request Apr 7, 2026
Notes:
Adds passphrase support to _libssh2_pem_parse_memory() and made
_libssh2_pem_parse() call this function. Added two errors when the pem algorithm is
not supported or MD5 is not supported during PEM parsing.  Updated wincng.h to
enable MD5.

This resolves issue libssh2#1047

---------
Credit:
Lars Nordin

Co-authored-by: Will Cosgrove <[email protected]>
vszakats added a commit that referenced this pull request Apr 8, 2026
vszakats added a commit to vszakats/libssh2 that referenced this pull request Apr 8, 2026
vszakats added a commit that referenced this pull request Apr 8, 2026
willco007 pushed a commit that referenced this pull request Apr 10, 2026
@vszakats vszakats mentioned this pull request Apr 30, 2026
vszakats added a commit that referenced this pull request Apr 30, 2026
- add missing `break;`s in `parse_rc2()` switch statement.
  Ref: https://www.rfc-editor.org/rfc/rfc8018
- add `passphrase` arg to `_libssh2_pem_parse_memory` calls where
  missing.
  Follow-up to 141b035 #1746
- fix `secretbuf` allocated size in `_libssh2_os400qc3_dh_secret()`.
- add missing space.

Spotted by GitHub Code Quality

Closes #1901
vszakats added a commit that referenced this pull request Jun 11, 2026
- fix to not skip character after lines longer than 128 bytes.
  Reported by GitHub Code Quality

- swallow newline characters at the end of the line.

- fix infinite loop with certain inputs.
  Make the function return error if the whole input has been consumed
  (vs. always success before this patch).
  Also drop a recently added `*line` check in favor of the above.
  Reported-by: afldl on github
  Fixes #2013
  Follow-up to 141b035 #1746

Remaining differences noted in `readline()` (not touched in this PR):
- it returns newline characters in `line` in cases.
  E.g. with input `"abcdefghijklmno\rpqrstuvwxyz01234567890"`
- it does not empty the return buffer on EOF.

Closes #2032
willco007 added a commit that referenced this pull request Jun 29, 2026
Remove line clearing null termination that was introduced as a regression in #1746. Fixes #2130.

Credit: [Michael](https://github.com/R6502)
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

Successfully merging this pull request may close these issues.

2 participants