Skip to content

When adding an identity, validate that private key and public key (or… - #1168

Open
AlainKnaff wants to merge 8 commits into
mwiede:masterfrom
AlainKnaff:certificate-pubkey
Open

AlainKnaff wants to merge 8 commits into
mwiede:masterfrom
AlainKnaff:certificate-pubkey

Conversation

@AlainKnaff

Copy link
Copy Markdown

this addresses issue #1161 by verifying that private key and public key (or certificate) actually match each other when adding an identity. This way, applications can warn the user right away when he's trying to add the bad certificate file, or a file that is not actually a certificate at all.

… certificate) match, and that public key is actually a public key (or certificate)

@norrisjeremy norrisjeremy left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

  1. Can you please run mvn formatter:format to correctly format the code changes?
  2. Can you add some unit tests to properly exercise this, making sure to cover plain SSH keys & SSH certificates, and making sure to cover both cases in which the keys match and don't match?

Comment thread src/main/java/com/jcraft/jsch/IdentityFile.java Outdated
Comment thread src/main/java/com/jcraft/jsch/OpenSshCertificateAwareIdentityFile.java Outdated
Comment thread src/main/java/com/jcraft/jsch/OpenSshCertificateAwareIdentityFile.java Outdated
Comment thread src/main/java/com/jcraft/jsch/IdentityFile.java
Alain Knaff added 5 commits September 30, 2026 22:36
@sonarqubecloud

sonarqubecloud Bot commented Oct 1, 2026

Copy link
Copy Markdown

This branch has not been deployed

No deployments
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