-
Notifications
You must be signed in to change notification settings - Fork 601
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
Why do I need public key for auth? #350
Comments
Can you clearly describe (including code sample) what you're trying to do
and with methods you're invoking?
2017-08-16 17:14 GMT+02:00 T3rm1 <notifications@github.com>:
… Isn't it possible to derive the public key from the private key? Why do I
need to set the public key in the KeyProvier? It would be easier to only
set the private key.
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#350>, or mute the thread
<https://github.com/notifications/unsubscribe-auth/AAHLo8ZExosaXYFcyk3b1EjqENU_CtXPks5sYwdSgaJpZM4O5Eaj>
.
|
|
@T3rm1, if you look at the methods to authenticate, there are actually multiple ways that handle this exact usecase for you...
The
As you see there are a number of methods which do all the magic for you, adn there is one that allows you to override the defaults. So I really do no see any problem or something that is missing. |
I was talking about the publickey auth mechanism. Sorry if that wasn't obvious. You named some methods suitable for that method. All of the method require that you load the public and the private key. |
I'm not so sure what you mean still. Most of the methods I mentioned (which all do public key auth) do not require you to load the public key. It will take care of that for you. Public keys are sometimes easily guessable from the private key, but this is only in specific cases. More generally, most private key encodings actually also contain the public key in an encoded format (so no need to do the mathematical guessing game). But this is not for all and always the case. |
Ok, check out this link |
The link you're referring to uses the fact that openssh private key files
contain an encoded copy of the public key. But that is not the case for all
types of keys. Just an artefact of how the openssh format works.
Op 22 aug. 2017 5:04 p.m. schreef "T3rm1" <notifications@github.com>:
… Ok, check out this link
<https://serverfault.com/questions/52285/create-a-public-ssh-key-from-the-private-key>
I have my private key in a file that is not located at the default
location. So I need to use either loadKeys(KeyPair kp) or SSHClient.authPublicKey(String
username, Iterable<KeyProvider>). Both methods require a public key! This
doesn't make sense. Why did you design these methods to require a public
key when, in reality, only the private key is really needed?
—
You are receiving this because you modified the open/close state.
Reply to this email directly, view it on GitHub
<#350 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AAHLo9kmOtxrPLjifpUqu6Q_7liAyZp_ks5sau30gaJpZM4O5Eaj>
.
|
Oh okay, I didn't know that. Since OpenSSH is the defacto standard implementation of SSH, what other kind of keys do you support? |
We support a number of key files:
But also be aware (I forgot that was possible) that you may set the second parameter of |
When I try to connect by SSH to server i can input in terminal: Using your library i want to connect to server only having |
@dixon961 You can implement a new type of Please note that htis issue was closed. If you want to raise a feature request, please submit a new issue. |
Isn't it possible to derive the public key from the private key? Why do I need to set the public key in the KeyProvier? It would be easier to only set the private key.
The text was updated successfully, but these errors were encountered: