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

Implement certified public key client auth #64

Merged

Conversation

artemredkin
Copy link
Contributor

Motivation:
Right now there is no way to use certified public keys for user auth.

Modifications:

  1. Adds new init to PrivateKey
  2. Updates UserAuthRequestMessage to support public key
  3. Adds a test

Result:
Closes #63

@artemredkin artemredkin force-pushed the implement_certified_key_in_client_auth branch from ada5843 to 2d79e4d Compare January 13, 2021 13:06
@artemredkin artemredkin force-pushed the implement_certified_key_in_client_auth branch 2 times, most recently from 140b8cd to 2cf4d21 Compare January 13, 2021 13:22
XCTAssertNoThrow(try self.beginAuthentication(stateMachine: &stateMachine))
stateMachine.sendServiceRequest(.init(service: "ssh-userauth"))

let dataToSign = UserAuthSignablePayload(sessionIdentifier: self.sessionID, userName: "foo", serviceName: "ssh-connection", publicKey: delegate.key.publicKey)
Copy link
Collaborator

Choose a reason for hiding this comment

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

This doesn't look like it'll compile. Is there a key member on InfinitePrivateKey delegate?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'm using the wrong delegate type 🤦🏻‍♂️ give me a minute

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed!

@@ -720,4 +730,27 @@ final class UserAuthenticationStateMachineTests: XCTestCase {
// Let's say we got a success. Happy path!
XCTAssertNoThrow(try stateMachine.receiveUserAuthSuccess())
}

func testCertificateClientAuthFlow() throws {
let delegate = InfinitePrivateKeyDelegate()
Copy link
Collaborator

Choose a reason for hiding this comment

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

This test is wrong: you aren't using your new delegate.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yep, fixed!

Motivation:
Right now there is no way to use certified public keys for user auth.

Modifications:
1. Adds new init to PrivateKey
2. Updates UserAuthRequestMessage to support public key
3. Adds a test

Result:
Closes apple#63
@artemredkin artemredkin force-pushed the implement_certified_key_in_client_auth branch from 2cf4d21 to 545cf28 Compare January 14, 2021 09:57
Copy link
Collaborator

@Lukasa Lukasa left a comment

Choose a reason for hiding this comment

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

Nice! This LGTM.

@Lukasa Lukasa added the 🔼 needs-minor-version-bump For PRs that when merged cause a bump of the minor version, ie. 1.x.0 -> 1.(x+1).0 label Jan 14, 2021
@Lukasa Lukasa merged commit 5d95eba into apple:main Jan 14, 2021
@artemredkin artemredkin deleted the implement_certified_key_in_client_auth branch January 14, 2021 14:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🔼 needs-minor-version-bump For PRs that when merged cause a bump of the minor version, ie. 1.x.0 -> 1.(x+1).0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

There is no way to use Certified Public Keys in client auth
2 participants