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

Fix elliptic curve certs and add a unit test #243

Merged
merged 3 commits into from
Feb 27, 2019

Conversation

brendandburns
Copy link
Contributor

Fixes #242

@k8s-ci-robot k8s-ci-robot added the cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. label Feb 14, 2019
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: brendandburns

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@k8s-ci-robot k8s-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Feb 14, 2019
@k8s-ci-robot k8s-ci-robot added the size/S Denotes a PR that changes 10-29 lines, ignoring generated files. label Feb 14, 2019
@brendandburns brendandburns requested review from tg123 and itowlson and removed request for krabhishek8260 February 14, 2019 02:50
@k8s-ci-robot k8s-ci-robot added size/M Denotes a PR that changes 30-99 lines, ignoring generated files. and removed size/S Denotes a PR that changes 10-29 lines, ignoring generated files. labels Feb 14, 2019
@brendandburns brendandburns reopened this Feb 14, 2019
Copy link
Contributor

@itowlson itowlson left a comment

Choose a reason for hiding this comment

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

The actual code looks fine! ...but I have cosmetic nitpicks with all the other files...

/// <param name="context"></param>
[Theory]
[InlineData("craftsman-context")]
public void ContextElpiticKey(string context)
Copy link
Contributor

Choose a reason for hiding this comment

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

typo

Suggested change
public void ContextElpiticKey(string context)
public void ContextEllipticKey(string context)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done.

@@ -51,3 +56,7 @@ users:
user:
client-certificate-data: LS0tLS1CRUdJTiBDRVJUSUZJQ0F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dVFhRXd5WnNYOENnWUJzekNtZ0VadHVqUG9kTGZxTlZ5blIKR0t3ZW1xdWFvcnBXNFVkT1l0aXdHTS9kTzRrVVAvMlErbnRzVDZXVU9SWkRQUzgwbytlRjd1Y3VieXpwcEEvKwpndUJraWdLdW5KTWtTendUNVZrS0dtR05YdmlYZU5QSzZWeG1IWXltdVVONDhvN2F3SjNOSWxKaWl2K3VLMUxTCndqY2M0QlRjditUWjFEN2FNNEZXYndLQmdHY1MyNE96VEJiYmdTb3lRZS83OVJYazhPZFU4YjlCN0VZVjJRUloKdWRkcDVlZFJNUWJoWlh6S21zZHk0bXZWK25BRElYa0dkbHA5dDFhLzN1ZnpCSUsyenpOdTN1MnBUcnZaL1kyUQpLMVJQTjkrb3U3ZDYvd1ZCSkZQMENKSzgzU1R1bGtEaXI3andhZVViNTQvNFNYcUdPNU4rUEdPOVZFMnBGNGFlCnlVTnpBb0dCQUptMU1vcFQ4N0llelBmQ010ck51cXVqQjFpdStvb1lIYm9IbGJXZUNxS3RSRnNYMWhXOWpTY1UKQ0ZRanhSVCtPcENVWndjbDdkY2xsTUlxQTRWQ1NmUUFRMW9CMU41WENRWE8xVFlXOHU1K1BRTUdUcFEvQlVEawp6WmRJZzZqQkFXd3R6YkNzKzRjVkFoclN3cDRBSXFvcndTZU1qRmdsTmNoNzgxMEF6emNJCi0tLS0tRU5EIFJTQSBQUklWQVRFIEtFWS0tLS0tCg==
- name: purple-user
Copy link
Contributor

Choose a reason for hiding this comment

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

I hope I'm not being humourless (the sure sign that I am being humourless), but I think we should aim to name test data etc. after its role in the test e.g. elliptic-key-user rather than purple - this makes it much easier to understand the difference between e.g. purple-user and red-user without having to search through the tests to see where they are used and reverse-engineer what their significance is.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done (I was sticking to the pre-established theme, which I didn't start :)

@@ -0,0 +1,29 @@
-----BEGIN EC PARAMETERS-----
Copy link
Contributor

Choose a reason for hiding this comment

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

I would consider renaming this file e.g. elliptic-client.key so that it is easier to know what it's for from the filename without having to look at how it is used or search up the Git commit message.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done.

@@ -54,6 +54,20 @@ public void ContextCertificate(string context, string clientCert, string clientC
Assert.Equal(cfg.ClientKeyFilePath, clientCertKey);
}

/// <summary>
/// Checks for loading of eliptical curve keys
Copy link
Contributor

Choose a reason for hiding this comment

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

typo

Suggested change
/// Checks for loading of eliptical curve keys
/// Checks for loading of elliptical curve keys

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done.

@itowlson itowlson changed the title Fix a elipitic curve certs and add a unit test. Fix elliptic curve certs and add a unit test Feb 14, 2019
@brendandburns
Copy link
Contributor Author

@itowlson comments addressed (and test fixed for CI) please re-check.

Thanks!

@itowlson
Copy link
Contributor

/lgtm

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Feb 14, 2019
@itowlson
Copy link
Contributor

CI has picked up what may be a portability issue:

Failed   k8s.Tests.KubernetesClientConfigurationTests.ContextEllipticKey(context: "elliptic-context")
Error Message:
 Interop+AppleCrypto+AppleCommonCryptoCryptographicException : Unknown format in import.
Stack Trace:
   at Interop.AppleCrypto.X509ImportCertificate(Byte[] bytes, X509ContentType contentType, SafePasswordHandle importPassword, SafeKeychainHandle keychain, Boolean exportable, SafeSecIdentityHandle& identityHandle)
   at Internal.Cryptography.Pal.CertificatePal.FromBlob(Byte[] rawData, SafePasswordHandle password, X509KeyStorageFlags keyStorageFlags)
   at System.Security.Cryptography.X509Certificates.X509Certificate..ctor(Byte[] data)
   at System.Security.Cryptography.X509Certificates.X509Certificate2..ctor(Byte[] rawData)
...

Is it expected/acceptable that elliptic keys would not work on Mac? If so could just turn off the test in Mac environments?

@brendandburns
Copy link
Contributor Author

Maybe it's this specific EC key? I'll try to generate one on a mac and see if it works...

@k8s-ci-robot k8s-ci-robot removed the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Feb 21, 2019
@brendandburns
Copy link
Contributor Author

@itowlson I managed to create an elliptic key that made both the mac and linux happy...

@brendandburns
Copy link
Contributor Author

@itowlson friendly ping on this one (and the dotnet version update PR too :)

thanks!

@itowlson
Copy link
Contributor

/lgtm

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Feb 27, 2019
@k8s-ci-robot k8s-ci-robot merged commit 948d78c into kubernetes-client:master Feb 27, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. lgtm "Looks good to me", indicates that a PR is ready to be merged. size/M Denotes a PR that changes 30-99 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants