Comments (11)
I've reached out to some folks, they should be in touch.
from swift-nio-ssh.
What question about the key are you specifically trying to answer?
from swift-nio-ssh.
I ask because we're being very tentative with exposing up API on these types. We can definitely add more, but the first question is whether what we have will work. One thing you can do, for example, is load the key you expect to see into a NIOSSHPublicKey
and then use the Equatable
conformance to check if they're equal.
from swift-nio-ssh.
What question about the key are you specifically trying to answer?
Whether it is a known / expected key.
One thing you can do, for example, is load the key you expect to see into a
NIOSSHPublicKey
and then use theEquatable
conformance to check if they're equal.
I didn't think of that solution, but it would solve part of my problem, thanks!
Though I don't think this would allow me to implement a behavior similar to e.g. OpenSSH, where a public (host) key is accepted (and stored) when it is first encountered (because, as far I could tell, there is not API to serialize an NIOSSHPublicKey
).
Or would it be recommended to use the Hashable
conformance (with an appropriate Hasher
) for this feature? Is the Hashable
implementation guaranteed to be stable across versions / platforms?
because we're being very tentative with exposing up API on these types
That sounds like a very sensible approach :). What about exposing the opposite of init(openSSHPublicKey: String)
, i.e. a method to serialize the key back to an OpenSSH public key? That might be desirable in any case for interoperability.
from swift-nio-ssh.
Or would it be recommended to use the Hashable conformance (with an appropriate Hasher) for this feature? Is the Hashable implementation guaranteed to be stable across versions / platforms?
Nope, Hashable is not even stable across invocations from the same process.
For your specific solution, yes, we could add OpenSSH public key serialisation. That's likely to be the best solution, not least because the OpenSSH public key serialisation format is basically the same as the wire format.
from swift-nio-ssh.
Out of curiosity, is that a patch you'd be interested in adding?
from swift-nio-ssh.
Out of curiosity, is that a patch you'd be interested in adding?
Yes, assuming that there's agreement that this is the way to go (i.e. the patch is likely to be accepted if it is of sufficient quality).
(Though I'll have to jump through some hoops to get the contribution approved - I'll see how that goes and will update this issue in a week at the latest).
from swift-nio-ssh.
Yes, I believe this is a reasonable API, and a sufficiently high quality patch would be merged. In general I'm in favour of patches that add minimal API surface, and so a simple inverse function would be fantastic. I suspect we want to handle this as an extension on String
.
Let me know if the contribution boundaries get too high, I may be able to put you in touch with some Googlers who might be able to help.
from swift-nio-ssh.
I may be able to put you in touch with some Googlers who might be able to help.
Thank you for the offer. Since there's been little progress on getting the contributions approved, I would like to take you up on it. You can find my personal email on my profile. My work email is <my GitHub username>@google.com
.
from swift-nio-ssh.
What about exposing the opposite of init(openSSHPublicKey: String), i.e. a method to serialize the key back to an OpenSSH public key? That might be desirable in any case for interoperability.
I'm currently working on developing a SSH tools for iOS, and I don't know how to get the exact information of the public key. But I think it is a good idea to serialize the bey back to a public key.
from swift-nio-ssh.
@Military-Doctor the OpenSSH format for public & private keys is agnostic to the type of public key. So while the format could by representing a type known to CryptoKit & NIOSSH, this is not necessarily the case. A good example is RSA based keys, which NIOSSH does not (intend to) support.
from swift-nio-ssh.
Related Issues (20)
- Setup API breakage testing
- Simple SSH Client port forwarding HOT 4
- Cleanup once NIO adopts Sendable HOT 3
- NIOSSHError.keyExchangeNegotiationFailure HOT 4
- Support keyboard-interactive authentication HOT 3
- iOS: upload file to sshd server HOT 1
- Crash in `SSHChildChannel` HOT 4
- Authentication Failed using Private Key,Public Key HOT 15
- ChannelError: operationUnsupported when executing commands from a daemon HOT 5
- Error when adding swift-nio-ssh HOT 3
- NIOSSHClientUserAuthenticationDelegate Improvement Request: Result Reporting HOT 2
- Support OpenSSH Keys HOT 4
- Client remote port forwarding? HOT 2
- Clients should tolerate arbitrary lines before SSH version in banner
- How to use Swift Nio SSH? HOT 3
- NIOSSHClient gets stucked HOT 12
- Channel closes after 1 command / Executing multiple requests on the same channel HOT 10
- NIOSSHPrivateKey from file/bytes HOT 2
- Child channels can not access their own peerMaxMessageSize HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from swift-nio-ssh.