apple / apple/swift-nio-ssh

Support OpenSSH Keys

Open
#66 4 comments 3 reactions 0 assignees View on GitHub
kind/enhancement
Dominant language
Swift
Stars
517
Forks
88
PR merge metrics
No merged PRs in 30d

Description

As I use SwiftNIO SSH, I need to provide the ability for my users to employ their existing private keys to connect to a remote host. As has been well-documented, SwiftCrypto lacks the ability to decrypt such keys when generated by OpenSSH.

Quoth @Lukasa in the Slack:

"If the user’s OpenSSH private key is passphrase protected then we cannot handle them in-tree at all. Because the way those keys are encrypted does not allow us to decrypt them with the APIs Swift Crypto provides. This is a ripe opportunity for someone to write a third-party extension to the library to handle this use-case."

This proposed extension to SwiftNIO SSH should solve two orthogonal problems:

* Support RSA, which appears to be partially solved by @Joannis' PR: https://github.com/apple/swift-nio-ssh/pull/62
* Support ECDSA and ed25519 keys, by implementing a package that can parse the key format into the appropriate raw Swift Crypto format. "Basically, anything that does have access to an AES-CBC algorithm could do this. You can construct an SSH key from, say, a P256.Signing.PrivateKey object, and that ultimately can be derived from the OpenSSH private key format," writes @Lukasa.

Contributor guide

Open the contributing guide

Research direction

Start by reviewing the issue’s proposed RSA, ECDSA, and ed25519 support and the linked pull request #62, then inspect how SwiftNIO SSH currently handles private keys and how SwiftCrypto represents them. Done means the supported OpenSSH key formats can be parsed into the appropriate Swift Crypto key types, while noting the stated limitation around passphrase-protected keys.

Written by the indexing model from the issue text.

Assessment

Tech stack
swift
Domain
authentication, security
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.