Skip to content

Conversation

@roger-cruz
Copy link
Contributor

…Key Usage rather than Application Policy

The PoSH command used here to generate a self-signed certificate, which is then promoted to a trust root CA did not work for me.
$rootCert = New-SelfSignedCertificate -CertStoreLocation cert:\CurrentUser\My -DnsName "RootCA" -TextExtension @("1.3.6.1.4.1.311.21.10={text}1.3.6.1.5.5.7.3.1,1.3.6.1.5.5.7.3.2")
Certificates signed with the above certificate will show a warning "The certificate is not valid for the selected purpose". If you try to use these certificates, you will get invalid certificate errors from clients.
The way I was able to fix this is to provide a -KeyUsage that includes "Certificate Signing" and change the OIDs to use the extended key usage rather than application policies. Once this was done for the root CA certificate, new certificates worked like a charm.
I suggest the command be changed to be like below.
$rootcert = New-SelfSignedCertificate -CertStoreLocation Cert:\CurrentUser\My -DnsName "RootCA" -TextExtension @("2.5.29.37={text}1.3.6.1.5.5.7.3.1,1.3.6.1.5.5.7.3.2") -KeyUsage CertSign,DigitalSignature,KeyEncipherment

Summary

Describe your changes here.

Fixes #Issue_Number (if available)

…Key Usage rather than Application Policy

The PoSH command used here to generate a self-signed certificate, which is then promoted to a trust root CA did not work for me.
$rootCert = New-SelfSignedCertificate -CertStoreLocation cert:\CurrentUser\My -DnsName "RootCA" -TextExtension @("1.3.6.1.4.1.311.21.10={text}1.3.6.1.5.5.7.3.1,1.3.6.1.5.5.7.3.2")
Certificates signed with the above certificate will show a warning "The certificate is not valid for the selected purpose". If you try to use these certificates, you will get invalid certificate errors from clients.
The way I was able to fix this is to provide a -KeyUsage that includes "Certificate Signing" and change the OIDs to use the extended key usage rather than application policies. Once this was done for the root CA certificate, new certificates worked like a charm.
I suggest the command be changed to be like below.
$rootcert = New-SelfSignedCertificate -CertStoreLocation Cert:\CurrentUser\My -DnsName "RootCA" -TextExtension @("2.5.29.37={text}1.3.6.1.5.5.7.3.1,1.3.6.1.5.5.7.3.2") -KeyUsage CertSign,DigitalSignature,KeyEncipherment
@roger-cruz roger-cruz requested a review from Lxiamail as a code owner February 4, 2019 00:26
@rpetrusha
Copy link
Contributor

@Lxiamail @zhenlan @mconnew could you review this PR, please?

@Lxiamail Lxiamail requested a review from bartonjs February 22, 2019 16:24

```powershell
PS $rootCert = New-SelfSignedCertificate -CertStoreLocation cert:\CurrentUser\My -DnsName "RootCA" -TextExtension @("1.3.6.1.4.1.311.21.10={text}1.3.6.1.5.5.7.3.1,1.3.6.1.5.5.7.3.2")
PS $rootcert = New-SelfSignedCertificate -CertStoreLocation Cert:\CurrentUser\My -DnsName "RootCA" -TextExtension @("2.5.29.37={text}1.3.6.1.5.5.7.3.1,1.3.6.1.5.5.7.3.2") -KeyUsage CertSign,DigitalSignature,KeyEncipherment
Copy link
Member

Choose a reason for hiding this comment

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

  • KeyUsage should be CertSign,CrlSign,DigitalSignature.
  • 2.5.29.37 (and its value) should be removed
  • Add 2.5.29.19={text}CA=true to TextExtension

These recommendations make a root authority look like roots under the CA/Browser Forum Baseline Requirements (v 1.6.3) (https://cabforum.org/wp-content/uploads/CA-Browser-Forum-BR-1.6.3.pdf) (section 7.1.2.1)

Copy link
Contributor

@rpetrusha rpetrusha left a comment

Choose a reason for hiding this comment

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

Thanks for submitting this PR, @roger-cruz. I apologize that it's taken so long for us to respond to you. Could you address the comments from @bartonjs, and then I can merge your PR.

@roger-cruz
Copy link
Contributor Author

roger-cruz commented Feb 22, 2019 via email

@rpetrusha
Copy link
Contributor

Certainly it can wait until you have time, @roger-cruz.

@mairaw
Copy link
Contributor

mairaw commented May 13, 2019

Any updates here?

@mairaw
Copy link
Contributor

mairaw commented Sep 16, 2019

I've applied the feedback since this PR has been open for a while. @bartonjs can you make sure I captured your feedback correctly? Thanks!

@bartonjs
Copy link
Member

Looks reasonable to me.

@mairaw mairaw dismissed rpetrusha’s stale review September 17, 2019 00:28

review is stale.

@mairaw mairaw merged commit f2c82f0 into dotnet:master Sep 17, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants