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

pki: add ext_key_usage to mirror key_usage and add to sign-verbatim #4777

Merged
merged 3 commits into from
Jun 15, 2018

Conversation

ThatsMrTalbot
Copy link
Contributor

@ThatsMrTalbot ThatsMrTalbot commented Jun 15, 2018

I recently was looking at using the vault pki backend to sign CSRs verbatim and found that you could not set the key usage or extended key usage.

This PR adds that ability to sign-verbatim as well as adding the field ext_key_usage to mirror key_usage (and supporting more extended key usages in the process).

@@ -958,7 +968,7 @@ func generateCreationBundle(b *backend, data *dataBundle) error {
KeyBits: data.role.KeyBits,
NotAfter: notAfter,
KeyUsage: x509.KeyUsage(parseKeyUsages(data.role.KeyUsage)),
ExtKeyUsage: extUsage,
ExtKeyUsage: extUsage | parseExtKeyUsages(data.role.ExtKeyUsage),
Copy link
Member

Choose a reason for hiding this comment

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

If you send data.role into parseExtKeyUsages then you can move the logic up above into it so this just becomes ExtKeyUsage: parseExtKeyUsages(data.role).

jefferai
jefferai previously approved these changes Jun 15, 2018
Copy link
Member

@jefferai jefferai left a comment

Choose a reason for hiding this comment

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

Looks good, would appreciate the cleanup I suggested though.

@jefferai jefferai added this to the 0.10.3 milestone Jun 15, 2018
@ThatsMrTalbot
Copy link
Contributor Author

Cleaned it up as you suggested 👍

@jefferai
Copy link
Member

Thanks!

@jefferai jefferai merged commit 042b9d4 into hashicorp:master Jun 15, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants