Giter VIP home page Giter VIP logo

Comments (11)

Lukasa avatar Lukasa commented on September 17, 2024 1

I've reached out to some folks, they should be in touch.

from swift-nio-ssh.

Lukasa avatar Lukasa commented on September 17, 2024

What question about the key are you specifically trying to answer?

from swift-nio-ssh.

Lukasa avatar Lukasa commented on September 17, 2024

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.

TimNN avatar TimNN commented on September 17, 2024

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 the Equatable 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.

Lukasa avatar Lukasa commented on September 17, 2024

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.

Lukasa avatar Lukasa commented on September 17, 2024

Out of curiosity, is that a patch you'd be interested in adding?

from swift-nio-ssh.

TimNN avatar TimNN commented on September 17, 2024

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.

Lukasa avatar Lukasa commented on September 17, 2024

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.

TimNN avatar TimNN commented on September 17, 2024

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.

Junyi-99 avatar Junyi-99 commented on September 17, 2024

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.

Joannis avatar Joannis commented on September 17, 2024

@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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.