Skip to content

userauth: enable [email protected] for all backends in userauth_supported_key_sign_algs(), fix tests - #2483

Closed
vszakats wants to merge 12 commits into
libssh2:masterfrom
vszakats:tsign
Closed

vszakats wants to merge 12 commits into
libssh2:masterfrom
vszakats:tsign

Conversation

@vszakats

@vszakats vszakats commented Aug 2, 2026 •

Copy link
Copy Markdown
Member

The PR implementing this did not add anything OpenSSL-specific, yet it
gated the feature OpenSSL only. Turns out the reason for this is that
the test RSA keys are in OpenSSH format, which is only supported by
OpenSSL (and wolfSSL) in libssh2.

Fix by converting the two test keys to PEM format, making them
compatible with all backends. (RSA OpenSSH key format is already tested
separately.)

Also: this also fixes outdated comment fields present in these keys.

Bug: #1314 (comment)
Ref: #2252 (initial fix attempt)
Follow-up to 1410efa #2249
Follow-up to 3a6ab70 #1314


  • perhaps a better solution is to use the compatible (PEM) key format in
    the first place in these tests. RSA OpenSSH is tested separately anyway.

vszakats added a commit that referenced this pull request Aug 2, 2026
vszakats added a commit that referenced this pull request Aug 2, 2026
To make it easier to run tests locally, in particular those using signed
keys, with the username embedded in them.

Cherry-picked from #2483
vszakats added a commit that referenced this pull request Aug 2, 2026
Via env `FIXTURE_USER`.

To make it easier to run tests locally, in particular those using signed
keys, with the username embedded in them.

Cherry-picked from #2483

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR removes the OpenSSL-only gating for [email protected] in userauth_supported_key_sign_algs() so RSA certificate authentication can use RFC 8332 signature-algorithm upgrading consistently across crypto backends, and updates the test fixtures to avoid relying on OpenSSH private-key formats where they aren’t supported.

Changes:

  • Enable [email protected] in userauth_supported_key_sign_algs() for all backends when LIBSSH2_RSA_SHA2 is available.
  • Update RSA cert-auth tests to use PEM-formatted private keys for non-OpenSSL/non-wolfSSL backends.
  • Add new PEM private key fixtures and update the key-generation script to produce them.

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
src/userauth.c Removes OpenSSL/wolfSSL-only gating so RSA cert key methods participate in supported signing algorithm upgrades across backends.
tests/test_auth_pubkey_ok_rsa_signed.c Switches fixture private key path based on backend to use PEM where needed.
tests/test_auth_pubkey_ok_rsa_sha2_512_signed.c Switches fixture private key path based on backend to use PEM where needed.
tests/keys/id_rsa_signed_pem Adds PEM-formatted RSA private key fixture for non-OpenSSL/non-wolfSSL backends.
tests/keys/id_rsa_sha2_512_signed_pem Adds PEM-formatted RSA private key fixture for non-OpenSSL/non-wolfSSL backends.
tests/keys-generate.sh Generates the new PEM private key fixtures from existing keys.
Suppressed comments (1)

tests/keys-generate.sh:48

  • Same as above: this ssh-keygen -p invocation omits -P (old passphrase), which can trigger an interactive prompt. Add -P '' so key conversion to PEM is reliably non-interactive.
ssh-keygen -p                 -N ''          -m PEM                                     -f 'keys/id_rsa_sha2_512_signed_pem'

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread tests/keys-generate.sh Resolved
Comment thread tests/test_auth_pubkey_ok_rsa_signed.c Resolved

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 6 out of 6 changed files in this pull request and generated no new comments.

@vszakats vszakats closed this in 88dd2f0 Aug 2, 2026
@vszakats
vszakats deleted the tsign branch August 2, 2026 16:47
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