Skip to content
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

Support for OpenSSH new key file format #279

Merged
merged 6 commits into from
Oct 31, 2016
Merged

Support for OpenSSH new key file format #279

merged 6 commits into from
Oct 31, 2016

Conversation

hierynomus
Copy link
Owner

The new format is used for ed-25519 keys.

Only support for non-encrypted keys currently.

@hierynomus
Copy link
Owner Author

@dkocher Can you test it out?

@dkocher
Copy link
Contributor

dkocher commented Oct 28, 2016

@hierynomus Will do today!

@hierynomus
Copy link
Owner Author

It's a bit later then I wanted, but it took some experimenting ;)

return readUnencrypted(privateKeyBuffer, publicKey);
} else {
logger.info("Keypair is encrypted with: " + cipherName + ", " + kdfName + ", " + kdfOptions);
throw new IOException("Cannot read encrypted keypair with " + cipherName + " yet..");
Copy link
Contributor

Choose a reason for hiding this comment

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

Double full stop.

Copy link
Contributor

Choose a reason for hiding this comment

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

What additional work is required to support encrypted keys?

Copy link
Owner Author

Choose a reason for hiding this comment

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

I have to figure out how the 'altered' bcrypt implementation works... i.e. seems non-trivial at the moment.

* Reads a key file in the new OpenSSH format.
* The format is described in the following document: https://github.com/openssh/openssh-portable/blob/master/PROTOCOL.key
*/
public class OpenSSHKeyV1KeyFile extends BaseFileKeyProvider {
Copy link
Contributor

Choose a reason for hiding this comment

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

The class name is somewhat uneloquent.

Copy link
Owner Author

Choose a reason for hiding this comment

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

Suggestion for a better one?

@dkocher
Copy link
Contributor

dkocher commented Oct 28, 2016

I have tested this with a private key of mine and it works as advertised.

@hierynomus
Copy link
Owner Author

Yay! If you can think of a better class name I'll rename it. Else I'll leave that for a moment.

Going through this code again, it could use a lot of cleanup. I want to split off the keyfile format from the keytype stored in there. Will do that separately though.

@hierynomus hierynomus merged commit d95b4db into master Oct 31, 2016
@hierynomus hierynomus deleted the issue-276 branch November 23, 2016 11:24
@rasantel
Copy link
Contributor

When I pass a non-null public key to SSHClient.loadKeys and the private key is of this OpenSSH V1 type, I get an assertion error at BaseFileKeyProvider.init(String privateKey, String publicKey). Is that by design, or is it a bug?

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.

3 participants